GithubHelp home page GithubHelp logo

godot-boids-acceleration-structure's Introduction

Boids in Godot with Acceleration Structure

This is my second attempt at boids in godot. I implemented an acceleration strcuture to optimize the nearest neighbor lookups. All boid locations are stored in a 2D which represets the space. The boids query the structure to get 4 cells based on the facing of the boids. The boids then filter that list based on their view range. This way the boid isn't looping over the entire list of boids. It's only concered with it's immedaite surroundings.

I also slowed the physics engine down to 10 Hz to increase the number of boids past 2000. You can adjust the physics engine Hz in Project Settings->Physics->Common->Physics FPS

For more information on boids see Craig Reynolds Boids. A more detailed breakdown of Boids with pseudocode can be found here.

Running the Demo

Click F5 to run the default screen. Then click anywhere on the screen to issue a waypoint for the boids. The boids will continue to chase mouse clicks.

Controls:

  • left click - place target flag
  • right click - scatter the boids to random locations on the screen.

Adjusting the simulation

You can control the paremeters of the simulation in the editor.

The Crow scene script variables:

  • View distance - distance to view flock for each Boid
  • Avoid distance - the distance at which a boid will try to avoid another boid
  • Max Speed - the maximum speed of the boid
  • Force - There is a seperate force for each vector: cohesion, separation, alignment and mouse follow. Try playing with them :)

The RandomBoids scene script variables:

  • Boids - the number of boids that will spawn
  • Boid - the boid scene. There are three scenes: Boids (the original chickens), Crows, and Bats.

Credits

This project uses the FarmPuzzleAnimals pack created by CoMiGo

godot-boids-acceleration-structure's People

Contributors

feralbytes avatar kyrick 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.