Flocking Simulation: Boids (JavaScript)

  Рет қаралды 20,512

SimonDev

SimonDev

4 жыл бұрын

In this project I fiddled around with a boids simulation, making them fly through space and underwater (using the three.js JavaScript framework). I run through some of the basic steering behaviours and how to combine them, building them up into something that looks complex and interesting. I also taking the flocking simulation and apply it to an underwater scene and an outer space scene, describing any tweaks and changes I make along the way.
Can't promise the code is bug free, but its all available online on github. Feel free to grab it, fork it, laugh at it, etc.
What's covered:
* Steering Behaviours
I'll go over the steering behaviours we used in this particular flocking simulation (separation/alignment/cohesion), how they're derived, and how they're combined.
* Underwater Scene
Using the working behaviours and boids from the first section, I threw together a small underwater scene with a few (poorly modelled) fish. I describe what tweaks I made to the flocking simulation and steering behaviours to get the behaviour I wanted.
* Space Scene
Again, took the existing flocking simulation and tried to apply it to a more "Battlestar Galactica" type of scene, with ships and explosions and stuff. Described a few of the tweaks and changes I applied.
Github: github.com/simondevyoutube/Fl...
Wikipedia: en.wikipedia.org/wiki/Boids
Craig Reynolds: www.red3d.com/cwr/boids/
#flocking #boids #gamedevelopment

Пікірлер: 23
@amerjabar7825
@amerjabar7825 2 жыл бұрын
I found gold! Probably the best channel on pure and creative programming with short videos! Thank you for these great videos. I suggest you make videos on low-level programming versus high level and how it works with the hardware in the matter of performance, speed and security.
@nomadshiba
@nomadshiba 3 жыл бұрын
not even using THREE.js but watching ur stuff for the techniques you use
@AlexDemskie
@AlexDemskie 4 жыл бұрын
I can't imagine a better and more concise tutorial on this topic. Well done.
@simondev758
@simondev758 4 жыл бұрын
Thanks, appreciate the comment! Got any topics in mind for a future video?
@icepickonefive
@icepickonefive 2 жыл бұрын
Thank you for your great tutorials, you concisely explain every topic so well and give so much insight beyond the docs!
@TheNerdyDev
@TheNerdyDev 4 жыл бұрын
Awesome stuff on Three.js. Really liked it Simon. Most of the tutorials on Three.js that I have seen is that silly rotating cube. This was superb. Keep it coming :).Top notch stuff
@simondev758
@simondev758 4 жыл бұрын
Thanks! I'm gathering some ideas on what to do next, might make a quickie Minecraft clone in the browser. Got any ideas for what you'd like to see down the road?
@simondev758
@simondev758 4 жыл бұрын
Like & Subscribe, thank you! What other scenarios do you think boids would work well in?
@AleksanderFimreite
@AleksanderFimreite 2 жыл бұрын
Fun fact, I would summarize fish behaviours in 3 separate categories actually. - Swimming (mostly simular to what you implemented, constant smooth forward motion) - Feeding (Quite random seek locations, quite random speeds, quite random rotations inc. upside down) - Scouting (Staying still for a random time, and moving to a new location quite rapidly)
@simondev758
@simondev758 2 жыл бұрын
Ooh it'd be fun to revisit this with better behaviours.
@AleksanderFimreite
@AleksanderFimreite 2 жыл бұрын
@@simondev758 I agree. If you need some reference material, some fish I can think of off the top of my head which frequently behave like the other two types would be: For the feeding behaviour, most fish when there is food nearby, but the following do it more so than other types of behaviours. Guppies, Platies, Discus, Angelfish. Most tetra type of fish, for example Neon Tetras tends to do a lot of scouting behaviour. There exist many types of videos showing each of these behaviours I'm sure. Some fish also tends to do a rapid vertical movement without facing vertically. Which I have found to be a challenge using boids. But perhaps there is some trickery to be achived by not having the mesh exactly look at the heading direction all the time.
@simondev758
@simondev758 2 жыл бұрын
Interesting, yeah the boids implementation I did, heading is locked to velocity. This is interesting though, might be an excuse to merge all of this with a sort of eco-system simulation idea I've wanted to do.
@matheushussain
@matheushussain 3 жыл бұрын
Hi SimonDev! Thankyou so much for the vid, really awesome to see this topic explained so clearly!
@simondev758
@simondev758 3 жыл бұрын
Glad it was helpful, let me know if there are other things you want covered.
@alichamas63
@alichamas63 Жыл бұрын
Love your content man. Reminds me of a technique I used once where you render an offscreen cloud texture and use the grayscale value of the current pixel at the boids location to determine the angle of rotation. Makes for nice flocking movement but doesn't take other objects into consideration. Interestingly because they're all following the same cloud texture thier flight path looks cohesive.
@WhoIsMrKemp
@WhoIsMrKemp 2 жыл бұрын
I love it, especially the ending... I'm learning about boids but I'm a very visual person...(been drawing all my life)... but I've been stuck on boid design(squids or spaceships). If I do space ships I want to use missiles or grappling hooks but can't figure out how to adjust the code of the laser to get the arching affect instead of the straight line.... if I go squids I'm a little confused on how to get the tentacle effects. Both the noodle effect when they swim and the use when interacting with something... Am I getting too caught up in the ideal of doing it in code and should maybe use a visual program? Or should I embrace this journey down this rabbit hole?
@simondev758
@simondev758 2 жыл бұрын
Not sure what you mean, you want to add missiles to the ships?
@jasonjennings3913
@jasonjennings3913 2 жыл бұрын
If you replace the random direction with a direction from a pathfinding algorithm, could you use this to have groups of units move in formation (like in RTS games)?
@simondev758
@simondev758 2 жыл бұрын
Most likely yeah.
@MechanicalMooCow
@MechanicalMooCow 2 жыл бұрын
That's literally how Starcraft does it, so yes.
@williamchamberlain2263
@williamchamberlain2263 Жыл бұрын
Boids is best
3D World Generation: Heightmap Tutorial
9:11
SimonDev
Рет қаралды 46 М.
Don't eat centipede 🪱😂
00:19
Nadir Sailov
Рет қаралды 23 МЛН
어른의 힘으로만 할 수 있는 버블티 마시는법
00:15
진영민yeongmin
Рет қаралды 6 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 52 МЛН
Spatial Hash Grids & Tales from Game Development
19:08
SimonDev
Рет қаралды 110 М.
Just Boids | Useless Game Dev
12:10
Useless Game Dev
Рет қаралды 55 М.
Craig Reynolds' Boids
0:24
Dan
Рет қаралды 8 М.
Writing a Particle System (using Three.js)
10:18
SimonDev
Рет қаралды 36 М.
Coding Challenge #124: Flocking Simulation
42:27
The Coding Train
Рет қаралды 323 М.
Coding Adventure: Boids
8:35
Sebastian Lague
Рет қаралды 1,5 МЛН
Neat AI does Spatial Hash Boids
8:10
Neat AI
Рет қаралды 15 М.
🤔Почему Samsung ПОМОГАЕТ Apple?
0:48
Technodeus
Рет қаралды 441 М.
Huawei который почти как iPhone
0:53
Romancev768
Рет қаралды 250 М.
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,3 МЛН
Карточка Зарядка 📱 ( @ArshSoni )
0:23
EpicShortsRussia
Рет қаралды 105 М.
What’s your charging level??
0:14
Татьяна Дука
Рет қаралды 7 МЛН
Xiaomi Note 13 Pro по безумной цене в России
0:43
Простые Технологии
Рет қаралды 1,9 МЛН