Everything 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.
Picophysics: Single file physics for games on platforms like N64, PSX, DC
11–20 of 25 posts
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#12Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#13Everything 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.
Re: floats, I wonder how well it'd perform if compiled with soft-float support?
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#14Earlier quoted context omitted.
Most of the older consoles don't have an FPU. Fixed point is king on those older systems.
Only 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.
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.
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#15Everything 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.
Compilers can un-inline as well. In fact, since every function is defined in the header file, the static inline annotation means very little, it's more of a hint; the functions that were not marked static inline can be inlined just as well by the compiler.
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#16Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#17Everything 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.
I think this sentence just made me realize what made the PSX graphics look so "PSX", I'm guessing all the positions/translations and similar stuff were actually not floating point which they typically are (today at least), hence the classic look of triangles/meshes kind of "jumping"? Huh...
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#18Everything 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.
> Use of float makes it unlikely that you’d run it on the PlayStation, which has no FPU. I think this sentence just made me realize what made the PSX graphics look so "PSX", I'm guessing all the positions/translations and similar stuff were actually not floating point which they typically are (today at least), hence the classic look of triangles/meshes kind of "jumping"? Huh...
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#19Everything 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.
If you don't define `PICOPHYSICS_IMPLEMENTATION` then you just get prototypes and a few struct definitions. From what I could tell the static inline functions are just used as helpers by the non-static functions defined in the implementation TU. It's similar to the stb[1] implementation pattern.
Also, inlining improves code size more often than you might think. There is a lot of ceremony in a function call, and the compiler has to make pessimistic assumptions about what is trashed by the call, causing unnecessary spills and fills. Things like the simple vec3 operations here should pretty much always be made available for inlining; whether the compiler actually decides to inline them is a different story.
Re: Picophysics: Single file physics for games on platforms like N64, PSX, DC
#20Everything 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.
> Use of float makes it unlikely that you’d run it on the PlayStation, which has no FPU. I think this sentence just made me realize what made the PSX graphics look so "PSX", I'm guessing all the positions/translations and similar stuff were actually not floating point which they typically are (today at least), hence the classic look of triangles/meshes kind of "jumping"? Huh...