2 Questions NETWEBGET

Previous topic - Next topic

MrTAToad

Should be using GETTIMERALL() as GETTIMER is used for the time between SHOWSCREEN commands.

Wampus

Quote from: Poetronic on 2012-Aug-02
Uhm... wouldn't a fixed dt undermine the very concept of frame independent animation?

Yes, but this is just for testing.

Poetronic

Ok, will do. I thought GETTIMER() was specifically made for dt calculation, since it returns the exact amount of millisec passed since the last SHOWSCREEN. Guess I was wrong :)
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Poetronic

#18
Ok, just to make sure I am doing it right:

Code (glbasic) Select

WHILE TRUE

        oldtime = timer
       
        // Game Loop

        timer = GETTIMERALL()
        dt = timer - oldtime

WEND


Is that correct? For the speed of the movement I have to use something like 8 now to make the letters move. Does that sound alright? :)
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Wampus

Actually its a little bit more complicated than that. GETTIMER() does measure the time since last SHOWSCREEN call. However, what you probably want is the exact (or near exact) time since the last measurement of GETTIMERALL() in your loop. So, something like this:-

Code (glbasic) Select
olddeltatime = timer

timer = GETTIMERALL()

deltatime = timer - olddeltatime


This should give you roughly 16.6666666 on a monitor running at 60 FPS with no interruptions and fixed vsync. If the window has been moved or something has interrupted the app then the value will be much higher.

EDIT: Ah, yes, you corrected it. Mute point.

Poetronic

#20
Same problem...
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Wampus

Ok, sure thing. If you want to upload it I'll have a look.

Poetronic

Hahaha I guess I am a little too tired... same error, still had the dt = 16.6667 in my code... maybe you want to download the whole project and take a look at the weird behavior? I could upload it for you and PM you a link.
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Poetronic

Ok, sent you the link.
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0