Replies: 1 comment
|
I took a stab at parsing the JSON generated by Inky and poke out diverts as an approximation of "which scenes/knots exists I can reach as a player". This was easier than I originally thought and so far seems to work well for me. I thought I'd share the code in case anyone is looking to solve the same problem: The root I filter out diverts that Ink generates itself, because they have cryptic names that are useless for manual navigation. This implementation uses a hand-rolled |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I use inkgd as the story engine behind a text adventure game I'm making. Players follow ink paths and choices to navigate between screens (locations, dialog etc.).
As a developer, I need the ability to jump straight to a particular screen when starting the game since I can't possibly follow the actual path to reach a screen that may only be reachable mid-game. To that end, I want to write a Godot panel that enumerates all paths, and an input box that allows me to filter down available paths. Clicking a path would then send me straight to that path via
InkPlayer#choose_path.The problem I am facing is that I couldn't find a good way to enumerate all possible paths. IIUC
InkPlayeroperates lazily: while it parses the ink JSON, it starts with a start node or pointer, then as the story progresses, it follows these links, but it does not appear to have an upfront concept of "this is the scene graph", am I wrong? (Godot's crummy debugger isn't particularly useful in helping me understand this.)One idea I had was to parse the Ink JSON and detect diverts since they tend to point to key story path segments. Looking at the JSON format though, it's not easily interpreted. A scene element is an array of text fragments, ink codes/metadata etc. and it's hard to say what is even a path segment (for example, Ink functions and constants appear adjacent to ordinary segments in the scene JSON and are not clearly identified as such.) It's messy.
A simple alternative could of course be to just type in the desired path, however, since path names can be long and nested (think:
game_act2.location1.screen_5) this is really tedious and error prone. It would be so much nicer to have a pre-populated list to choose from.Any ideas how to go about that? Is there an object in inkgd that holds the entire scene graph and that I could process recursively to poke out path segments? 🤔
All reactions