10 Replies - 345 Views - Last Post: 22 June 2013 - 12:43 AM Rate Topic: -----

#1 Nekroze  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 170
  • Joined: 08-May 11

How do game servers manage ticking events?

Posted 21 June 2013 - 01:06 PM

I am asking a high level question here nothing code specific just looking for a feel on how to do this for my own learning as I can't get it out of my mind.

I have been thinking on maybe making an multiplayer tech demo thing for myself and I can clearly see how input driven things like player movement or clicking something may work as it is just action and reaction. However, I am having problems figuring out how to efficiently do things that need to be updated on their own very often.

For example minecraft has a tick mechanism that seems to determine how often to check if crops should grow and when to move water or even how long it takes to smelt something in a furnace. Forgive the typical minecraft reference.

In a large scale game how does the server know when things should be updated without having to run through each area to check for ticking entity things every second and update them if needed then send the data to the clients. If that where so then would it not cause the entire server to dedicate a large amount of resources just to updating these things every second. Assuming an Asynchronous server this would not necessarily cause the players to become unresponsive but mean that it could take longer to perform all the updates before the next tick.

For me this is slightly perplexing, just how to do physics in say a dropping sand block in minecraft (you would think I could come up with better examples huh).

My question is how would a typical game handle things like this? Do they just do a regular global update loop kind of thing and just try and make it fast enough to hopefully not be noticeable?

I am just trying to get a feel for how this kind of thing is done or some inventive solutions to it.

Thanks a heap for listening and hopefully answering everyone.

This post has been edited by Nekroze: 21 June 2013 - 01:16 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How do game servers manage ticking events?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9048
  • View blog
  • Posts: 33,971
  • Joined: 12-June 08

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 01:47 PM

There's many ways of doing clock synchronization.. I would figure you would want objects to update themselves. When the engine flops over it would feed the current game time to all the objects and the let the objects deal with their own updates and changes. Propigate the current time and let the bits deal the work.


Here's some reading:
Koku: State Synchronisation System for NetworkedMultiplayer Games

A Stream-based Time Synchronization Technique For Networked Computer Games
Was This Post Helpful? 1
  • +
  • -

#3 Nekroze  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 170
  • Joined: 08-May 11

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 01:56 PM

Yeah i thought that obviously the high level server wouldn't do any actual details of the updates.

I suppose if you just pass on the time you can record when the last time update was and just calculate what it should be doing now after that long.

But what would be a good way of getting it only to the areas that need updating. Would the server maintain a list of all known tick-able entities that are currently active/loaded and feed it to that list in a loop. Or perhaps just send the new time to each game area that is loaded and then the game area looks into its stored objects etc and propagate the new time like that as more of a tree rather then a list.

I guess the tree solution would allow for pauses between each branching for the client updates and stuff but that wouldn't really be needed if the server had a list of all loaded ticking entities anyways and just pause after each to let other work continue.

Would the time update do something to make sure that it doesn't start a new time update while one is already in progress or should it just begin a new update if a new time comes in and drop the old one. I can see the dropping method being a problem under load where something down the end of the list or tree may get neglected entirely because updates have to be fast enough that for more rapid things.

To make further wild guesses. I guess the system could sort a list of tick-able entities by ones that need to be updated most often and if it doesn't always get to the end of the list that's ok because those things aren't checked as often... Interesting thoughts... Well maybe not for anyone who knows what they are doing but for me at least.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9048
  • View blog
  • Posts: 33,971
  • Joined: 12-June 08

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 02:38 PM

Okay I am getting a bit lost with not quite getting where a question is versus just some statement.

butchdean and probably help with more specific examples and insight, but remember the game server is not rendering squat.. so going throug a whole mess of objects is not a problem.. an well as finding objects 'near-ish' a player so you can render/update those and not the rest of the just existing blocks.
Was This Post Helpful? 0
  • +
  • -

#5 Nekroze  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 170
  • Joined: 08-May 11

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 03:02 PM

Yeah I understand that the server does no rendering and so has some headroom to do things like this. The statement thing of how I was guessing it could be done was me putting out how I might attempt it myself and trying to see if you or anyone else thought that was a bad idea for some reason I do not yet understand.

I do plan of having a way of unloading an entire area from the server but some "entities" in that area may still need to be "ticking" along with the server. So if I wanted a player to be able to constructed say a power generator but wanted the generator to still check if its over heating or something even if no one is around.

I have just been concerned about how a server can keep up to date with a massive amount of these ticking entities without either grinding the server.

It seems, from what I understand, that you are saying that it isn't as big a problem in real world servers as I am thinking it is.

So doing something like I suggested before with a list of active entities that require time updates is not just a stupid idea that has some other solution that is often used that I haven't thought about?

See I thought that something like firing bullets in an shooter game server, with enough bullets at once, could be a large drain on the server if it needs to check where each bullet is over its say 1-2 second long lifespan for long range weapons and calculate its bullet drop and collisions with players to validate a hit and update all clients. Then add onto that other physics things that the server might need to keep track of like movements in a space shooting game to get the zero-g drift for example.

That kind of thing I have been thinking is a problem as I am finding it hard to believe that a server can just run though each entity a few times a second or something. Is it feasible to do something like that.

