Avoid timers from running longer than expected

Get help using Construct 2

Post » Tue Dec 03, 2013 10:14 pm

Hi, im doing a timed game, the player always have 1 min of play time on each level, i used the DT variable to advance the timer because i read that with that the game isnt frame dependant.
Now im doing beta testing with some friends and i found that on the pc of a friend (a really slow laptop) the timer isnt running at normal speed, she can play for like 3 mins maybe even more and as the game isnt time dependant per se, it just clicking the right combination of elements, she can get crazy highscores that are immposible at normal speed.
Any ideas on how to avoid this?

Thanks!
B
15
S
1
G
1
Posts: 15
Reputation: 1,051

Post » Tue Dec 03, 2013 10:27 pm

Dt should work, maybe you are not using it correctly.
You can also use the time expression (on start of level: set yourtime = time). And stop condition would be (time - yourtime greater or equal 60: do stuff)
Timer behavior will also work.mindfaQ2013-12-03 22:28:15
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Tue Dec 03, 2013 10:51 pm

time expression is clocked in seconds from the start of the game.

OnStart of game
var time_start;
var time_end = time + 60;

durring game play
if(time_end < time) do end game stuff

Please don't use dt as part of anykind of timing measure. dt is used for animation to keep animation to time step the same. As an example
move 100px per second.
object.x + 100 * dt; this will break up the 100 to that of only a fraction of the 60fp1second. However dt shuoldn't be used a timer keeper as dt is not really a timer.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Wed Dec 04, 2013 8:41 pm

Thanks guys, works great now!
That was the issue, i was using dt instead of time.
The thing is, there is a couple of tutorials that guide people to use dt as a way of doing timers :(
Anyway, thanks for the tip!
B
15
S
1
G
1
Posts: 15
Reputation: 1,051

Post » Mon Mar 10, 2014 3:36 pm

jayderyu wrote:time expression is clocked in seconds from the start of the game.

OnStart of game
var time_start;
var time_end = time + 60;

durring game play
if(time_end < time) do end game stuff

Please don't use dt as part of anykind of timing measure. dt is used for animation to keep animation to time step the same. As an example
move 100px per second.
object.x + 100 * dt; this will break up the 100 to that of only a fraction of the 60fp1second. However dt shuoldn't be used a timer keeper as dt is not really a timer.


when you increase a variable each tick by dt, it'll be incremented of 1 each seconds, this is what defines dt, so it works, I agree however that the time expression is better in that case
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests