Life-like shapes, navigating using a flocking behavior

in #gamedev7 years ago

I stumbled at this old GIF on my computer, thought it was interesting so I shared it.
flock.gif
I created this 5 months ago, I wanted to create a simple flocking behavior. Each shape has unique stats and a cute name.

  • Squarel : Very slow, steers well and has a strong repulsion.
  • Circloid : The all-rounded shape (No pun intended)
  • Tribloid : Very fast, does not steer well and has a weak repulsion

Every shape moves to the cursor, however it pushes the other shapes away from it, this simple mechanic adds a lot of life.

You could also place walls, however collision does not exist. Everything works with force vectors and steering vectors. If you approach a wall you are pushed away from it instead of being limited by it's boundaries. In the GIF, we eventually see a Circloid going slightly into a wall.

A normal flocking behavior follows these three principals :

  • Separation : Each agent tries to keep it's distance with other agents.
  • Alignment : Steer in the average direction your neighbors are steering.
  • Cohesion : Steer at the average position of your neighbors.

However mine is a bit different, because the mouse position is the target that the agents are seeking. Usually they would "go with the flow" and be steered in a direction like fish thanks to the 3 principals. A fun fact about the GIF is that alignment is done by shape. Squarels align with Squarels, Circloids with Circloids and Tribloids with Tribloids!

I hope this old GIF from my computer managed to spark your interest in flocking behavior! Let me know if it interests you, because I could explain in greater detail how this works.

Sort:  

Oh my god! This is soooo wonderful. I am obsessed with swarm dynamics. I actually named a composition of mine on a previous album, Swarm Dynamics. I love your logical build of this behavior.

Do you have any other work like this? (physics based visual stuff)?

Quite interesting that you named one of your albums Swarm Dynamics :) Yes I do have another project, which is quite similar and much more complete! I will show it soon :)

EDIT: I'm taking footage right now of that said project, it does not use swarm dynamics unfortunately (but the project has similarities as it tries to replicate life), however I think it will interest you more than this one (hopefully).

EDIT 2 : FishEco is "that said project" :)

Coin Marketplace

STEEM 0.20
TRX 0.15
JST 0.029
BTC 64572.94
ETH 2630.79
USDT 1.00
SBD 2.82