Building an Engine for animating user-written adventure games in React
August 26, 2022
During the CoTech gathering in 2021 I played an interactive choice-based adventure game written by a friend, obstenisbly about co-operative organising but exploring other themes also. After a number of follow-up conversations and a shared interest in co-operatives and in adventure games like Disco Elysium, we decided to play with building one together. In our first game - Big City Agora - the player wakes up in a park in Big City and into a world where everyone has forgotten everything except their language, after an event called the Big Pop. The gameplay involves exploring the world via text-based choices and dialogue using character portraits, regular text effects and animations to bring more life to the story. A live demo is available following the link in the text, and the code and documentation is open source, published on GitHub.
The end product is capable of parsing stories written using Ink, which is a simple but feature-rich programming language maintained to support linear narratives like Big City Agora. Taking in an exported Ink project from an online source, our engine parses the content and animates it using React components, directed by some automatic animation and by supporting custom extensions to the Ink syntax for directing character portraits, pauses and effects.
The project was built fairly iteratively, it began life intended as being for a single-game and for trying out React, but later I realised the potential for writing a fairly simple but powerful tool for rendering any Ink narrative and giving it some life. If you’re interested in trying it out and writing your own dialogue, check out the README where you can find instructions. Ink is a programming language but I believe it to be quite accessible to newcomers, and having played around with other formats and tools like Twine I find it very friendly when writing linear branching narratives.
From here I have some plans to explore expanding further on the application into the purposes of sharing games amongst writers and players, and into some novel ideas on how to use the semantic web to bring the games together into a decentralised but coherent narrative world. I’ll keep you posted :-)