Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Classical pong game remade in terminal with Go

License

NotificationsYou must be signed in to change notification settings

spinzed/tpong

Repository files navigation

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 worksonly on Linux systems due to platform-dependent key detection.
For a similar reason, this gamemust be run with superuser privileges.

To interact with terminal, thetcell package API is used.
For keyboard events detection, thekeylogger package API is used.
For command line argument parsing, thego-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, packagekeylogger 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

  • Two player local multiplayer!
  • Command line arguments!
  • Start menu!
  • Round pausing!
  • AI!
  • Themes!
  • ... and more to come!

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 commandsudo 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!

About

Classical pong game remade in terminal with Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp