- Home /
Network and lobbies tips and tricks ?
Hi everybody, we need to a personnal project to create a network connection between people and probably a server cause our TPS can accept until 8 players simultaneously on one game session. So we probably need to develop a lobbies room module to allow player to join one game or another.
We never do that so if some people on Unity answer can give us tips and tricks we will be really happy ? :) As well the traps and the frequents mistakes that people do ?
Sincerely.
Answer by sweatyrat · Jun 28, 2012 at 07:47 PM
well just from my experience i found it easiest to use a lot of RPC calls. for example i made an array of a custom class playerinfo which had values for every setting they could choose , their network player reference, and name, and then as players changed their teams or character it would apply those as a buffered RPC to all. so that way new players who enter the lobby will get those updates and catch up to everyone else. and then you just need to use function OnPlayerDisconnected(player: NetworkPlayer) {} to make sure you remove that player's playerinfo from the array when players leave and have players send RPC to all when they connect for everyone to add them to the array.
the other option would be to have the networkview inspect the script and have it serialize all of the values in the player array but that gets messy in my opinion.