- Home /
How can I make that one player could watch other player's game as an observer?
Hi mates!.
I'm trying to make a version of my game which consits of a "super" player that can control the developement of the game of other players.
The fact is that I want that the "super" player could watch the developement of the others player's game as if he was them...Like when you are playing to other FPS games (Team Fortress 2 for instance) and you are waiting into the lobby to respawn.
I only need to redirect or send the camera's view of the other player to the "super" player in order that the "super" player can handle some golbal variables if he considers it based on what's happening to the normal player...
I think I now how to create GameObjects in the server version but, how should I do the instantiation of the same camera view of the other player in the server version of my game (what I called as the "supper" player)?.
Do you understand me?. I know that it must be something very simple but it's my first time and I've spent too much time with it...
Any idea?.
Thanks in advance.
Well, as long as you have proper synchronisation going on between all your players, it should be as simple as putting a camera up in the sky somwhere which your 'super player' uses! I'm not actually sure where the problem is, here.
Answer by jorgon · Oct 24, 2011 at 10:43 AM
What do you wanna mean with the "proper syncronisation"?. I'm trying to understand the MultiplayerNetworking.pdf from the Official Unity3D website and I suppose that you are referring to the creation in the network of the client/server via somthing like this:
var SpaceCraft : Transform;
function OnNetworkLoadedLevel () {
// Instantiating SpaceCraft when Network is loaded
Network.Instantiate(SpaceCraft, transform.position, transform.rotation, 0);
}
function OnPlayerDisconnected (player : NetworkPlayer) {
Network.RemoveRPCs(player, 0);
Network.DestroyPlayerObjects(player);
}
I don't know if you wanna mean something like this...I'm really new at networking in Unity3D. And I figure out that this is really simple, the only problem is that I'm really new with it and I've never make a server/client application but I know what I want to do.
Could you be a bit more specific, please?. Thanks for your help syclamoth.
P.S.: (for administrators/moderators only) I needed to write a new answer and not a new comment because I wanted to post some code and a comment didn't allow to me to do this.
write your comment out with full formatting in the answer box, then cut and paste it into the comment box. Easy :).
I agree that your question should not be downvoted. You are actually trying to learn, which is more than many people do.
For the record, you could add this code to your original post and format it there.
It is perfectly ok to edit your original question so it changes over time as you change your approach to solving it.
Well, what I mean is, are all the objects which are important to your game the same on all computers? Have you been doing a lot of multi-player testing of this? In my experience, Network.Instantiate can cause unexpected problems, despite being somewhat easier to use than manual network instantiation, however for simple stuff it works quite nicely.
Also, what negative vote?
Thanks for your support and excuse me for my inexperience. I've voted up your right comments towards me. And I didn't know that I could make the trick of copy&paste a formatted code inside the answer textfield for the final paste as a comment: the format of code-text could be mantained even inside a comment textfield!.
But related to the original question syclamoth :I'm still trying to connect a client with a server: I'm trying to create a web version of my game and I'm trying to connect it to me server version. I'm in a very early stage of learning about networking in Unity3D. There are some functions, necessary preocedures and basic concepts I'm still trying to assimilate and learn how they work. I don't know how to share (or if it's possible) the same camera for both, (server and client) and I have to study how to access to the global variables I've created in my single playerversion of my game.I will tell you more when I achieve my objective. Don't you know how much I desire to put in green color the indicator of this question/answer. :-).
Thank you very much for your support and comprehension.