Ricercar (Gravity Platformer)
Ricercar (which is an Italian term for a kind of musical composition, meaning “to search out”) was an experiment in gravity and particles. I wanted to learn about making a 2D character controller, and also experiment with compute shaders. This was the result.
There are a few cool things about Ricercar: the first is that any sprite can be converted into “gravity map” which is sort of like a baked lightmap but for precomputed gravity calculations. The second is a hand-implemented particle system which makes use of this map to spawn massive numbers of sprites, to create effects like smoke or fire. Finally, there’s a fun character controller with a little gun, wheeeee!
Check it out on GitHub here.
Convert any sprite into a "gravity map" which encodes a 2D vector towards the "mass" of the sprite. This allows for weird gravitational surfaces which would be too expensive to compute at runtime.
Maps can easily be sampled, both on the CPU and GPU side. The gravity is even extrapolated outside the edge of the map.
You can create some pretty cool visuals with this. In this gif there are up to 200,000 particles with no lag. All the gravity sources and particle sources can be modified and moved around live, it's very fun.
Also very fun to just jump around in.
This project ended up spawning two others which are also here on my GitHub - an SDF based line drawing tool (LineDrawer) and a tool for sorting large arrays on the GPU. (BufferSorter)
The particles can either collide and disappear or bounce with rudimentary physics.