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 / Uneven camera movement speed

Author
Message
Mattman
23
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 26th Jan 2011 06:50
Hi all,

I have created a map, using plains, and there are lots of buildings, made through cubes. I am using CONTROL CAMERA WITH ARROWKEYS, and when I move towards the buildings, I move slow, but when I move away, I move fast. I am assuming this has something to do with drawing polys and performance...but I can't really figure out why because it isn't struggling to keep up with drawing the scene. Any ideas on how I can keep the movement speed steady no matter how many polys are in the scene?

Why make sense when you could make brownies?
SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 26th Jan 2011 07:28
Timer based movement, if that's to daugnting then use sync rate unless your allready using it.
you are allready using sync rate arn't you?
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 26th Jan 2011 08:04
Yeah, you move your camera a constant amount every game loop, and if there are two hundred loops per second, the camera will seem to move slower than if there were 100 loops per second.

If you use "sync rate 60", then the game won't update more than 60 times a second. However, if your game is running at 30 fps, this still won't help you.

The other option is timer based movement. If you have a speed, in units per second, and a speed, in Game Loops Per Second (lets call this GLPS), you take speed/GLPS, to get speed per game loops. That's timer based movement. (you could also multiply by seconds per game loop - same thing).


So, you might want to try
move camera using arrowkeys 1.0/SCREEN FPS(), 1.0/SCREEN FPS()
or you could have something like this:


the timer() function gets what's called system time. The absolute value of this doesn't really mean much. However, it increases 1000 times every second. So by subtracting one timer() call from another timer() call, you get change in time!

Mattman
23
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 26th Jan 2011 18:28 Edited at: 26th Jan 2011 18:29
Thanks guys. I was using sync on, with a sync rate of 30, but my frame rate was running as low as 8fps! Putting on fog didn't help, so I created a check system that hides objects far away from me. Now running at 30fps consistently The slow performance of drawing all the buildings was the real issue. I will probably implement timer based movement anyways.

Why make sense when you could make brownies?

Login to post a reply

Server time is: 2026-07-16 12:19:59
Your offset time is: 2026-07-16 12:19:59