I really, really do apologize for being very bad at wording things and appreciate the help a lot. I am just trying to grasp this to figure out how I might do something like this.

EDIT: I understand that a lot of physics things are purely graphical and done on the client.

If I am too painful I will desist.

This post has been edited by Nekroze: 21 June 2013 - 03:03 PM

Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9048
  • View blog
  • Posts: 33,971
  • Joined: 12-June 08

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 03:31 PM

Okay - how does a regular game engine, no multiplayer, deal with updating objects in a game? Take that, minus the visuals, and plunk that into a sever.

So you have objects that tick along.... fair enough. Some games - kingdom of loathing - just deal with last activity versus current activity and updates objects as it happens.. others, like minecraft, certainly just keep an eye on them... though not every object ticks on for ever, right? I mean eventually you do get done smelting, or growing tops out, etc.

As I said - if you leave a minecraft game running, on your local machine, for a day does it grind to a halt? Nope.. manipulating objects is soooooo much faster than taking time to get the graphics right. Then you get into some odd stratosphere of games like Eve Online.. a whole nother ball of wax and complexity.


Quote

So doing something like I suggested before with a list of active entities that require time updates is not just a stupid idea that has some other solution that is often used that I haven't thought about?

On low level, small games, no.. that's not a bad way to look at things.


Quote

See I thought that something like firing bullets in an shooter game server, with enough bullets at once, could be a large drain on the server if it needs to check where each bullet is over its say 1-2 second long lifespan for long range weapons and calculate its bullet drop and collisions with players to validate a hit and update all clients.

yeah, but if the bullet is tasked with knowing it's location, mechanics, and life time why does the server care?

I think you are blending some sort of misconception of a game engine, some sort of over arching manager of every single detail, and the actual hardware.

The game engine flops and the update calls decimates the current time.. the objects update, etc. The game engine then passes the graphics object and the objects draw themselves.. the engine shouldn't be too hands on, right?


http://onedayitwillm...-using-node-js/

http://www.gamasutra...hiding_for_.php
Was This Post Helpful? 1
  • +
  • -

#7 Nekroze  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 170
  • Joined: 08-May 11

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 04:07 PM

I think I get what you mean. Although I would be doing something rather simple at the moment for the sake of learning I did want to know how it would happen on large scale games like eve so thank you for addressing that.

I always thought that bullets would have to be simulated on a server so that it doesn't have to rely on clients to tell it that there was a hit rather then a lie from a hack.

I get that most games don't need a simulation of the world the client plays in, it just relays the data. But things like minecraft must have some knowledge of if an arrow with its bullet drop over time is actually hitting an enemy. I can see how the server might say that a block of sand was starting to fall and then move it to its destination after a particular time and then just tell the clients to do whatever they need to graphically move the block to its new destination.

But in order to avoid trust issues there has to be some representation of game world things on some level to know that things are really able to happen, if that makes sense. Like battlefield servers need to know where say 2 players are and one snipes another. Doesn't the server at the very least check if the bullet speed and drop will or will not hit the target. At the most checking if it collided with a wall. Where is the line drawn with the trust. You can just have the client calculate if the bullet would hit and if so then send the hit message to the server. What about slower projectiles like rockets that could have their hit or miss change wildly between when it was shot and when it hits.

I have just always assumed that the server has some knowledge of the world for validation, especially for competitive online games.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9048
  • View blog
  • Posts: 33,971
  • Joined: 12-June 08

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 05:54 PM

When I say the objects I mean the objects on the server.. yeah.. a client can have some predictive movement and what not, but ultimately the server's rule is law.

Again - mixing issues.. the client vs the server.. and where the 'end of the day' stats are.
Was This Post Helpful? 1
  • +
  • -

#9 Nekroze  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 170
  • Joined: 08-May 11

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 06:28 PM

I am starting to get this. I have never done multiplayer so its hard to see where the server should end and the client should start.

So the server for say a shooter would have some representation of the game world at its simplest (no need for a full 3d simulation) and the clients can make a best guess but be overridden when the server comes to a decision on an action? And many many concurrent or asynchronous events that are time based are ok to do because the server has nothing intensive like a full 3d simulation?
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9048
  • View blog
  • Posts: 33,971
  • Joined: 12-June 08

Re: How do game servers manage ticking events?

Posted 21 June 2013 - 06:39 PM

First off - there's no tried or set method, right? Each game has a different metric of data that it would use to keep things in-sync.

the gist is the player moves an object, that data is sent to the server, and the server sends that update out to everyone.. every so often an object may be out of alignment with everyone so the server corrects this sort of drift and keeps everyone on board.

Outside of the links above regarding dead reckoning, etc, here are some more reading:

http://gafferongames...ame-networking/
http://gafferongames...me-programmers/
Was This Post Helpful? 1
  • +
  • -

#11 Nekroze  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 170
  • Joined: 08-May 11

Re: How do game servers manage ticking events?

Posted 22 June 2013 - 12:43 AM

Thanks a heap now I think I am actually getting my head around this now.

Cheers for sticking with me through my horrible and verbose phrasing, much appreciated. I think this is my most succinct post ever.

This post has been edited by Nekroze: 22 June 2013 - 12:52 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1