Jump to content

  • Log In with Google      Sign In   
  • Create Account


How it works


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 brunnot   Members   -  Reputation: 102

Like
0Likes
Like

Posted 07 January 2014 - 05:45 AM

Hi, I’m wondering how games like Clash of Clans or Samurai Siege are developed.

I know that involve isometric maps etc…but I can’t imagine how the server side are developed.

Everything that I think, it seems slow. For example, in this kind of game, we can build some kind of Resource Producer, and this build take some time to be complete.

How this logic works I mean.
There is one record for every player in some kind of DB ?
This TIME is controled by CRON in server or the Game Loop check every object for every player?

I tried to find some kind of tutorial but i just know this kind of game as “Time Management Game” and I couldn’t find nothing ?

tks.
Brunno

Sorry my bad english



Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5099

Like
1Likes
Like

Posted 07 January 2014 - 10:38 AM

This question has been discussed before on the forums.

 

The main consensus is that you don't need to resolve things "as they happen;" you only need to resolve things "as they are observed."

 

The actual simulation is dead simple -- any computer these days can fast-forward a month worth of "simulation" in less than a second. Especially given that most of these games have a "stop point" where they won't produce "more" until they are "harvested," which puts an upper bound on the amount of simulation needed.

 

So, the server just needs to store the current state and the time of that state for the player. Then, when the player says "build a X at time Y" or someone says "show me the state at time Y," the server will load the stored state, fast-forward the simulation to the time Y, and then store that state back as well as return it to the player.

 

And, yes, the state for each player is stored in some database -- it could be as simple as a file-on-disk for each player, or as advanced as a graph database serialized to a relational schema, or something in-between. Most likely a document store like MongoDB or Riak or whatever, or a TEXT column in MySQL.


enum Bool { True, False, FileNotFound };

#3 brunnot   Members   -  Reputation: 102

Like
0Likes
Like

Posted 08 January 2014 - 04:50 PM

Tks hplus0603,

 

In resume, Its just calculate the time it takes to finish a build when the player open the games. That's it ?

 

tks

Brunno



#4 Nypyren   Crossbones+   -  Reputation: 3995

Like
0Likes
Like

Posted 08 January 2014 - 07:52 PM

These type of games usually just keep a real-world timestamp representing the finish time.  The timestamp works regardless of framerate, suspending the app, killing the app, etc.

Nothing happens when the game is not running, but when it starts back up and loads the game, it begins examining the timestamps again and finds out that the current time > the timestamp, so the timer is complete. Or, if the current time STILL isn't > timestamp, then just display the time remaining.

Edited by Nypyren, 08 January 2014 - 08:18 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS