Sign In Register

How can we help you today?

Start a new topic
Answered

Drop in / Drop out real time session version of the tank tutorial

Hello


I'm trying to create a drop in / out version of the tank tutorial. I'm currently thinking that I can instantiate 30 playable characters (the game would be max 30 players) and keep them all hidden / inactive.


My idea is that when someone logs in with peerID 25, they take over the playerCharacter[25] in my array of player characters. Any unused playerCharacters remain hidden and don't send any network data. Is this a mad way of going about it? 


How does the Peer ID work? I'm assuming in my 30 player max game, the peerID will always be a value between 1 and 30. If someone drops out, say PeerID 5, I'm assuming that peerID is then available to anyone who joins again? Would peerID ever exceed 30 and crash the game?


Hope this makes sense! Thanks very much



https://docs.gamesparks.com/api-documentation/realtime-api/rtplayer.html


Thanks!


Jim


Best Answer
Hey Jim,

The RT- session will actually preserve the peerID for anyone who has 'dropped out', just in case they want to come back in.
So, for example in a match of 4 players, if Peer 1 drops out and another player joins, they will be given peerID 5.

When a change to the match happens, each player will get a MatchUpated message.
So, from this you can check if there are any new players that need to be instantiated.

Does that make sense?
Sean

 

1 Comment

Answer
Hey Jim,

The RT- session will actually preserve the peerID for anyone who has 'dropped out', just in case they want to come back in.
So, for example in a match of 4 players, if Peer 1 drops out and another player joins, they will be given peerID 5.

When a change to the match happens, each player will get a MatchUpated message.
So, from this you can check if there are any new players that need to be instantiated.

Does that make sense?
Sean

 

Login to post a comment