This repository is a simple port of the original Atari 1979's game in Go, with boids (autonomous agents).
🏠 Homepage
Asteroids is a arcade game released in 1979 by Atari, Inc. The player controls a single spaceship in an asteroid field. The object of the game is to shoot and destroy the asteroids, while not colliding with either. The game becomes harder as the number of asteroids increases.
This repository is a simple port of the original game play in Go, while replacing asteroids with boids (autonomous agents).
✨ Demo
$ make build
Will create an asteboids
binary executable file.
$ make run
$ make debug
$ make wasm
⚠ This feature is broken since integration with segmentio/conf
⚠ (see: #14)
key up
: startship move forwardkey left
: startship rotate counter clockwisekey right
: startship rotate clockwisespace
: startship shotenter
: game restarts
: takes a screenshot (file is stored asscreenshot_<date><time>.png
)d
: dumps internal game state (file is stored asasteboids_<date><time>.dump
)cmd+q
: exit
help Show this help.
lint Execute Golangci-lint on the repo.
test Go test the repo.
run Run the main program.
debug Run the main program.
pprof Run the main program with profiling.
clean Build the main program.
build Build the main program.
wasm Build for WASM distribution.
badge Generate a coverage badge.
cover Measure the test coverage.
login Log in to docker hub registry.
build-docker Build docker images.
By default, Asteboids
will read from a configurable file defined by the -config-file
command line argument, then load values present in the environment, and finally load the program arguments.
Passing configuration via the program arguments:
$ go run cmd/asteboids/main.go -debug
Passing configuration via the environment variables:
$ MAIN_BOIDS=100 go run cmd/asteboids/main.go
Passing configuration via a configuration file:
$ go run cmd/asteboids/main.go -config-file ./custom_config.yml
Default configuration is located in the file config.yml
debug
optim
asteroids
boids
screenWidth
screenHeight
scoreTimeUnit
autoGenerateAsteroidsRatio
visionRadius
maxTPS
mute
In his book Nature Of Code, Daniel Shiffman reminds us the three rules of flocking:
- Separation (also known as “avoidance”): Steer to avoid colliding with your neighbors.
- Alignment (also known as “copy”): Steer in the same direction as your neighbors.
- Cohesion (also known as “center”): Steer towards the center of your neighbors (stay with the group).
The boids in Asteboids implement these 3 rules.
Some fonts in this repository are copyright (c) Jakob Fischer at www.pizzadude.dk, all rights reserved. Do not distribute without the author's permission. Use these font for non-commercial use only! If you plan to use them for commercial purposes, contact the author before doing so! For more original fonts take a look at www.pizzadude.dk
- Website: http://jtbonhomme.github.io
- Twitter: @jtbonhomme
- Github: @jtbonhomme
- LinkedIn: @jtbonhomme
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a ⭐️ if this project helped you!
Copyright © 2021 [email protected].
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator