[Bug] "Delay" has variable length on 4x speed

Started by GoodMorning, January 30, 2017, 12:34:38 AM

Previous topic - Next topic

GoodMorning

The following code shows two bugs with Delay. One involves variations in delay length, the other in mere incorrect delay length.

2 0 do
6 0 do
3 Delay

GetGameTimeFrames Trace
loop
loop


Bug "A" will result in a mix of even and odd numbers in the trace, with the difference being 5 frames.
Bug "B" will result in the normal increment of the trace being 4 frames.

Omitting the enclosing loop eliminated (seemingly) bug A, but not B.

I'd guess 99% that this is from 4x speed optimisations.
A narrative is a lightly-marked path to another reality.

knucracker

Now even at 1x speed (never leaving 1x) I will get numbers that increment by 4 and then by 5.  The first increment by 5 occurs at 48.
... 40 44 48 53 57 61 65 ...

Not thinking about it a lot, that looks like it might be 2*6*4.  The 2 and 6 coming from the loops and the 4 coming from the delay of 3 plus 1.  Or something like that.
Could be each loop adds 1.  In any case, I don't think I'm seeing a different when running at 1X or 4X.  It looks like an issue with the details of how exactly delay and loops work.

GoodMorning

I think I must have been half asleep when I noticed this. Sorry for the description quality (the lack thereof), but at least you are aware that there is a "feature" here which is undocumented.
A narrative is a lightly-marked path to another reality.