Timebug or missunderstanding

Discussion and feedback on Construct 2

Post » Sat Mar 26, 2016 8:46 pm

Hi
I have 2 time related problems I noticed, but maybe I understand something wrong.
please can you confirm or ...

1. modula
in attached example time %4
In the debug layout I get very interesting numbers like 5.57695162006553e-02 (you have to pause in debug view). I think only the debug viewer gets it wrong.

2. time
so I made different clocks that count with different results
for this you need a browser/computer that drops frames
Till now I thought that dt is the correct clock, but actually, it is the wallclocktime

capx https://www.dropbox.com/s/ywbtcryivyrd2 ... .capx?dl=0

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Sun Mar 27, 2016 1:54 am

1.
That's not wrong. It's just in scientific notation. The e-02 at the end means move the decimal point left two numbers.

2.
Time and wallClockTime will be more or less the same except.
WallClockTime is always advancing even from one event to the other.
Time on the other hand updates only once per frame.

So if you compare the two at the top of the event sheet they will be about the same.

Now time is incremented by dt every frame, but dt is capped at I think 10fps so if the game ever dips below 10fps time will lag behind wallClockTime.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Sun Mar 27, 2016 6:46 pm

@R0J0hound THX

For question 2 and "about the same" I get following results

60 seconds time = 60 dt time
= 63.8 wallclock = Real World Time
= 59.5 ticks/60
thats 5% difference between real world and everything else (except wallclock)

This was is kind of worst case szenario in Edge on my W10 i3-5010U Laptop
Just a note: doesn't matter if I add 30particle effects with 50objects each

Edit: now I made a test with 232 particles (100 objects each) where I get a 40fps framerate
60 time = 64 wallclock = 43 ticks/60

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon Mar 28, 2016 1:37 am

That's still acceptable in my opinion. There's probably some more details about it in ashley's blog or something. What it comes to is if you need to measure a timeframe that matches the real clock, use wallclocktime.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Thu Mar 31, 2016 11:03 pm

@R0J0hound
I can only disagree, sorry.

https://
drive.google.com/open?id=0B1SSuCVV8v74MkdPWUlLWWNqRnM

Behaviors are dt corrected.
All time triggers are dt corrected.

Wich is awesome.

But.
Time and its expression is also dt corrected. That is the only conclusion i can make, bit i am a nut. Still, look at the capX.

dt is the Time, in seconds, since the last tick. To calculate this, dt is using Time. But because Time is also dt corrected, dt gets smaller and smaller with heavy ticks, and Time and its expression gets slower and slower.

I can (i probaly am) be wrong in the explination.
Yet, i think dt should be calculated with the wall clock. And that is for sure not the case.

Time has to be dt correlated, else we can have no pauzing game. But with a right calculated dt, that should be no problem.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Apr 01, 2016 5:47 pm

Can't look at the capx because it uses plugins I don't have installed. You can look in preview.js for the exact implementation but if you had to do dt and time with the event sheet this is what it would look like:

global number time=0
global number previoustime=0
global number dt=0

every tick
--- set dt to min(0.1, wallclocktime-previoustime)
--- set previoustime to wallclocktime
--- add dt to time
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Fri Apr 01, 2016 8:15 pm

@R0J0hound
Knowing the real dt is helpfull to state the problem. But it does not solve it. You cant inject it in the behavours, you cant alter the time triggers.

But, you can use it to timescale the system, as in this capX. No plugins in that one.
https://
drive.google.com/open?id=0B1SSuCVV8v74dDhld0cwSzhBNlE

Now everything depending on time is correct, including dt and the time expressions. That also answers @fm4fanAT question.

Your math is way better then mine. You probaly know how to optimize this much better. But i think this is the correct workarround if time is very importand in a game with heavy ticks.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Apr 01, 2016 9:52 pm

I don't see any reason for it. If dt wasn't limited objects would teleport quite far if you hit a loop like that.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Sat Apr 02, 2016 2:39 am

Hi, still confused

@99Instances2Go - tried your file and was surprised that a single (empty) loop has such an impact

So with your capx I got following result
10 sec time = 13 to 30 sec wallclock / real world time
result depending on browser and if the computer is busy with something else (so sometimes WAY off)

Now one of my problems with time:
if I make an event like every x second
then actions inside the "every 1 second" runs completely depending on the computer speed (so maybe only 3 times in 10 seconds real world time)


So I can't trust C2 that 1 second is really one second and have to make a big workaround with wallclock?

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Sat Apr 02, 2016 3:20 am

Still it isn't an issue if your game doesn't lag. If it's really bothering you, file a bug report. I'm sure Ashley can give you a much better explanation than me.

time is just the game clock, it's advanced by dt. Dt is affected by the time between frames and timescale. Now when the time between frames gets too big c2 will limit it, which is what you have a problem with. This was done on purpose to slow down instead of letting objects move too far per frame and miss collisions.
Consider an object with a speed of 600.
At 60fps it will move 10 pixels per frame.
At 10fps it would move at 60 pixels per frame.
So if walls were only 32 pixels wide, the object could move right past it.
Limiting dt helps with this.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests