Giter Club home page Giter Club logo

tpong's Introduction

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

  • 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 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:

Key Action
Enter Choose Selected Action
Scroll Actions Up
Scroll Actions Down

In game:

Key Action
W Player1 Up
S Player1 Down
Player2 Up
Player2 Down
Space Start
Q Quit
P Toggle Pause
R Restart Round
A Toggle AI
T Switch Theme
B Toggle Background

Command line arguments:

Flag Description Default Value Optional
--nobg Dictates whether background should be hidden false yes

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!

tpong's People

Contributors

dependabot[bot] avatar spinzed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.