A retro-styled Pong clone written in Go with Ebitengine.
Play Gong in your browser · MIT license
Features include:
- One-player, two-player, and AI-versus-AI modes
- Beginner, human-like, and perfect-prediction computer players
- An exported controller API for custom player and AI implementations
- Contact-based paddle deflection, movement-driven spin, directional serves, and capped speed progression
- Fullscreen mode, sound effects, and volume controls
- Cached HUD rendering and allocation-free sprite trail updates
Install Go 1.26 or later, then run:
git clone https://github.com/jenska/gong.git
cd gong
go run .To build and install a standalone gong binary into your Go bin path:
go installCommon development commands:
make run
make build
make test
make fmt
make tidy
make webPaddle input is defined by the exported game.Controller interface. A
controller receives an immutable view of the current game and returns its
desired movement:
type Controller interface {
Name() string
Control(game.GameView) game.Control
}Built-in implementations are created with:
game.NewKeyboardController(upKey, downKey)
game.NewBeginnerAI()
game.NewHumanLikeAI()
game.NewPerfectAI()This keeps gameplay, input, and AI strategy separate, making new controllers straightforward to implement and test.
Custom controllers can be used directly:
gong := game.NewGong()
gong.StartMatch(myLeftController, game.NewPerfectAI())
ebiten.RunGame(gong)Run the complete validation suite:
gofmt -w main.go game/*.go
go test -race ./...
go vet ./...
go build ./...
go fix -diff ./...Build and serve the WebAssembly version locally:
make serve-webThen open http://localhost:8080.
Dependencies are managed with Go modules. Ebitengine may require additional native development libraries on Linux.
sudo apt install libc6-dev libglu1-mesa-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-configsudo dnf install mesa-libGLU-devel mesa-libGLES-devel libXrandr-devel libXcursor-devel libXinerama-devel libXi-devel libXxf86vm-devel alsa-lib-devel pkg-config