Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Occasional Jumpy/Laggy Movement?

Author
Message
Jeff032
18
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 29th Aug 2010 16:23
I'm having a problem where my player sprite, which usually moves smoothly, will occasionally move in a jumpy/laggy way for a couple of seconds at a time. The value of SCREEN FPS() is still 59-60. It also happens when using objects.

If I just move the player back and forth for a while, it will eventually happen.

This is a simplified version of the code I'm using:


Does anyone know what may be causing this, or have you run into it before?

Thank you.

BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 18:59
It moved pretty smoothly when I ran it. Have you tried deleting the SYNC SLEEP command? I've never used it and I don't know why you would want the program to give up a millisecond every loop.


Latest progress: Fog of War implemented; frustrated by pathfinding >.>
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Aug 2010 19:20 Edited at: 29th Aug 2010 19:24
I would avoid setting sync to a speed and use plain old set display mode x,y,32,1. That syncs to you monitor, which for me is 60fps. I get better performance this way, using sync 60 actually slows the system a little. If you change it to ,0 you will get no sync and it will run at warp speed
Oh and I have seen what you are talking about before myself, on many systems, used to be an issue with amos. Seen it in db as well, just not recently.

http://s6.bitefight.org/c.php?uid=103081
Jeff032
18
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 29th Aug 2010 20:16
Quote: "It moved pretty smoothly when I ran it. Have you tried deleting the SYNC SLEEP command? I've never used it and I don't know why you would want the program to give up a millisecond every loop."


Yes, I had tried removing that and it didn't change anything. I was just using it so that my game didn't take up 50% of the CPU when running. I might remove it later, dunno.


Quote: "I would avoid setting sync to a speed and use plain old set display mode x,y,32,1"


That seems to have fixed it, or at least helped a great deal. Now it only has the occasional one frame hiccup.

Thank you for the help

DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Aug 2010 20:39 Edited at: 29th Aug 2010 20:40
Good stuff! Before I found that flag I was always annoyed at DB's performance regarding sync rate. Never been an issue since Apart from on those pesky netbooks, they are soo slow lol.

http://s6.bitefight.org/c.php?uid=103081
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 29th Aug 2010 22:30
You should also be using Timer Based Movement so it will run at the same speed on all machines. Then you can set it to run at warp speed if you want and not worry about it.

BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 22:47
Except for maybe a Starcraft-esque graphics card meltdown


Latest progress: Fog of War implemented; frustrated by pathfinding >.>
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 30th Aug 2010 19:49
True. Allowing the card to process 3,000 FPS over an extended period of time is likely going to generate extra heat.

I really need to finish that tutorial on decoupling the game loop from the display loop, and allowing the processor some time to breathe...

RedFlames
18
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 31st Aug 2010 19:58
Quote: "I really need to finish that tutorial on decoupling the game loop from the display loop, and allowing the processor some time to breathe..."

I think you mentioned this elsewhere as well already, and am curious about your way of achieving this.

I'm looking forward to that tutorial

Login to post a reply

Server time is: 2026-07-23 12:10:40
Your offset time is: 2026-07-23 12:10:40