So I've reached the point in my exploration of gaming where I'd like to implement 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 tends to spend a fair amount of time sitting around waiting for user input so any time system will likely need to be run in a separate 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 incremented by 1 minute for every realtime second. (the game begins in the year 01/01/01)
Is this a standard way of achieving 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 yielding little result on this one.