Boid flock implemented in Go with WebAssembly.
- Clone this project
- Make sure you have Go installed. If not, install Go
- Install goexec by running
go get -v -u github.com/shurcooL/goexec
- Copy the WASM-javascript glue code to the root of your cloned repository
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
You're all set for running the program!
- Spin up a web server by running
goexec 'http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`.`)))'
- Build the program by running
build.sh
- Navigate to localhost:8080 to see the boids! 🐦
This is a quite bare-bones example of a boid flock. There is still a lot to do, and much fine tuning of parameters can be performed. If you want to experiment more with this yourself, this is a good start. Factors such as attractors/gravity, acceleration and interactivity is not present in this demo.