←back to thread

261 points david927 | 1 comments | | HN request time: 0.336s | source

What are you working on? Any new ideas that you're thinking about?
1. tauoverpi ◴[] No.43161587[source]
As part of my spare time hobby, implementing small packages for building games that don't allocate memory post startup (or work when the memory map can be declared statically such as with wasm-4-like targets or an rp2040) and can run in resource constrained environments along with performing well on a steamdeck.

Most of it involves taking advantage of data structure properties (and limits) by using zig comptime to derive functions that either compute offsets relative to existing pointers or use pre-computed offset tables, when relative isn't possible, to reduce function size further without inhibiting the ability to take full advantage of SIMD.

One of the next task for this is statically computing update graphs for archetypes such that a multi-thread runtime can mix strategies (last thread (detected by an atomic counter on nodes that require all dependencies to be complete) to reach a node broadcasts new work it unblocks, starved threads steal work from others, etc) to speed up the world update loop when running on larger targets while also remaining lock-free.

It's fun to explore how far one can go with statically declaring all limits upfront and managing even larger targets (steamdeck, servers) as if they were embedded applications.