Giter Club home page Giter Club logo

boids's Introduction

Boids

Description

Boid Simulation

A boid simulation is a simulation of a flock of birds. Each bird is called a boid. Each boid has a set of rules that it follows and calculates.

These rules are:

  • Separation: Boids try to keep a small distance away from other objects (including other boids).
  • Alignment: Boids try to align themselves with nearby boids.
  • Cohesion: Boids try to move towards the center of mass of nearby boids.

There are other rules and variations of these rules, but these are the basic rules. I made add more in the future .

Source: Wikipedia

My implementation

I used Rust, WGpu and Winit. My goal was to learn a lower level graphics API and to further cement my knowledge of Rust. With WGpu and Winit my code should run on every platform that supports Vulkan, Metal or DX12. (I have only tested it on Windows 10.)

Showcase

Here is are some videos I made of the program running (Uploaded to Imgur).

The first is boids without rules, just a slightly drift the to left. Imgur Link One

The second is with rules. Imgur Link Two

The third is the current state of the program with rules and tweaked settings. Imgur Link Three

Short Gif of the current state.

Gif

Improvements

  • 2D fish/bird Model or Texture
  • Multi-threading
  • Quad-Tree / Sin and Cos Caching (Other Optimization)
  • Add more rules
  • Add a GUI / Menu
  • 3D Refactor

How to run / build

Cargo is required to build the project. You can download it here.

cargo run --release

cargo build --release --target=[Your system]

*WASM is not supported currently although the libraries do support it

License

MIT License

boids's People

Contributors

andrew-mccall 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.