Introducing `seizer` -- a library for developing cross-platform games

ntroducing seizer , a library to acquire a rendering context on any platform, so long as the platform is a browser or Linux! I’ve been refining this library for a while, but just today took the time to split it out from the other projects I used it in.

Something I just recently figured out was loading assets in a browser context, where Zig’s async was invaluable. Browser’s don’t like it when you block the main thread, so things like fetch return a Promise. This means that programs that use can’t be converted to run in a browser unless you introduce hacks, like a list of files to preload.

seizer handles this by making the init function async. When a game fetches a file in the browser, seizer will tell JavaScript to fetch the file and pass it the pointer to the current frame. Then, when the browser has finished fetching the file, the JavaScript will call wasm_finalize_fetch , which will resume the frame. This means that you don’t need to create manifest file or anything like that – just make sure the file is in your server’s public folder (or its equivalent folder), and everything will be loaded properly. :grinning_face_with_smiling_eyes:

If you want to see an example of seizer in use, you can check my 7 day roguelike project:


I had just yesterday an idea for a blog post that would benefit from an inteactive example and I was precisely thinking of having both a wasm and a downloadable version. Nice!

1 Like