💾 Archived View for tilde.team › ~aprilnightk › gemlog › 2022 › 05 › 07-jeuxterm.gmi captured on 2022-06-03 at 22:55:56. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Hello, fellow Geminauts, Tildezens and whoever else stumbles upon this post.
I love text-based things, and I love games, and I love creating stuff. So, I guess, coming up with this project makes a lot of sense.
In this post I will describe what I have in mind, what I already have done, and share links and screenshots. I hope this will be interesting for some at least!
Links to the repositories are in the bottom of this post.
Some time ago I woke up and thought: it would be fun if I could play simple funny turn-based games right in the terminal with other people. No hurry, no need to be always present and online: you fire up the client, you make your move/your action, depending on the game type, and you're good to go until you come back to check whether your opponent did something.
Think a teminal-based Steam. You have an account, you have some rudimentary statistics (like, how many games you've played and how many of them you've won), and several types of games you can choose from. That's what I wanted to do, so I got to work.
Jeuxterm is being written in Python 3.
It makes use of some auxiliary libs, also available at my repository: one of them is Hafnium, my own engine for serializing/deserializing data and a simple TCP client/server architecture based upon Hafnium data packages.
The only external dependency is pycryptodome: the Jeuxterm accounts have RSA keys (so that the server could verify authenticity of every request, and also I have encrypted game chat/personal message system in mind).
Let's take a look at some screenshots, in the meantime I will shortly describe the design principles behind it all.
Jeuxterm client welcome screen
I have a server running on localhost right now. I fire up the client and see the welcome screen. Note that the client does not use curses or any other such library: it's plain (colored) terminal. After each command the terminal gets cleared, the content is displayed, then the blank lines are displayed so that your input line ended up at the bottom of your window.
Note that above the command input prompt there is an URI line. Basically, a Jeuxterm server mimics to some extent behavior of your HTTP/Gemini/etc servers in that it does precisely this:
(Technically, Hafnium pages architecture would be enough to build an entire separate smallnet. But it's all about games now.)
The pages are server generated, so the client is pretty slim: all it does is pack and send requests and display the response.
We're now at the /index page of the server, and I'm about to add a user. After I do, I gain "registered" rights on the server and can see the actual index page.
Not much here yet. But you can see some links: [0] leads to the list of registered players, [1] leads to the game hub. Input the link number and hit Enter to follow it. Of course, you can also just input the URI you want to request and hit enter, like in any browser: a link is merely what it is, a shortcut.
It should be noticed that (like in Gemini) your connection to the server is NOT maintained. This is by design: I wanted the requests to be as atomic as possible. The upside is cleaner logic and design of the whole architecture (no need to account for connection loss/maintainability, listening to server-initiated requests etc.) The downside is that there's no automatic refresh capability (unless you program the client to send the same request every N seconds, but it's not the same thing).
This is a conscious decision: Jeuxterm does not focus on two players playing here and now in a quick manner (it is totally possible, of course you just refresh frequently).
If you follow the [1] link, you will receive a list of supported game types (there's only one so far: "Rock, Paper, Scissors". After creating your game, you'll see the status page of your newly created game.
Note that the URI has become /game/rps/5b6f7/status. That's pretty self-explanatory: 5b6f7 is random ID of your game, and you're viewing its' status page. (One game can have any amount of "pages". Imagine some adventure game with "inventory", "equipment", etc. pages)
After another user joins the game, it looks like this:
Pretty self-explanatory here.
Every Jeuxterm user has several "rights" associated to them. Jeuxterm pages can (not necessarily, but that's the easiest way to go) be written in a special markup language: lines can be visible, for example, only to players with certain rights: that's why an unregistered user, one who is not in the game, one who is in the game and one who has created the game will all see the same page differently.
This is, in fact, the first project I'm actually making public. I decided to make the source codes be available at tildegit.org.
[HTTP] Muodata auxiliary library repository
[HTTP] Muocrypt auxiliary library repository
If you're interested in trying this, or have some ideas, or just want to keep an eye on the project, or want to contribute - you're welcome!
You can always drop me a line at aprilnightk@tilde.team. I would be really delighted to know that someone is interested in this, because I'm sure that there are people out there who would fancy some simple terminal gaming. This would assure me that the project is not in vain!
This is, like, super-pre-alpha, and there's no installer or package available and no public server running right now. The abovementioned repositories, though, contain everything you'd need if you want to try it at this early stage.
Thank you for your attention, and have a nice day <3