#127733 - howdy_hound - Fri May 04, 2007 10:45 am
HI,
I'm new to this forum, and new to DS developement. i want to make some bike racing game in DS. i want to emphasize more on physics sysm of the game rather than on rendering of the game.
sice there is no floating point calculation in DS i've to go for fixed point calculation. this is worrying me a bit... i'm afraid that i'll get weird results of physics with this fixed point calculation. Is there any way to make the calculation better to get good results??
Thanks.
#127735 - kusma - Fri May 04, 2007 11:05 am
howdy_hound wrote: |
sice there is no floating point calculation in DS i've to go for fixed point calculation. this is worrying me a bit... i'm afraid that i'll get weird results of physics with this fixed point calculation. Is there any way to make the calculation better to get good results?? |
You could use block-floating point, meaning you have normalized fixedpoint directions, and store magnitude as a separate exponential value. It's not easy to implement efficient on the first try, but once you have the needed classes set up etc, it shouldn't be that tricky.
Also keep in mind that you _can_ use floating point. It will be emulated, so there is a speed penalty, but perhaps for something as simple as a single bike it won't end up being a bottle-neck?
#127743 - Lick - Fri May 04, 2007 12:42 pm
With 16.16 you can get fractal steps of 0,0000152587890625. I don't think it's that bad. Even if you have a few imprecise calculations, the low screen resolution will forgive it. You could even go 8.24 if you really need to.
Check out my not-so impressive tweening demo with fixed point calculations. Not that it has multiple results within 1 calculation, but it does show that fixed point allow for decent gaming accuracy. Press left and right.
#127749 - tepples - Fri May 04, 2007 1:43 pm
In this world, God uses fixed point. Quantum mechanics is the result of dithering to compensate for roundoff error.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#127758 - simonjhall - Fri May 04, 2007 4:43 pm
The big thing that I've found a problem when using fix point is multiplies, as the temporaries often exceed your fixed point type. So make sure you do lots of casts to 64-bit ints, too make it coo', foo'.
_________________
Big thanks to everyone who donated for Quake2
#127765 - kusma - Fri May 04, 2007 6:26 pm
But also, above all, make sure you're not optimizing prematurely.
#127986 - howdy_hound - Mon May 07, 2007 6:41 am
Thank you very much for your valuble replies... i'll try implementing them.
Thanks again
Jabez.