I’m developing a 2D Multiplayer Poker Game. I’m stuck at a single point. I’ve already done Master Server and GMS programming using peer-to-peer hybrid model. It’s successfully Creating new server and players can join other available games created by other players. But while in game screen mode, in game screen programming, as soon as the player joins a game/lobby/private game, how to position the player’s game object to the specific empty position at the table. Meaning, how to set the new player joining the table automatically to the place empty. It’s a simple stuff but I’m not able to get it. May be somebody can help!
1 Answer
1In my game I have only 2 players and spawning them using isServer/isClient parameter. For more players you need server to give new id for each connected players using OnPlayerConnected, like:
int _server_connectedPlayers = 0;
void OnPlayerConnected(NetworkPlayer player){
_server_connectedPlayers++;
networkView.RPC("spawnPlayer", player, _server_connectedPlayers);
}
[RPC]
void spawnPlayer(int id){
Network.Instantiate(PlayerPrefabGoesHere, GameObject.Find("SpotNumber" + id.ToString()).transform.position, GameObject.Find("SpotNumber" + id.ToString()).transform.rotation, id);
}
thank minizinger...but I want to spawn the players dynamically into the position they choose!
– asethi