Sign In Register

How can we help you today?

Start a new topic
Answered

Cana a Player resume game after disconnection when coming back??

Hello!


I am quite new to your really amazing platform (what i have seen so far) and I am working on a mobile game, where 2 players battle against each other like in clash royale (complete other type of game, but the technical background would be needed). I was wondering if it is possible with your REALTIME SERVICES to save the game data/status on the server to ensure, that a player who was disconnected can resume the game when reconnecting again immediately??


And in general is it good to use your REALTIME SERVICES for such kind of games or can it be done with just cloud script, as all spawned objects (creatures and so on) are not moved by the player, the are just spawned at a certain position and the movement and so on is done automatically by the players stats ( speed,..).


Thanks for tipps and help


Best Answer

 Hey Julian,

It kind-of depends on if your game is asynchronous or not. The RT service would be overkill if you had a turn-based game or an async battle game. In this case you have a least a couple of seconds before you need a response so the normal websocket requests would be fine. RT is really only for cases where you want something updated in <1sec or even 2-300ms.


To answer your question, it is possible for the RT service to save data to the DB. You would do this with the RTscripts, and preform requests out to the main Spark API where you can read or write to the DB. You can find out more about RTscripts here.

Also, you can cache data on the RTscript for the duration of the session. So if a player disconnects, and data cached for that session is available to them when they reconnect without needing to save to the DB.

Hope that helps,
Sean





1 Comment

Answer

 Hey Julian,

It kind-of depends on if your game is asynchronous or not. The RT service would be overkill if you had a turn-based game or an async battle game. In this case you have a least a couple of seconds before you need a response so the normal websocket requests would be fine. RT is really only for cases where you want something updated in <1sec or even 2-300ms.


To answer your question, it is possible for the RT service to save data to the DB. You would do this with the RTscripts, and preform requests out to the main Spark API where you can read or write to the DB. You can find out more about RTscripts here.

Also, you can cache data on the RTscript for the duration of the session. So if a player disconnects, and data cached for that session is available to them when they reconnect without needing to save to the DB.

Hope that helps,
Sean





Login to post a comment