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
63
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
55
fabrik42
0
67
fabrik42
0
19
fabrik42
0
130
fabrik42
0
47
fabrik42
0
150
fabrik42
0
110
fabrik42
0
93
fabrik42
0
110
Other Decks in Programming
See All in Programming
shun_oshidari
6
2.8k
nerocrux
2
680
yasuakiomokawa
0
340
rukiadia
1
790
adarapata
1
410
andpad
0
340
kazuhei0108
3
920
uhyo
19
9.1k
kamilahsantos
0
130
shiba6v
0
200
manfredsteyer
PRO
1
210
clusterinc
0
270
Featured
See All Featured
afnizarnur
176
14k
tammielis
237
23k
chriscoyier
779
240k
cherdarchuk
71
260k
mza
80
4.2k
rasmusluckow
318
18k
pauljervisheath
195
15k
keathley
20
760
orderedlist
PRO
330
36k
yeseniaperezcruz
302
31k
jonrohan
1021
390k
ddemaree
273
31k
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/