For a while I've been wanting to know what happens underneath the hood of a game engine. I've also wanted to learn rust, make a program in WASM, and I had some concept art for a simple racing game. These things all came together to make swoop.
You can play it in fullscreen or you can play it embedded by the iframe below and using the enter/arrow keys:
Looking at the date on my tablet, that concept art was done in 2017. Back in 2017 I didn't know about rust, and I planned to do it in javascrtipt. I got as far as making a few sprites and that was it.
Then in 2020 I discovered shadertoy, and discovered that you could store
state across passes of an image and you could get keyboard input.
This meant you could ... make games! So I made it and called it "space
racer". You can play that version here:
But there were some limitations to do with how much data can be stored (otherwise you have performance issues), and working in GLSL is, while very "pure" and mathematical, can be hard to debug. So I made a version in rust
Building this was a fun experience. I learned a lot about why game engines are the way they are, and discovered that programming in webGL is actually easier than I feared (still, not that easy). One thing that surprised me was that when I showed it to another game developer (in an early stage of development) he went "wow, that's really polished already". I think what caused this is that everything is mathematically perfect rather than human perfect. The trail fadeout is smooth not because someone hand-painted a smooth line, but because it's a function of a linear decline. Similarly, the acceleration feels good and consistent because it obeys proper conservation of inertia.
There are some cool technical things in this game, such as the map being a polar-fourier-series and I'm really happy with the splines used for the trails and how the AI tries to predict it's future path. If you want to read about the process of making it, I wrote it up as I was going. And to my surprise, it featured in the Rust Gamedev Newsletter issue #17