Turn based game

Hi! I want to make turn based duel game and i wondering, how could i make the start turn? I somehow need to choose between players who will be play first. Could someone help me with this issue? I’m using realtime multiplayer for matchmaking.

Welcome @DeadlyBagel :wave:
Is the turn-based gameplay active realtime or is it a passive multiplayer game?

Hi again! Sorry for long answer. It’s an active realtime multiplayer game. Player doing some actions, then click “end turn” button, and then starts the turn of next player But i don’t have any idea how to make the start turn.

You can choose the person to start by the ID of the player

for example I have 3 Players and their IDs like below,

SGSTWBS24522
BWRT323452SV
V34FFS3443252

You sort them by the first letter like this

BWRT323452SV will play first
SGSTWBS24522 will play second
V34FFS3443252 will play third

Sorting method is not perfect. Player which ID starts with A will be first more often.

Better to use sorting method to choose first player which will randomly order players in list.

This will require further communication between the players … because the random for Player 1 will be different than player 2… regrading the problem of the player having better chance because of his ID the solution is to use the match ID first letter as an input to sort the players ID

For example
if match ID start with A C E G…
then the players will be sorted asce…

else if match ID start with B D F H …
then the players will be sorted desc…

I agree with @Mohammed. @Dimon4eg What you’ve mentioned as a possible challenge with the deterministic approach is a good point but the alternative involves more roundtrips between clients to settle on the turn order. Both approaches are straightforward to do with Nakama but as with all development decisions they have different tradeoffs. :slight_smile:

I think which approach to choose depends on your game design requirements @DeadlyBagel