Ahoy hoy.
I can’t really figure out a way to differentiate between players, to assign them team and player numbers etc, and to have them spawn at different locations.
Especially the spawning is troublesome at the moment, as everyone spawn in a pile and gets stuck.
Any help appreciated.
Thanks.
That can indeed be a little tricky
The way I’m solving it (I also have teams and players in those teams) is that I’m keeping ordered lists of teams and players, and also have “Team-Spawning points”. A “Team-Spawning point” consists simply of several empty game-objects that are the locations where I instantiate the player game objects. Then, each player game object “pulls” its player / team information from the lists. Those lists are kept synchronous between server and all clients.
On each client, one “player-object” is owned by that client. This is how I determine which game object is controlled by the user. All player-objects are network-instantiated by the server. I’d say this is not trivial, but it can be handled
Jashan
The networking example project does have a simple example of how to initialize clients before they actually spawn their own objects. It’s in the Castles scene if I recall correctly and also a bit in the TPS-Auth scene. Its just a case of sending RPCs back and forth as a new client connects, so the server can tell the client where to instantiate his own object, in the case where the server doesn’t actually spawn the object for him.
The spawn position RPC buffer problem was also discussed a bit here: http://forum.unity3d.com/viewtopic.php?t=8595