Page 1 of 1

Hiding cards from players

Posted: 02 January 2021, 17:06
by Hornir91
Hi.

I'm a developer of Dungeon Lords and recently went into a problem with cards. In one of the states players are placing their cards with face side down, to hide it from the other players. So in a holder div on player board I have a card div with background-image of card's back side, which will be changed to corresponding face side when the card will be revealed.

And there is a problem, because when you inspect non-revealed yet card you can see in dev mode (F12) id of card, which can give the inspector an information which card is currently chosen before revealing it in a next state.

So I thought of something to hide the information in the dev mode by placing in a holder div an empty div with background-image of the card's back side and then when the card needs to be revealed just take the info from DB and create the card with corresponding bg-image.

Is that the way it should be done here, on BGA? Or you have some better ways to do it?

Re: Hiding cards from players

Posted: 02 January 2021, 19:21
by RavingWanderer
You shouldn't send the id of the card to other players until it is revealed to them. This could be either in a notification or via state args. (E.g. in first state, you send notification "Player X plays a card face down in front of them", then in second state you send notification "Player X turns card over, revealing NAME_OF_CARD". Other players' browsers only find out from the second notice what the card actually is.

Re: Hiding cards from players

Posted: 02 January 2021, 20:13
by tchobello
hi

the problem is : an id always corresponds to the same card.
try to shuffle cards first...

Re: Hiding cards from players

Posted: 03 January 2021, 01:16
by Hornir91
tchobello wrote: 02 January 2021, 20:13 hi

the problem is : an id always corresponds to the same card.
try to shuffle cards first...
Thanks. After shuffling cards before inserting into DB they have now different id's in every game.