question

boobidomain avatar image
boobidomain asked

Authoritative Server for a multiplayer card game

Hi i know this question has been asked before but i still don't fully understand some stuff.

I am developing a "simple" multiplayer card game (like poker) that means players log into a lobby (no chat or anything special) and have options to enter different rooms and play the game.

I'm currently using photon for matchmaking, but i need a way of course to do some authoritative checks so that players do not cheat , so i don't understand what is the right solution to do that.

I want this actions\checks to be made by a server :

- create a 52 card deck ( cards are just enum with card value and suit )

- deal cards to players

- player A put card on table , player B put a card on top of table , check which card is higher card

etc ..

Can i accomplish this by using Playfab cloud script ? will be cool so see a simple way to do it

or this has to be a server running the server side instance ?

,

Hi i know this question has been asked before but i still don't fully understand some stuff.

I am developing a "simple" multiplayer card game (like poker) that means players log into a lobby (no chat or anything special) and have options to enter different rooms and play the game.


I'm currently using photon for matchmaking, but i need a way of course to do some authoritative checks so that players do not cheat , so i don't understand what is the right solution to do that.


I want this actions\checks to be made by a server :

- create a 52 card deck ( cards are just enum with card value and suit )

- deal cards to players

- player A put card on table , player B put a card on top of table , check which card is higher card

etc ..

Can i accomplish this by using Playfab cloud script ?

or this has to be a server running the server side instance ?

CloudScriptCustom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

If you want it to be fully cheat-proof, a game server would be the way to go. However, you could potentially do this in Cloud Script, though you would be dependent upon the client to drive the actions, and there would be some opportunity for cheating. You could use the RoomJoined event to trigger building the deck and dealing the cards (check that both players are in the room in the RoomJoined, to make sure it's only called once), saving the players' cards to a Shared Group Data. Don't add the players to the Shared Group Data directly though, as then they could cheat. Then, when each player plays a card, check that he has it, remove it from his list in the SGD, and save the play info. The last part is where you're dependent upon the players, though - you would need to have a client call a Cloud Script to kick off the evaluation of the round. And since you should only have this happen once, only one of the clients should do this. In the Cloud Script, you would check the time elapsed (to make sure it's not a client sending the message very early, to try to cheat the other player out of getting a move), and then do the evaluation, writing the result to the SGD. The client that triggered the evaluation then signals that both players should check the results, and the both call the Cloud Script to do so. There is a risk that that client might (if it played a low card) never say that the evaluation is done, but you could put a timer on the client to have it check regardless.

However, one question that is important to clarify is, how quickly could play occur? If the players could be playing cards rapidly, it may exceed the rate limit for Cloud Script, in which case I would recommend using a custom game server.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

boobidomain avatar image
boobidomain answered

Hi @Brendan Thanks for your reply.

I will describe the the game play :

- new game is starting when there are max players in the room

- one player is chosen as the first attacker (player A)

- A has x time to put a card and attack player B ( x can be 10 to 15 sec not decided yet)

- player B has x time to answer this card

- A can add additional attack cards to the table up to 6 cards

That means for example :


player A attacks player B with a 7 diamonds

player B defended with 8 diamonds

player A can add 3 more cards (7 clubs\hearts\spades) to the attack cards

and because player B added 8 diamonds to the table , player A now can add 2 more cards
like 8 club\spades and that is a total of 6 attack cards and he cant put no more.

player B can defend against all 6 cards with his own cards.

In conclusion that means that a total of 12 cards can be played in a round.

I am not sure if that is a "quick" play scenario , a player can put lets say 4 cards one after another without waiting and the player defending can answer those cards as fast as he likes (until turn time is over)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

@boobidomain Given your timing dependencies, I would use a custom game server for this. Otherwise, you'll have to drive the timer from each client, none of which will have exactly the same time as each other. Technically, you could try to drive this by recording the start time for moves and have each client separately track the time, but then you have the situation where both clients B and C would need to make a "time's up" call on player A's move, which could cause problems if they both make the call at the same time (so, you could have two Cloud Script calls running simultaneously, each trying to update the same data). You could try assigning one client as the timer for the other player's move, but then you'd need to use the third as a fallback timer - basically, it turns into a headache quickly. It sounds like your logic is relatively lightweight though, so you should be able to host a lot of players per server.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]