Hi, Unity community!
I am developing a turn-based multiplayer game called Battle Paws, where players put their “Paws” (monsters) to fight in an arena. Currently, I am using Unity Cloud Save to store each player’s Paw data.
I save all the player’s Paws in a single attribute in Cloud Save, called PawInstances
. This attribute contains a list of Paws serialized as JSON. During gameplay, I deserialize this data to use in battles. However, this approach is becoming quite cumbersome, especially in a multiplayer game, because:
- I need to repeatedly deserialize large JSON blocks.
- It increases the complexity of my code and potentially affects game performance.
My question is: Is this approach correct, or is there a more efficient way to store and access Paw data in Unity multiplayer games? I have considered using external databases or splitting the data into smaller attributes, but I’m unsure if this is the best solution.
Any suggestions are greatly appreciated! Thank you!
I have never used Unity Cloud Save, but a bunch of json can be hard to manage and debug unless it will never change.
I worked on a similar turn-based battler game and we used mongo DB. A good database structure can reduce gameplay latency and development complexity. It can also help simplify shared data between your monsters. As an example, instead of every player’s monster having stats, the player just has a list of monster ids they own which are used as keys for another stats table for each monster type. Then when you need the stat info for all the player’s monsters, you construct a compound query for it.
We also used our database for multiplayer, info and actions were submitted to a row in a table, once both players submitted their actions the turn was executed server side, then both player’s got the results. It worked pretty well and was cheat resistant since all actions were verified server side. Player’s couldn’t even figure out what their opponents stats were during battle because they didn’t receive that info until it was sent in post-battle.