You can use “Photon” to do it in a game at the same time.
First, you need to have your own UserID (MyUserID).
Next, you must verify the identity of all players in this game at the same time, and obtain a unique UserID at the same time, and record the required state of each UserID in the game.
Then set up a cyclic update function.
You only need to match your own UserID obtained in the first step to the UserID of all the people obtained in the second step. You only need to use IndexOf to know where you are and get all the game states at that position.
After that, you only need to simply set it in the loop update function, if UserID == MyUserID .
You can easily achieve the function you want.
But as “roaminggamer” said, developing multiplayer games will encounter quite a lot of trouble.
Originally, I also planned to add real-time online combat function to the game, but due to network delay, I was discouraged.
Therefore, at this stage, only the non-real-time battle function is retained. It is only necessary to obtain the battle data of both parties and write a auto battle algorithm.