BASIC

Author Topic: 2 Questions NETWEBGET  (Read 2997 times)

MrTAToad

  • Guest
Re: 2 Questions NETWEBGET
« Reply #15 on: 2012-Aug-02 »
Should be using GETTIMERALL() as GETTIMER is used for the time between SHOWSCREEN commands.

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #16 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.

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #17 on: 2012-Aug-02 »
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

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #18 on: 2012-Aug-02 »
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? :)
« Last Edit: 2012-Aug-03 by Poetronic »
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #19 on: 2012-Aug-02 »
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.

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #20 on: 2012-Aug-02 »
Same problem...
« Last Edit: 2012-Aug-02 by Poetronic »
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #21 on: 2012-Aug-02 »
Ok, sure thing. If you want to upload it I'll have a look.

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #22 on: 2012-Aug-02 »
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

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: 2 Questions NETWEBGET
« Reply #23 on: 2012-Aug-02 »
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