klodolph 7 hours ago

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.

  • aaaronic 6 hours ago

    Most of the older consoles don't have an FPU. Fixed point is king on those older systems.

    • klodolph 5 hours ago

      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.

      • phire 1 hour ago

        The 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.

  • ColdStream 4 hours ago

    I was going to say, even the readme file only mentions N64 and DC.

  • yellowapple 2 hours ago

    Not 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?

  • gsliepen 52 minutes ago

    > Everything being static inline makes it hostile to these older systems which have limited RAM.

    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.

  • embedding-shape 8 minutes ago

    > 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...

chrisjj 31 minutes ago

Perhaps add README.md?

iamcoder18 8 hours ago

It'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 8 hours ago

Sounds interesting, but there isn't any description or readme to go by.

  • bouchard 7 hours ago

    The README is in the header file (picophysics.h)

    • monkpit 6 hours ago

      why not in a readme

      • Retr0id 6 hours ago

        It's common enough to just copy single-file headers into a project. Now the docs come with it.

        • abnercoimbre 4 hours ago

          Yeah I didn’t think twice about clicking the header to read the docs. Standard practice.