Flocking Simulation with Phoenix Channels

Flocking Simulation with Phoenix Channels

37df158edd0f4ca5fc2fff2e87f43487?s=128

Christian Bäuerlein

April 19, 2018
Tweet

Transcript

  1. Flocking Simulation with Phoenix Channels

  2. Flocking Theory

  3. None
  4. Use case: Cinematic effects

  5. Boid: One member of a flock

  6. * Location

  7. * Location * Perception Radius

  8. * Location * Perception Radius * Velocity * Heading

  9. You Need Three Behaviours

  10. 1. Cohesion

  11. 1. Cohesion

  12. 1. Cohesion

  13. 2. Alignment

  14. 2. Alignment

  15. 2. Alignment

  16. 3. Separation

  17. 3. Separation

  18. 3. Separation ! !

  19. 3. Separation ! !

  20. * Cohesion * Alignment * Separation = Next move

  21. Architecture

  22. Phoenix BoidsChannel Receives Updates Changes Settings GenServer WorldStateUpdater Calling itself

    
 30 times per second Simulation Calculates new positions per boid based on world state <canvas> Renderer Renders updated world state Socket Connection Receives Updates Changes Settings
  23. Demo Time!

  24. Read on! http://harry.me/blog/2011/02/17/neat-algorithms-flocking/ http://www.red3d.com/cwr/boids/