Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Flocking Simulation with Phoenix Channels
Christian Bäuerlein
April 19, 2018
Programming
1
54
Flocking Simulation with Phoenix Channels
Code can be found here:
https://github.com/fabrik42/flocking_elixir
Christian Bäuerlein
April 19, 2018
Tweet
Share
More Decks by Christian Bäuerlein
See All by Christian Bäuerlein
fabrik42
1
41
fabrik42
0
57
fabrik42
0
19
fabrik42
0
120
fabrik42
0
41
fabrik42
0
140
fabrik42
0
110
fabrik42
0
91
fabrik42
0
110
Other Decks in Programming
See All in Programming
itosho525
0
360
viteinfinite
0
200
saki4869
0
190
daiki1020
0
1.1k
nbkouhou
0
870
ippey
0
170
muttsu_623
0
480
77web
0
210
malvinstn
1
630
kubode
0
190
e10dokup
0
440
wasabeef
1
560
Featured
See All Featured
nonsquared
81
3.3k
addyosmani
494
110k
paulrobertlloyd
71
3.6k
danielanewman
200
19k
bkeepers
321
53k
carmenhchung
26
1.3k
moore
125
21k
schacon
145
6.6k
samanthasiow
56
6.3k
chriscoyier
684
180k
roundedbygravity
84
7.8k
searls
204
35k
Transcript
Flocking Simulation with Phoenix Channels
Flocking Theory
None
Use case: Cinematic effects
Boid: One member of a flock
* Location
* Location * Perception Radius
* Location * Perception Radius * Velocity * Heading
You Need Three Behaviours
1. Cohesion
1. Cohesion
1. Cohesion
2. Alignment
2. Alignment
2. Alignment
3. Separation
3. Separation
3. Separation ! !
3. Separation ! !
* Cohesion * Alignment * Separation = Next move
Architecture
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
Demo Time!
Read on! http://harry.me/blog/2011/02/17/neat-algorithms-flocking/ http://www.red3d.com/cwr/boids/