Share your repls and programming experiences

← Back to all posts
Flocking Behaviour AKA Fish simulator 2020
BrokenKeyboard (35)

Boid simulator

Basically a simulator of a herd of animals running around that like to stick together. They have 3 rules that they follow:

Rule 1

Move away from your neighbors if they are less than x pixels from you.

Rule 2

Point the average direction of the people around you (Basically move where everyone else is moving)

Rule 3

Move towards the local center. Basically take the average of the positions of the people within x pixels of you and then turn that direction.

Ok, all thats great, but how do I play???!1!?1

Well, slow down there. Its pretty simple, as there are not much things you can do.
There are 3 checkboxes on the right hand side of the screen, you can turn them off and on to see what different combinations of rules do. The checkboxes are the following from top to bottom:
Rule 1 off/on
Rule 2 off/on
Rule 3 off/on

One really strange thing happened, scroll down, otherwise you wont be able to see the checkboxes.

Final thing, please upvote if you liked! (and very final thing, look out for a 3D version coming out soon!)

Commentshotnewtop
Vandesm14 (2438)

This is really cool!

fuzzyastrocat (1297)

Nice! (Though 3-rule boid is overcomplicated in my opinion... I once figured out how to reduce it to one rule and it provided the same functionality.)

BrokenKeyboard (35)

@fuzzyastrocat The reason for it is just to break it down into different (unique) behaviours. Its like the steps in a recipe.

maxyang (139)

m e s m i r i z i n g

RayhanADev (1002)

Kewl! Now I challenge you. Study Furrets and make a Furret simulator.

TsunamiOrSumth (352)

@RayhanADev NOOO MAKE A TSUNAMI SIMULATOR IT WILL ACTUALLY BE USEFUL SINCE IT CAN PREDICT THEM AND STUFF

RayhanADev (1002)

@TsunamiOrSumth bah, tsunamis are real. We need Furrets in our lives.

TsunamiOrSumth (352)

@RayhanADev yeah sometimes i wish pokemon was real cuz then id have friends

im not funny am i
BrokenKeyboard (35)

@TsunamiOrSumth Depends. Do you want me to make something that can predict earthquakes? (They cause tsunamis) Or do you want me to simulate water? and then shake it around

TsunamiOrSumth (352)

@BrokenKeyboard either is fine lol
just do something related to tsunamis

TsunamiOrSumth (352)

This is super cool, I defenitly could not do this in my lifetime. (i am stupid) Great Job!

xxpertHacker (555)

Without seeing this Repl post, it's impossible to know which rule does what; I believe that the web page itself should have a short description of each.