Codesnippets > Math

Constant Game Speed independent of Variable FPS

<< < (3/5) > >>

r0ber7:
I've started implementing this in my game. In preparation for multiplayer, I'm using this to make sure all clients run at the same game speed. From what I've noticed so far, game quality remains the same (thanks to the interpolation) and I suspect the processor load is greatly reduced. The actual rewriting of code wasn't that big of a deal cause I already had most of my drawing commands in one place. Now it's a case of fishing out the last rogue drawing commands, doing some standardizing, and I'm set. :)

All in all, this is something I will definitely recommend.  :good: I will also start off all my future games from this framework.

bigsofty:
I'm glad its of use to you.  :)

I too am using it on Android and Windows currently. Tt scales well on multi-platforms/devices BTW. I have not used it across a network though, I will be interested to hear how it works out for yourself.

r0ber7:
Hey bigsofty, you have any tips on how to handle camera movement interpolation?

My camera is a little bit jittery. I'm interpolating between x, and x0, using xn as the interpolated value. Then I draw the tiles like, tile.x - xn. I know this isn't the best of a description, but if you've got any tips, I'd like to know. :) It jitters sometimes, and sometimes not. It may be something else that's causing it though... (That's the problem with big rewrites, bugs can hide in so many places. :P)

Hemlos:
camera, 3d?

jitters can happen when you try to render things that are outside the opengl world boundaries.

i can offer several solutions to this, but i need to know the layout of your world first.

is it wide like a dukenumem with gravity and such?
or is it huge 3d outer space style, is it infinite sized?
or is it just a side scroller in 3d?

each of these layouts can be setup easily to be infitely large without any glitching due to cam position.
basically, you put the cam at 0, and move everything else...and end rending of objects that are far away from the cam.

bigsofty:

--- Quote from: r0ber7 on 2012-Dec-03 ---Hey bigsofty, you have any tips on how to handle camera movement interpolation?

My camera is a little bit jittery. I'm interpolating between x, and x0, using xn as the interpolated value. Then I draw the tiles like, tile.x - xn. I know this isn't the best of a description, but if you've got any tips, I'd like to know. :) It jitters sometimes, and sometimes not. It may be something else that's causing it though... (That's the problem with big rewrites, bugs can hide in so many places. :P)

--- End quote ---

How does your camera operate? Is it a virtual camera, everything moves left using an offset variable when the camera pans right for example? Or is it using another method?

An easy fix sometimes is to check for a rogue int to float or float to int type conversion as this would mess up the interpolated values. Also try putting your verticle sync back on, in you project options and your gfx cards control panel and see if that makes it better of worse.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version