noc-book-2 icon indicating copy to clipboard operation
noc-book-2 copied to clipboard

Particle Automata section

Open sidwellr opened this issue 1 year ago • 0 comments

You already have so much to do you probably don't want to add more topics! But Particle CAs mesh so well with the rest of the book topics I thought I should at least suggest it. It's a great solution when you need a particle system that detects collisions but don't want to use a physics library. The technique has been around for years, but it has become popular in the last couple of years with games like Sandspiel and Noita.

Although you could dedicate an entire chapter to Particle CAs, I think all the book really needs is a section in the Cellular Automata chapter to introduce the topic. The section should just explain the basic concept and code a simple falling sand simulation, where each sand particle moves down if it can (i.e., the cell below it contains air); if not it moves diagonally down/left or down/right if one of those cells contains air. Add an exercise to change the sand to water, which behaves the same except that water flows out more than sand so it tries to move straight left or right if it can't move down. Maybe a second exercise to implement both sand and water together (sand sinks in water).

There is a lot more to Particle Automata, but this would at least let readers know they exist and what they do so they can seek out more detailed information if they are interested.

sidwellr avatar Oct 30 '22 01:10 sidwellr