boids

command module
v0.0.0-...-b6d9899 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 9 Imported by: 0

README

Boids with Go and Ebiten

My blog post: Boids in WebAssembly Using Go


👉🏻 Demo link to the WASM version.

I wrote this program, an implementation of Craig Reynolds' Boids, in order to learn more about deploying Go on the web, and to tackle a problem that escaped me when I was learning to code!


Animated GIF of a flocking simulation

Possible improvements

  • Field of vision support (boids shouldn't look behind 👀)
  • QuadTree optimization
  • Different maxSpeed/maxForce for each boid
  • Graphical interface for live-editing of values
  • Use a snapshot for each 'generation'
  • ..

Run 🦢

go run main.go

Build 🕊

GOOS=js GOARCH=wasm go build -o dist/boids.wasm github.com/healeycodes/boids

This compiles the program into WebAssembly in the dist folder.

The simulation can be viewed in a web browser via index.html. To get this working locally, you may need to serve the files from a web server.


License: MIT.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL