I have some experience writing physics engines (Chipmunk2D), and want to try and see how far I can go with that on the NES. So far I've gotten circle-circle and circle-line collisions working with reasonable performance, and am working on reducing it further with some small lookup tables. My end goal is a game with a two wheeled vehicle. So far I've been using 8.8 fixed point because it's easy to prototype with from C, but I'm hoping to get at least 2 screen scrolling. So I was thinking about my options for using fixed point.
If I wanted to stick with 16 bit types I could do something like 9.7 or 12.4 depending on how much accuracy feels right in the fractional bits for acceleration and such. All the extra shifting gets messy real fast in C, and I can only imagine moreso in assembly. Having a lot of multi-byte shifts seems like it might really bloat and slow the code too.
16.8 is sort of appealing for the final assembly version. If I wanted to access the values from C I'd need to split the integer and fractional parts into a struct. I've already kind of ruled out padding it out to 32 bits. Even with a lot of casting and type annotations for 16/8 bit ops, I wasn't able to get cc65 to generate reasonable code using 32 bit ints.
What have other people had good success with? Is 16.8 the way to go, or is something like 9.7 less troublesome than I think it is?
If I wanted to stick with 16 bit types I could do something like 9.7 or 12.4 depending on how much accuracy feels right in the fractional bits for acceleration and such. All the extra shifting gets messy real fast in C, and I can only imagine moreso in assembly. Having a lot of multi-byte shifts seems like it might really bloat and slow the code too.
16.8 is sort of appealing for the final assembly version. If I wanted to access the values from C I'd need to split the integer and fractional parts into a struct. I've already kind of ruled out padding it out to 32 bits. Even with a lot of casting and type annotations for 16/8 bit ops, I wasn't able to get cc65 to generate reasonable code using 32 bit ints.
What have other people had good success with? Is 16.8 the way to go, or is something like 9.7 less troublesome than I think it is?