General doubts for turn-based card game

Hi. I would need to request the help of an experienced user to address the following case:

We are currently developing with Unity a card game similar to poker, which already has an offline 1vs1 mode (without Photon). Among the features that we should add soon is the online game 1vs1. It's for this reason that, after contemplating different alternatives, we decided to incorporate the Photon Engine into the project.

We have quickly tackled the matchmaking system and it's already working. However, at the time of beginning the gameplay development stage, a series of doubts have arisen that at the moment we have not been able to evacuate them with the existing official documentation and with other reference sites.

These are some brief details of the project that could be useful to detail the doubts that will be exposed later:
* 2-player game: 1vs1
* It's played in turns, only one player can play at a time
* Each player receives 3 cards at the start of each round
* In each round players add points, according to the cards they have played and the "calls" they've made
* At the end of each round, the Unity scene restarts (calls another scene with the same name), so that players continue adding points
* The user interface is updated according to the current state of the game
* The game ends when one of the players reaches a certain amount of points

Taking into account the above, the doubts to address this stage of development are the following:
1. We understand that it is best to have the rules on the server side, mainly for security reasons. The only way to achieve this is through Photon Server? (we assume that Photon Cloud doesn't support this possibility)

2. Where can we find documentation, examples, guides, etc. to be able to do the things stated in point 1?

3. When starting a game, one player must be player 1 and the other player 2. How is this assigned or how can it be resolved with Photon, given that this affects the game rules?

4. The concern exposed in point 3 also arises in order to know what modifications we should make in the interface manager. A player will be player 2 for 'the rules' but for the interface he will always be in the same perspective (we could cite Clash Royale as an example, although it's not the same type of game). In other words, for "the view" each player will always be the "main player" in his client

5. How would you advise to address the communication between the client and the server to make queries with rules taking into account the characteristics of the project? The interface of each player is updated according to the "game state", which is modified by the rules according to the cards played and the "calls" made by each player.

6. We believe that it is necessary to instantiate the cards in Photon. Do you agree with this or do you think it could be omitted? Keep in mind that each player must be able to see the cards his opponent played. We must also instantiate the scene of "the table" where the game will be played.

At the moment, those are the main doubts. We greatly appreciate your time and collaboration.

Best regards.

Comments

  • Hi,

    First let me say that i have created a Hearthstone style game using photon cloud and hopefully i can point you in the right direction here.

    1) This is true, you definitely need to consider the security of the calls being made over the network. Generally youd want to use some form of an authoritative process. However, you can mimic this with photon cloud using room properties and clever thinking, but an authoritative approach will always be the best.

    2) Generally youd want to be in contact with a rep assigned to you with a server solution, i believe they have paid packages that support this.

    3) Since youre working off a 1v1 scenario, you can assign player roles but checking master client status or by gathering the unique ids of the connected players and doing some randomization code. Once the order has been found you can assign these in the custom room properties. Again these will be ueseful as you can dictate the current turn there too.

    4) If youre wanting different views in the scene for each player based upon their order, you simply user the method described above and assign positions based upon that.

    5) Room properties or creating a manager object that observes and syncs the current game state.

    6) Instantiation could be used, however for post instantiation you can sync the card state with an observed component.

    In closing there are many ways to tackle the questions youved asked, just note that for what youre making, you generally want an authoritative server so it can distribute the game state accurately.
  • Thank you very much for responding and sorry for the delay. Indeed, a few days ago we decided to carry out the project using Photon Server, since we had started with Photon Cloud.

    As I read, I understand that the logic of the game should be implemented as a Custom Plugin on the server. Also, some recommend that the communication between the client and the server be made through RaiseEvents.

    For example: when a player plays a card, the client sends the card played through a RaiseEvent so that the server updates the status of the game and sends it to both clients. Am I right or am I wrong?

    However, I need to ask for help. The information provided in the Photon Server documentation is really regrettable and incomplete. Definitely not focused on a user who has never used Photon and, if not for some part of the project already implemented in Photon, we would migrate to another technology due to lack of support. It is really a headache. "They show you a nut and with that they expect you to build a spaceship ..."

    I would need to know if there are any example projects (both Photon Server implementation and client side use in Unity) to reverse engineer and accelerate times. The main doubts at this moment are:

    1. Implement the logic of the game as a CustomPlugin, so that for each game there is an instance of the state of the game.

    2. Send information from the client using RaiseEvents. This is briefly explained, but it was not enough to address the cases we have.

    3. Receive the RaiseEvents on the server to perform the corresponding actions. Then send information from the server to all or some clients.

    4. Configure the server with Photon Core to be able to connect from the Unity client and perform tests.

    An example that would be of great help would be for a player to play his card in his turn, send the information of the card played to the server, there compare it against the card played by his opponent according to which has greater weight or is indicated to the opponent that is his turn to play his card.

    If someone can help us, I would greatly appreciate it.