Forum C# Does server stop running when no one is using?

Does server stop running when no one is using?

Postby uterian » April 19th, 2013, 9:24 pm

Hi
I want to know if server completely stops running when no one is using?
You know most of online games have time calculations even player is not online, like "energy recovering with time". Because of bugs or crashes or similar reasons server may be closed and all the players become offline. So what will happen?
And one more question, is the serverside code we use is running uniquely for each player? Because if it's, if there is a timer for a specific player, when that player goes offline, timer stops.
Thank you
Uterian.
uterian
 
Posts: 8
Joined: March 29th, 2013, 2:09 am

Re: Does server stop running when no one is using?

Postby Henrik » April 20th, 2013, 3:07 pm

Serverside code runs when you start a multiplayer room, and as long as there are players in that room, it will continue running. However, if all players quit the room, it will terminate.

So yes, there has to be players online for your multiplayer code to run.
Henrik
.IO
 
Posts: 1832
Joined: January 4th, 2010, 1:53 pm

Re: Does server stop running when no one is using?

Postby kaiserxen » May 11th, 2014, 10:57 am

You dont need a server code running 24/7 for those tasks like calculate recovered health, pasive income etc. you can use it with log off and log in times. when the player logs in after any time you get the last log off time, calculate the total elapsed time between them and apply the required action. quite simple.
kaiserxen
 
Posts: 9
Joined: March 5th, 2013, 11:22 pm

Re: Does server stop running when no one is using?

Postby AquamentosGames » July 18th, 2014, 9:11 pm

What kaiserxen said is exactly right.

Games that have timers - even most zynga games (Farmville ect) - don't actually update continually for every player signed up. That would be a ton of 'wasted' processing power that only gets worse the more players signed up.

Instead, when the player logs in, it checks how long since they logged out and refill the timers based on that information for the time elapsed.
AquamentosGames
 
Posts: 27
Joined: December 9th, 2011, 12:44 am


Return to C#



cron