Home

Awesome

It's Pong!

The old school Atari Pong game remade in terminal with Golang.

General Info

For the best experience, make your terminal fullscreen or zoom it out.

The game currently works only on Linux systems due to platform-dependent key detection.
For a similar reason, this game must be run with superuser privileges.

To interact with terminal, the tcell package API is used.
For keyboard events detection, the keylogger package API is used.
For command line argument parsing, the go-flags package API is used.

Why sudo?

It is a compromise that had to be made. Since you cannot detect keyboard press and release key events through terminal, package keylogger is used to do it. Basically, it reads input from /dev/input/event* which requires root access. It is a drawback, but without it, the game would not be playable.

Features

Compile & Run

To compile this project into an executable, run:

go get github.com/spinzed/tpong

You should be able to run the game via command sudo tpong.
Note: make sure than $GOPATH/bin is in your path, otherwise you won't be able to run the command from anywhere else but from $GOPATH/bin.

Alternative is to git clone this repo, cd into it and run:

sudo go run .

Game Screenshots

Image Not Found
Image Not Found
Image Not Found

Controls

In menus:

KeyAction
EnterChoose Selected Action
Scroll Actions Up
Scroll Actions Down

In game:

KeyAction
WPlayer1 Up
SPlayer1 Down
Player2 Up
Player2 Down
SpaceStart
QQuit
PToggle Pause
RRestart Round
AToggle AI
TSwitch Theme
BToggle Background

Command line arguments:

FlagDescriptionDefault ValueOptional
--nobgDictates whether background should be hiddenfalseyes

Further Plans & Todos

Eventually, this project may be expanded:

  1. that it can be hosted via HTTP API
  2. that it is compatible with online play

Any form of contribution or feedback is appreciated!