GithubHelp home page GithubHelp logo

leviantsim's Introduction

LeviAntSim

Basic boids / ants simulation. just for fun. will work on it after AP test

What are Boids?

Boids are simulated objects, that move around in a random direction. All boids must follow these simple rules:

Separation: Avoid colliding with any other boids

As a boid travels around, it must avoid colliding with any other boids nearby. This typically means that boids will swerve to avoid each other when detected from short distances, or will slightly adjust course when detected from long distances, provided a distance factor is added to the rotation adjustment algorithm. In this implementation, boids travel in their random direction. When a boid passes within their radius of detection, and other the boid is in front of them (ฮ”R < 2ฯ€), the boid will turn to avoid them. This is done by taking the direction away from the other boid (-1 to 1), and multiplying it by the introvertedness (static constant) and the urgency (1-dist/viewdist). Adding this value to the boid's current rotation will cause it to swerve to avoid in emergencies, and slightly adjust course when it is necessary.

Alignment: Align yourself with close-by boids

As a boid avoids other boids (nice rhyme), it must align its course with nearby boids. This means, if it is not in danger of colliding with a boid any time soon, it should turn close to parallel to other boids.

Cohesion: Turn to the center of your current flock

As a boid dances with other boids, it must turn towards the center of the nearby flock. This means that boids will try to stay close together, but will refuse to get too close. A boid exists in 2d or 3d space, and when all the boids follow these simple rules, they appear to exibit flocking / herding / swarming behaviors. Boid simulations are a type of simulation called an "Emergent Simulation". This is when a complicated behavior "emerges" from simple instructions.

Resources

leviantsim's People

Contributors

cheespeasa1234 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.