by fast_rx » Sep 27, 2003 @ 2:22am
Some other things I just thought about. They may interest you or anyone else reading...
IF you use integers for your iterated values, you'll be thowing out small (less than 1, obviously) parts of your movement... And since it's iterated dozens of times (hopefully) per second, the errors can really add up. I'd suggest either using floats or at least fixed point floats in order to minimize the error.
Another important thing to consider is that we really don't know what devices will be out in a couple of years... so, ensure you code so that really, really fast devices don't cause a problem. In the previous message, I suggest taking the ratio of the delta time to the desired delta. On a super fast machine, that will approach zero. And if you add in the round off errors of int's or even floats for that matter, you may end up with things not moving at all...
A good way to check to see if your code is working is to compile it in debug (runs slow) and then check it with a full optimized build. They should be almost identical in the timing of things happening, right?
And lastly, I mentioned that this works fine for linearly tweaked values (i.e. constant speed for instance). But in my game Lejjo (), I am iterating a mass-spring system. This caused a problem because there was a point where if my iterations were too large, the spring-mass system equations would go crazy. The fix was to check to see if I was below a minimum update rate, and if not, use multiple smaller iteration time slices.
If any of you made it through all that, I congratulate you.