Creating the concept of Time

Posted by Jamie Dixon on Game Development See other posts from Game Development or by Jamie Dixon
Published on 2011-02-08T21:00:12Z Indexed on 2011/02/08 23:35 UTC
Read the original article Hit count: 241

Filed under:
|
|
|
|

So I've reached the point in my exploration of gaming where I'd like to impliment the concept of time into my little demo I've been building.

What are some common methodologies for creating the concept of time passing within a game?

My thoughts so far:

My game loop tendes to spend a fair bit of time sitting around waiting or user input so any time system will likely need to be run in a seperate thread.

What I've currently done is create a BackgroundWorker passing in a method that contains a loop triggering every second. This is working fine and I can output information to the console from here etc. Inside this loop I have a DateTime object that is incrimented by 1 minute for every realtime second. (the game begins in the year 01/01/01)

Is this a standard way of acheiving this result or are there more tried and tested methods?

I'm also curious about how to go about performing time based actions (reducing player energy, moving entities around the game board, life/death etc).

Thanks for any pointers or advice. I've searched around however I'm not familiar enough with the terms and so my searches are yeilding little result on this one.

© Game Development or respective owner

Related posts about c#

Related posts about multithreading