Monday, August 10, 2015

Playing multiplayer online terminal Pong with basic Linux utilities.

The ideas you come up with to keep yourself amused when you're really bored or isolated. I can't go into the specifics of who and where but I was in a situation recently that involved working 12 hour shifts back to back for weeks inside a shipping container office with nothing but some Linux workstations on an air gapped network. No internet, no phones, no electronic devices of any kind except those workstations. Once we were on top of our work we had lots of downtime just watching Nagios dashboards. The days crawled.

It was during these excruciatingly slow shifts that I had an idea of how we could play a rudimentary network multiplayer game of text based Pong using software already on the workstations.

Emacs has a few built in games hidden away in the menu. They're text based and pretty much all single player except for Pong. I guess Emacs Pong is intended to be played by two players sharing the same physical keyboard. Using a shared account, ssh and screen (terminal multiplexer) I was able to adapt it to be a network multiplayer game of sorts. It's dead simple and easy to cheat by pressing the other players keys but it passed a little time and I figured I'd share it with you all. This is how I did it:

Terminal1:


$ useradd tempaccount
$ passwd tempaccount
$ su - tempaccount
$ screen
$ emacs -nw
Press Alt - T - G - P (Opens Pong in Emacs)


Terminal2:


$ ssh tempaccount@terminal1
$ screen -x

One player uses left and right arrows while the other uses up and down.

Later on we found that there were a few proper games in a software repository on our network so we weren't confined to Pong for weeks. For what it's worth this was still kind of fun though.

I love these kinds of messy workarounds. I'm sure there are probably many similar hacks that people have done with text games in a terminal. If anyone out there has done something similar I'd genuinely love to hear about it so leave a comment below.


The graphics don't make the game.

No comments:

Post a Comment