3 ms·
Picophysics: Single file physics for games on platforms like N64, PSX, DC
- iamcoder18 2mo agoIt's hand written and should also work on microcontrollers like ESP32s or Pi Pico 2. Have you tried anything like that yet? The Pico in particular has enough RAM and supports floating point math.
- Attummm 2mo agoSounds interesting, but there isn't any description or readme to go by.
- bouchard 2mo agoThe README is in the header file (picophysics.h)
- monkpit 2mo agowhy not in a readme
- Retr0id 2mo agoIt's common enough to just copy single-file headers into a project. Now the docs come with it.
- abnercoimbre 2mo agoYeah I didn’t think twice about clicking the header to read the docs. Standard practice.
- klodolph 2mo agoEverything being static inline makes it hostile to these older systems which have limited RAM. Use of float makes it unlikely that you’d run it on the PlayStation, which has no FPU.
- aaaronic 2mo agoMost of the older consoles don't have an FPU. Fixed point is king on those older systems.
- klodolph 2mo agoOnly one of the consoles listed lacks an FPU, the other two (N64 and DreamCast) both have FPUs. Despite its age, the FPU on the N64 was plenty fast and it was used extensively.
- phire 2mo agoThe N64's FPU will usually be faster than doing fixed point on the CPU. You are actually multiplier/divider bound, and the CPU can multiply about 10 bits per cycle and only divide 1 bit per cycle. Since you aren't multiplying the sign/exponent bits, it's faster to multiply/divide the 24 mantissa bits of a 32-bit float than it is to multiply/divide the 32 bits of an int. And with fixed point, you then have to throw in the extra shift instruction (which floating point automatically does internally). Though, this only applies to fixed point on the CPU. The RSP has no FPU, but it does have a 128 bit vector unit with 8 16bit lanes which is pretty good at fixed point stuff. If you can vectorise your algorithm, it will be faster on the RSP.
- inigyou 2mo agoAccording to Kaze Emanuar, the N64 is actually memory bandwidth bound in almost everything it does.
- ColdStream 2mo agoI was going to say, even the readme file only mentions N64 and DC.
- yellowapple 2mo agoNot just limited RAM, but limited RAM bandwidth, which seems like it would make this particularly painful on the N64 (ironic, given that the in-file README says that this came about specifically to support porting a game to the N64). That said, should be possible to wrap these with some non-inlined functions in a pinch, yeah? Re: floats, I wonder how well it'd perform if compiled with soft-float support?
- songhonglei1985 2mo agosingle-file physics for old consoles is such a neat constraint to build under. reminds me of the n64 homebrew stuff i was looking at - wonder if this actually runs on real hardware or just emulators, the psx/n64 have such tight memory limits. anyone benchmarked it on a real dev kit?
- chrisjj 2mo agoPerhaps add README.md?