The problem that I am having is that the ball and paddles are some times slightly "jumpy", not smooth.
You can exit the game and it might run smooth again, exit and it might be jumpy again.
I ran the game on several computers(3.5Ghz, quad) and a laptop(1.5Ghz) which have Windows 7/Windows XP, but they all do
the same thing, sometimes smooth, sometimes jumpy.
You can see what I'm talking about by downloading my game in the GLBasic Beta Test forum:
GLBasic Test Forum "JustPong" (http://www.glbasic.com/forum/index.php?topic=5099.0)
Thank you, Mike
Do you do all movement independant of computer speed ?
Hi MrTAToad
"QUOTE: Do you do all movement independant of computer speed ?"
I don't know what exactly you mean. :S
I am not using GETTIMER() or GETTIMERALL() if that tells you anything.
I can send you the code.
I un-installed spybot, a spyware program. I thought that might be causing th problem,
but that didn't help.
I just tested again on 4 of our computers and it seems like the slowest
computer(laptop 1.5Ghz DUO) runs the smoothest, very little jerkiness.
While my fastest computer(3.5Ghz QUAD) is the worst, not smooth most of the time.
Mike
In the IDE, try setting "Projects...Options...Maximum Frame Rate [Hz] to, say, 30 or 120 and try that. Is that equally smooth/lumpy on all machines with both settings?
Does the game play smoother but slower on your slowest computer? (i.e. is the speed of the bat and ball relative to the speed of the computer)?
It would be best to use LIMITFPS -1 really
Paddle movement was smooth, but the ball movement did seem to be slightly choppy - which was consistent across multiple runs.
Are you using floats and not integers for moving it around ?
If you are willing to send the code, that would be useful.
Cliff3D: my default FPS is 60. I tried 30 and 120, but still is jumpy. Yes, at 30 it is slower but jumps"longer jumps"
MrTAToad: It looks like I'm mostly using floats. I sent you the code.
Thanks
Right, that suggests to me that at all times your pong program is going "at full speed" i.e. as fast as the PC possibly can. Given 2 pc's of identical setup, one slow and and fast but running the same OS, same drivers, same patches and so on they should be queslly smooth and/or jumpy - just play at different speeds :(
Using integers (% suffic on declaration) is generally faster and so should speed things up. Setting your program to work on a timed basis so that it runs at the same speed regardless of PC should enable you to smooth things out by having it not running "at full speed" all the time - even when the PC is busy trying to do something else. Give Windows some time to do its background tasks.
Got the code - thanks. I'll have a see if there are any improvements that can be made.
The only thing I've added is the extended type for calculating movement
speed independant of computer time - the idea being that all movement
should take the same size no matter what the machine is.
It should be used for all movement, but for expediency I just put it in the ball movement
Thanks to "MrTAToad", the jumpiness is gone!
He updated my code to use the "AppTiming system"
Also thank you for all the other replies.
Interesting. It's possible to see an practical example?
Quote from: MrTAToad on 2010-Sep-24
The only thing I've added is the extended type for calculating movement
speed independant of computer time - the idea being that all movement
should take the same size no matter what the machine is.
It should be used for all movement, but for expediency I just put it in the ball movement
It sounds like quite a lot of work to have to do this for all movement! I guess its important though, even if you can be sure of, in theory, having more than enough CPU/GPU to maintain at least 60 fps. I just haven't started doing things this way yet.
Was there ever a thread created about this technique?
Here is the link to the code"AppTimer" from "MrTAToad".
http://www.glbasic.com/forum/index.php?topic=3384 (http://www.glbasic.com/forum/index.php?topic=3384)
Here is another link with different and a lot less code. I don't know which is better.
http://www.glbasic.com/forum/index.php?topic=3366 (http://www.glbasic.com/forum/index.php?topic=3366)