[ANN] GemIF - Simple Interactive Fiction engine for Gemini

On Wed, 2 Dec 2020, Nick Thomas wrote:
> Hmm. Perhaps the best way to go about this would be a cgi-bin script
> that can take a compiled ink story (turns out it compiles to json) and
> use client certificates + a persistent server-side data store for user
> state. The script would be the same for every story, it'd "just" need a
> way to store per-user state.

That's a neat idea. I haven't yet had a chance to inspect Ink's file 
format, but I'll keep that in mind once I finally get around to it. Right 
now I'm working on the project foundation because, well, it's fun. But 
also so the project is healthy and maintainable if/when I try to add Ink 
integration.

What I _have_ done is simplify the server-side by making use of state 
tokens in the URL. Rather than tracking games and state in-memory server 
side, the server instead serializes the game state out into a token
(configurable as JSON or Protobuf) in the URL.

That way, each action link on the page just contains a "speculative" state 
token. This also wildly simplifies state rollback when the user navigates 
backward in their client since the state token contains everything anyway.

It also means games still work across server restarts (and theoretically 
even across _servers_ with the same stories)  without having to 
persist sessions anywhere.

Another new addition is writing stories in `.gemif` format rather than 
YAML format and "compiling" to YAML via a new `gemifc` command.

Right now, it's just a very minor abstraction over the YAML, but it's a 
start and does make writing a little more pleasant.

Scene metadata and transitions are still written in YAML format in 
(essentially) YAML frontmatter, while scene descriptions are now just 
plaintext. Each `.gemif` file can contain one or more scenes and
each story can contain one or more .gemif file.

Anyway, you can see some examples in the repo [1], so I don't take up too 
much space trying to explain it.

The other thing the samples demonstrate is the use of conditions. 
Transitions can attach conditions to the game state, which can then be 
used for conditional rendering in the scene descriptions as well as 
allowing or disallowing the use other transitions based on which 
conditions are present.

There's still a ways to go since I'm just learning a lot of these 
technologies, but I'm pretty happy with how things are shaping up so far.

[1] https://git.sr.ht/~nromdotcom/gemif/tree/master/stories/src/conditions

---

Previous in thread (33 of 34): 🗣️ John Cowan (cowan (a) ccil.org)

View entire thread.