(originally posted on my IF blog)
I’ve been puttering on my own .NET-based IF platform for years. I rarely talk about it because it’s never gotten past the idea-stage. I originally started experimenting with Visual Basic .NET because I thought the verbosity was a good thing for IF authors. I recently switched everything over to C# with the idea of building a Fluent interface to all of the internal structures.
One of the many challenges of any IF platform is how data structures are implemented so that querying the “world model” is simple and fast. Graham gives some examples of the complexity of parser-based interactive fiction in his recent London IF Meetup presentation, specifically around assumed relationships between objects. (There’s no easy way to embed an exact reference, so you’ll just have to read through the part about natural language in IF).
Another thing I’ve been doing for about ten years is entrepreneurship. Most of you know I attempted to create a commercial/educational IF publishing firm, Textfyre. In recent years I was working on a contextual social network (Wizely) premised on offering globally shared wisdom. I have recently abandoned this startup because machine learning + Search has come close enough to contextual to make my ideas quaint and likely to fail.
However, one of the aspects of trying to build a real business is that you force yourself to learn a lot of new things. One of the things I picked up building Wizely was graph databases. I had been using Neo4j as my tool of choice, but the graph database world has matured and there are several prominent players and interfaces. I still think Neo4j’s Cypher language is the most readable and accessible, but fluent interfaces seem to becoming the standard.
Anyway, graph databases are really interesting when solving relational data problems, especially natural language problems. When you’re building a story in Inform 7, you may find yourself “selecting” things that relate based on “criteria”. One of the core features of Inform 7 is the ability to define very complex relationships and build rules from their current and future state.
A graph database (or data store) would help do the same thing. A graph is made up of vertices and edges, but also known as nodes and relationships.
Player -> IS IN -> Kitchen
Player -> IS CARRYING -> Elvish Sword
Elvish Sword -> IS CARRIED BY -> Player
As you can see, the elements of a graph align directly with how we perceive the world model of a parser-based interactive fictions story.
So extrapolate this to pushing all of the data (or beginning state) of a story into a graph data store, then add the standard graph querying capabilities of either Gremlin or Cypher, you could build an IF platform that focused on the state of a graph.
Cypher example relating to IF:
MATCH (person:Person {"name": "George"})-[:IS IN]-(location:Location)->[]<-(object:Object) RETURN object;
Which would return all of the objects in the location of the PC/NPC named George.
Cypher, Gremlin, and other graph query interfaces are very sophisticated and allow a great deal of querying power and I think this is a very interesting foundation for an IF platform.
In my current efforts, currently named “refly”, I’m building a serializable in-memory graph data store in C# and plan to implement a gremlin and/or Cypher interface. Once that’s complete, I’m going to build a working implementation of a story built in C# fluent interfaces to this in-memory data store. Then I plan to use Blazor to have it run completely in a standard browser that supports Web Assembly.