purol / Flocking

It is made for describing flocking behavior.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flocking

It is made for describing flocking behavior.

You can build it by Visual Studio 2019 (different versions can cause some problems.) or you can just run x64\Release\opencvtest.exe.

Motivation

When I visited Kyoto Aquarium(October 12, 2019), I saw lots of tiny fishes that moved with synchronization. I was inspired by that, so I have tried to find a way how I can describe it.

How to use it

If you do not have Visual Studio, then you need to install Visual C++ Redistributable. Here is the link (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)

Build the code or just run x64\Release\flocking.exe

Gif files

Alt text Alt text Alt text Alt text Alt text Alt text

How to play

Q button : adding one creature

W button : removing one reature

mouse right button : attracting creatures

mouse left button : repulse creatures

I hope you enjoy it!

How it works

There are three rules.

  1. separation among creatures. Within a specific distance, creatures try to break away from others.
  2. alignment among creatures. Within a specific distance, creatures try to get average velocity and orientation with others.
  3. cohesion among creatures. Within a specific distance, creatures try to go to the average point of others.

Moreover, I added an additional rule for evading wall and mouse control (repulse and allure to mouse)

Photography

Alt text Alt text Alt text These are the photography which I took on kyoto aquarium. You can see tiny fishes moving on the tank.

Reference

http://aidev.co.kr/alife/477

About

It is made for describing flocking behavior.


Languages

Language:C 94.7%Language:C++ 3.7%Language:CMake 1.1%Language:Objective-C 0.5%