Save State on Relayed Multiplayer

Hi, I’m creating a LUDO Game based relayed multiplayer. Previously I’m saving my Temporary state on a third party database which can be access by all. But calling state update on every dice roll and coin update is taking huge resource on server and it’s making the server to down, while have 20+ players… I tried to maintain the state of the game on the Nakama itself by writing a RPC function to save it on database. But I guess it’s not taking a common DB to save the state. But each client saving the state individually under their account. that seems not working on my case.

Now I need Help for the below
Need a common place to save and retrieve state of the match which can be accessed by all the players who were on the same room. then that state should be deleted automatically after some minutes. say after the room is closed

Hmm, you might need a different approach. Do you need to save the state to the DB every single update?

It can be common to save the state of the game in the DB, you can use the Storage objects with the runtime code or the client code. If they’re all together playing, cant you just relay the message to all players and then just save the state once every X amount of time? And how much data do you even need to save? Your map is static and not changing so you can basically just save positions for all players and thats about it, not that costly. You were a bit vague but generally you can probably use the Docker-Compose setup and have a local db together with your server and then just use Nakama Storage and save those. You can have a special token that only the users of the current match have to retrieve the match data, because it would be public.

https://heroiclabs.com/docs/storage-collections/

2 Likes