Boids (for nerds only)
Boids Intro
- Boids is not a video game, it's just something from Nerd to Nerds... It is a simulation of artificial life, of flocks of birds, behaviors of shoals of fish, herds and autonomous vehicles. Where Boids (Bird like objects) have a certain perception of the (virtual) world where they are inserted and of other boids that are around them. Where you can modify their behavior in real time by changing the intensity of three basic rules:
Separation:
In a flock of birds, for example, each bird attempts to maintain a reasonable amount of distance between itself and any nearby birds, to prevent collisions and overcrowding.
Alignment:
Boids try to change their position so that it corresponds with the average alignment of other nearby birds.
Cohesion:
Every boid attempts to move towards the average position of other nearby birds.
Mode 1 - Boids (Bird like objects)
- It is fascinating how these contradictory rules cause behaviors similar to those of living beings, the separation causes the Boids to move away, and the cohesion causes them to come together are opposed, creating tension between them, in the midst of this tension the alignment gives them a direction causing movement, predictable in the short term, but unpredictable in a few minutes, or even a few seconds, a movement that seems to be coordinated, despite not having a leader guiding them, they are all independent, even living under these three rules. .. I think I've heard this before ;D In real life we see this tension between good and evil, quality and price, freedom and security... If we weakened too much, or eliminated one of these forces/rules, the movement would stop or become confused and disoriented. I think it worths a try ;D
Modo 2 - Seek Mouse
- The same rules as above apply, but the impulse to follow the leader is greater, in this case the boids will follow the mouse cursor across the screen; decreasing the steering force has an interesting effect, they lose the ability of turning quickly making the movement more natural. Eliminating the separation they overlap, flying almost as if they were a single element.
Modo 3 - Follow Path
- Is the algorithm used by autonomous vehicles also called autonomous agents, they are able to follow a path determined by waypoints (cartezian points that indicates the vertices of the curves), it is interesting to see how they change their behavior when we switch from Boids or Seek Mouse modes to the Follow Path mode, as they leave their groups and reorganize themselves around a predetermined path or track without bumping on each other and sometimes they even seem to ask permission to fit in the path between others, other times one comes faster for behind takes out of the lane the one that was in front of him, as they have slightly different speeds and accelerations, if you pay attention, you can see some interesting overtakings. Cohesive force is disabled as it is meaningless in this mode. Play around with the other forces and notice the changes in behavior, if you decrease too much the steering force you'll see that they won't be able to stay on the track in the tightest corners.
Steering force
- It's not one of the three main rules, it's the steering force that allows boids to change direction quickly or slowly, if we increase too much this force, Boids will be able to change direction abruptly and lose the naturalness of movements, it will be more noticeable in the modes Seek Mouse and Follow Path, but if we reduce too much this force, they will go practically in a straight line.
- Draw Perimeter Draw the diameter at which the separation force operates around each Boid, giving you a better idea on how it operates.
Craig Reynolds...
Discovered that we can simulate very complex and random behaviors with these rules, creating an algorithm that is now widely used in the games, cinema and architecture industries among others. Trying to start in game development with a racing game, I needed to think about creating an artificial intelligence that would be able to drive the NPCs (Non Player Characters), that is, the cars that will be controlled by the computer and will compete with the player / human pilot. When I have remembered that in the lates 80s waiting to get my hair cut at the barbershop, I saw in a magazine an article talking about a researcher named Craig Reynolds, who had developed an algorithm that simulated life (Artificial Life) on computers. Back to the future... in 2020s I have googled him and saw that he made several of these algorithms (papers) publicly available, so I started implementing these algorithms in Defold, the game engine I'm using for my little racing game. As it was necessary to constantly test the evolution of this implementation with many little fish figures moving around the screen, I decided to create a game that is not a game, but just an interactive presentation of Craig's algorithms, where we can manipulate the basic rules that control the behavior of these virtual herds in real time.Visit the authors' websites:
- Craig Reynolds - Reynolds Engineering & Design http://www.red3d.com/cwr/boids/
- Daniel Shiffman - The Nature Of Code https://natureofcode.com/book/chapter-6-autonomous-agents/
- Many thanks to author and Researcher Craig Reynolds and also to Professor Daniel Shiffman for his invaluable contribution, freely sharing their knowledge. May God greatly bless them.
- All suggestions and constructive criticism are welcome.
Status | Released |
Platforms | HTML5 |
Author | Supertramp Art |
Genre | Educational |
Made with | Defold |
Leave a comment
Log in with itch.io to leave a comment.