Sign In Register

How can we help you today?

Start a new topic
Answered

Dealing with offline users

Hello, I don't have much experience when it comes to backend services ( or in general)

Basically, I'm making a semi-online game. It's an action game where the player fight monsters. But I want to add a "Raid" system where multiple players in a certain group will fight the same enemy and eventually share the loot when he dies.

The enemy will have a health bar, (let's say 1000 points) that will be shared among that group of players, so when a player deal some damage (200) the other players should immediately see that the bar is now at 800 points.

 the players don't play together in realtime, meaning that they don't see or interact with each other. the only connection between them is that enemy's health bar, which if a player is just sitting there doing nothing and a second player is dealing damage, the first player should see that bar getting lower based on the second player's actions.

Two questions:

1- What is the most efficient way of achieving this in real time, or even every few seconds.

2- How to deal with offline players? does Gamesparks provide some sort of "auto-synch" like Firebase?

Thank You.


Best Answer

Hi Abdel Ghafour Mohie,


You should be able to accomplish this using our Challenges


You could store the enemies current health in the challenge's scriptData, use LogChallengeEventRequests to register attacks from players, update the enemies health in cloud code, and use the ChatOnChallengeMessage to update all players in the challenge of the change.


If you have any further questions please don't hesitate to get in touch.


Regards,

Vinnie


 

So...

[1] - In order to have new player join after a session is started, you will need to configure a drop-in/drop-out match. This will allow new players to be added so long as the match is not full.

[2] - The RT service can patch into the core GameSparks service using request in the RT scripts. So you can save data about your session to the DB and retrieve it when the match is completed.

Hope that helps,
Sean

A new RT session will be created on the server when a match is made and at least one player connects to that match. It is not quite the same as a dedicated server.

1- When a player starts a new session, can other players join him in the same session without him directly inviting those other players?( It's a clan based game after all) 


2- Is there a way to save and retrieve data from previous sessions? for example, two players in a session collectively did 300 damage to the enemy which had 1000 health points before. is it easy for when another player starts a new session to see that the enemy now is at 700 health points?

 Hey There,

Dont worry about asking questions, thats what we are here for :)

[1] - A new RT session will be created on the server when a match is made and at least one player connects to that match. It is not quite the same as a dedicated server.

[2] -  It does not have the same limits as the core gamesparks services.

[3] - No network is instantaneous. There is always some latency. RT is the fastest alternative using UDP protocols (which GameSparks uses). Syncing clients is up to you, but we have some tutorials on this here.

There is another tutorial on RT best processes that might explain a bit more here.


Any request or message sent using the socket counts towards the request limit.

Sean

I'm sorry I've been asking a lot of questions and sounding like a complete noob, but please bear with me.
Let's say I'm using a RT server:

1- This is just a server that is available whenever a user connects to it? Is it

2- Does it have the same limit as in the link above (Fair usage policy), or is it separate from that?
3- Once the user connects to that server, it will automatically sync the client with the most recent data, and whatever actions the player make will have an instantaneous effect on all the other clients?.

Finally, in general, what counts as a single "API Request" for example in a messaging app, does every message sent or received considered an "API Request"?


Hope I'm not much of a burden :)

Each player would need to stay connected for that period in order for the real-time servers to work.

If you have a delay of a couple of seconds, then there is no need to use RT. A custom implementation using ScriptMessages to sync data should be enough. Bear in mind that there is a limit to the amount of data and requests that can be sent per user using our core-services (excluding RT).

Sean

Question about Real-Time multiplayer,  That "Raid" system I'm implementing might go on for hours or even days, depending on the number of players and their actions, would it still be efficient to use RT multiplayer and handling requests from large numbers of player over that period?
I don't want the "sync" process to be instant, it's okay if it takes couple of seconds.

 Hey There,

It really depends on how fast you need those actions to be synced?
There are a few options. One would be to take a look at our RT multiplayer services [https://docs.gamesparks.com/tutorials/real-time-services/]

Another would be to add some game-design aspects to compensate for the delay. This would be things like a attack-timer. It would be common to use something like this to compensate for lag as even real-time has some latency depending on player internet connection and distance from the server.

Sean

Thanks for your answer @Vinnie
This does seem like what I want to achieve, but how will it handle multiple requests from many players in short amounts of time? meaning that whenever a player takes an attack action I want that to be synchronized with the other players, this could happen extremely fast and from a large number of player (think of a clan of 100 players or even more)

I also would like an answer to my second question about how to deal when the player goes offline, is there some sort of caching and auto-synch feature that happens when the player goes back online?

Answer

Hi Abdel Ghafour Mohie,


You should be able to accomplish this using our Challenges


You could store the enemies current health in the challenge's scriptData, use LogChallengeEventRequests to register attacks from players, update the enemies health in cloud code, and use the ChatOnChallengeMessage to update all players in the challenge of the change.


If you have any further questions please don't hesitate to get in touch.


Regards,

Vinnie

Login to post a comment