My first question here! 🙂
Im trying to conceptualize how I would go about recording the moves of my players, and also the state of my game after the calculations of that move.
For example, Final Fantasy tactics.
- UnitA makes an attack
- Calculations will be done
- Store the last move, and also the state of the game after that move.
In the example above, for example, I use Firebase firestore to update the players of the state of the game. In that firestore document, i will update it with the latest move and its effects, together with the latest state of game.
My concern is in number 3, where should I put the record of the previous moves and state of the game after those moves. The purpose of this is for example, I want to replay the match. With records of each moves and states of the game after those moves, I will be able to replay the match accurately. My concern is, it seems recording all these seems huge data because, if a unit moves, I would have to store the entire state of the game, which includes all units hp/position in tile map/buffs/ abilities states(cooldown) etc.
What I have thought of so far
A: (Bad)Store them in same document as the latest document snapshot. Like create an array where it will contain the record of move and snapshot for that move
B: (I think better than A but so many documents will be created) Create one firestore document for each move with the state of the game after that move and store them on a separate firestore collection.
May I ask for advice.
Thanks in advance
The game is a typical turn based game with 2 players (for now, in my plan, i want it to be dynamic, could be 2 teams with multiple players in each team. Or 2 or more teams). But for now, just 2 players playing against each other. Each player controls units. Each unit has several abilities to use.
Abilities may Stun, apply Buff, and/or Damage etc the target unit/units. And those status may linger on on the targeted unit. For example, Silence or Stun for 2 turns. These are just few example of
attribute effects, but there are more and could be further increased in the future.
Unit A, and Unit B are allies. Unit X is their enemy. On previous turn, Unit X casted a
channeling stun to Unit B. Rendering Unit B unable to move. Now on new turn, Unit A stuns Unit X, freeing Unit B.
This is the example i listed above. Another example is below
Unit A, and Unit B are allies. Unit X is their enemy. On previous turn, Unit X casted
silence to Unit B. Now on new turn, Unit A casts a
repel buff to Unit B so he can casts spells again.
Reasons why I am considering storing every state per move:
- Replay purposes and displaying the state of the game accurately. Say for example, replay can be paused, and the viewer of the replay can check the state of the game (units, buffs, cooldowns, etc)
- Debugging purposes, say for example, a bug was reported saying a certain skill isn’t working as expected during a certain condition.