Skip to content

Latest commit

 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gong! — The Go Pong

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

Run from source

Install Go 1.26 or later, then run:

git clone https://github.com/jenska/gong.git
cd gong
go run .

Screenshot

Install

To build and install a standalone gong binary into your Go bin path:

go install

Makefile targets

Common development commands:

make run
make build
make test
make fmt
make tidy
make web

Custom controllers

Paddle 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)

Development

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-web

Then open http://localhost:8080.

Dependencies

Dependencies are managed with Go modules. Ebitengine may require additional native development libraries on Linux.

Debian / Ubuntu

sudo apt install libc6-dev libglu1-mesa-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-config

Fedora

sudo dnf install mesa-libGLU-devel mesa-libGLES-devel libXrandr-devel libXcursor-devel libXinerama-devel libXi-devel libXxf86vm-devel alsa-lib-devel pkg-config

Thanks

About

Gong! - The Go Pong Game

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages