Explore the RxJs API by managing moving particle systems. The systems should:
- Use self-aware AI, not a global AI
- Move in organic, natural arcs, with no sudden pivots or swerves
- Support large swarms of particles
- Be able to evade obstacles
- Simulate cohesive flocking behavior
The trickiest portion of this iteration (and perhaps the whole project) was animating the curved paths:
The current design uses circular paths that allow smooth changes in both direction and rotation.
This method can handle quite a few particles.
The next goal was to explore a grid-based vision system. Each particle owns a vision grid, which is compared against the global grid to detect collisions. Here's a small scale system, with the vision grid visualized:
Here's a large scale system.
Using the vision grid and the circular geometry, particles determine and follow a leader. At the start of the animation, there are no leaders. When particles see each other, one of them is chosen as a leader. The others follow. If other particles see a leader, they follow it.
Each particle recalls its previous location, and compares it to their current location to see if they're moving towards the leader or not. Each frame iterates the particle closer to its leader. The leader(s) continue moving freely.
On a larger scale, the particles are starting to take on a personality.
The exploration is now complete: arc-based movement, independent AIs, grid-based vision, hazards, and cohesive flocking behavior, on a large scale: