Implementing multilplayer in a strategic game using Photon

Options
Hello guys,

I've been working on my second project as a beginner game dev and I though on making a small scope game. I also wanted to try making it multiplayer and after a bit of research I found out mirror and Photon as good resources to get it done.

After some tutorials and documentation I am a bit confused because I haven't found some way to implement my expected game flow inside my game.

ABOUT MY GAME:

There are two teams and one has to survive, killing the enemy team. In order to that, players can move around the map and throw a rock. The "interesting" thing about this is that players have a "Think Phase", where they can move around and it's not seen by any player, and set its throw. After the think phase, it begins the "Action Phase", players first move and set its position and then they throw the rock.

MY THOUGHTS

As I see it, it's an asynchronous call. For that I want my players to "synchronize" movement after think phase and then throw the rock.

Also, I don't know exactly how should I store local movements from player (using a queue? sounds weird because i use AddForce for playerMovement...).

The tutorials I've found explain real-time synchronization and the few of them which explain turn-based games doesn't exactly match my game flow.

I also tried the rock, paper and scissors example which uses Photon but I haven't gotten anything clear.

Maybe I shouldn't have picked Photon? Any thoughts about this?

TL;DR: How should I implement a "think phase" and a "do-phase" using Photon? Think-phase = local movement + throw set, do-phase = "synchronize" for other players

An example how they game I want it to look like: https://www.youtube.com/watch?v=U7nj7HpDqJQ&ab_channel=SatvikKhanna

(Yes, it's a "copy" of this game, but I want to change and add some things)

Comments

  • Tobias
    Options
    I did not understand yet, if the "move" phase just plays what everyone did in the "plan" phase?

    To plan, yes, record the actions done by everyone. You only need to record the input of a player. Let's say plan phase begins and 100 ticks into this phase, the player clicks somewhere. Record that with the timestamp. Put this into a format that can be sent and read.
    This is what's needed for the synchronization to work.

    The play phase: Well. Advance the simulation tick by tick and check everyone's input. Make sure the results are deterministic (the same on any framerate and device).