go-pong-wasm

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

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

README

Pong in Go

This is a pet project to try out WebAssembly with Go (golang) in a fun way. The game should be available on my blog. You can also build it and try locally on desktop.

Demo

The AI always wins...

Features

  • Works on desktop (Linux, MacOS, Windows)
  • Works in web browsers using WebAssembly
  • 2-player "VS" mode with same keyboard
  • Survival-style "AI" mode with unbeatable AI (unless you find a glitch)
  • Difficulty/speed increases as you play

Build locally

First, git clone and cd into this repo.

Native desktop version
  1. Run make native to build for native desktop (Linux, MacOS, Windows)
  2. Run the game binary: ./build/pong
WebAssembly version (browser)
  1. Run make wasm to build for WASM target
  2. Run the simple web server locally: go run server/server.go
  3. Run the game inside a browser at https://localhost:8080

TODO / Ideas

  • Make it work on mobile (gomobile compilation targets + touch/drag handling of paddles)
  • Add sounds from original Pong game
  • Add crazy mode with multiple balls
  • Add leaderboard

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