Help with timers in Game!

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
creativescripter
Posts: 3
Joined: 21 Jan 2016 13:06

Help with timers in Game!

#1 Post by creativescripter » 12 Apr 2016 13:03

I am creating a real-time (more or less 24 hours=24 min) simulation game, much like an old school Tomagachi. This simulation is hugely dependent on elapsed time, as you will have to "feed" your pet every few hours or he will starve.
I understand many of the basic "timer" or "countdown" techniques available, however the difficulty is they all either pause the game, forbidding the user to interact in other ways (sleep) or they get the start/end times and if elapsed time is such and such, execute x. The second seems the best for this situation, however I can only trigger the "endtime" at the beginning of a loop. Which means that technically, the time is only ended and checked whenever a user enters that loop, which could be shorter or longer than "real-time" would allow.

Imagine the user is able to remain on a single menu. The background timer would still be counting, and if say, 10 minutes goes by, a message would be echoed and variables would change automatically (without the user doing anything).

Is this possible? Suggestions?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Help with timers in Game!

#2 Post by ShadowThief » 12 Apr 2016 19:07

Since it's a menu, you can use the choice command, which includes a timer that goes to a default value after a certain number of seconds.

einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Help with timers in Game!

#3 Post by einstein1969 » 14 Apr 2016 04:42

I think that you must use "asyncrounus input" and batch multithreading.

You can search Dbenham or Aacini threads for example on this.

Einstein1969

Post Reply