One of the first things people learn when they start programming is how to write a text prompt. It’s a decades-old exercise that teaches new programmers input-output.
In order to inject a little excitement, learners are normally
encouraged to write interactive games using standard IO. This helps
them learn programming by interactively - they will need to learn
conditional logic to handle the “
Will you stab the monster with your
sword or run away?” prompt.
An ideal system would allow text adventures (console applications) to be written in any language but also be distributed on the web. This is what my latest project, textadventurer, tries to achieve (gallery).
textadventurer keeps interaction in the browser while moving
execution onto the server. Communication between those two layers is
achieved with websockets. This makes it easier for people to play the
game. The frontend focuses on presenting games (CLI applications) to
the players and provides a basic UI for sending input (STDIN) to the
server and recieving output (STDOUT) from the server.
Using process forking server-side affords a lot of flexibility: the
server is completely agnostic to the language or framework that the
game is written in. This means I can use
distribute any standard interactive CLI application. With that in
mind, I plan on deploying historic text adventure games to
textadventurer when I get the chance
so that people can enjoy those games once more without having to faff
around with installers, legacy interpreters, etc.