ink
ink copied to clipboard
How to extend Ink with custom syntax?
I've been working on a browser-based text adventure game using React. I've been using Windups and JavaScript to animate parts of the text. I started modelling the dialogue with Ink and I love the syntax, and it's so much more readable than hundreds of lines of JavaScript code!
I saw that in Heaven's Vault the devs extended Ink with some custom syntax, and if it's possible I'd like to extend it myself too
## Instructing text animation
Parts of the animations I'm using will require custom code to achieve it, but it would be great if other parts of this could be written into the Ink files, for example when to pause and controlling the pacing of the typewriter animation
Including information about who is doing the speaking
The picture and name of the performer who is speaking. Currently represented as a JSON object
## Querying semantic markup for decentralised games
Essentially the idea to achieve this is as follows:
- the game state is modelled using linked data (a protocol allowing apps to share schema and become interoperable)
- Inside of the Ink code the most simple extension I can think of is to write a condition with an endpoint (
{ https://my-endpoint..}
), which will trigger the client to make a GET request to that endpoint, expecting to receive a file which it can compare with the game state (this file is known as a Shape, and if the shape passes, then the Ink condition passes) - Including writing to linked data, updating the game state as I can using Ink "locally". I had in mind a similar solution, something like
~ https://my-endpoint...
which would return a suggested JSON object containing requested game-state changes for the client to make. If I could achieve all of this then I think the feature set would be pretty comprehensive
What is my question?
I'm wondering if you're able to comment on if you think it is realistic to achieve this without being "internal" to this project and if there are any initial pointers that you can give me to help me on my way?
The previous solution is using JavaScript code for the "local" stories, and it is also able to render linked data stories, but the latter is not accessible for developers and the feature set is primitive compared to what can be done with Ink