Writing a Solarpunk Twine Game with SugarCube

October 24th, 2025
Cover image of the post

Some of you know that I started learning about game writing and, specifically, Twine, some time ago. I began with writing the simplest possible tiny game, just to get a feel of Twine.

After that, I was ready for something more complex. So, I chose SugarCube (which is kind of like a library/language you use for coding in Twine). I have no background in coding, so it was all completely new to me.

I started with simple things, like assigning points to the player and if/elseif conditionals that would give the player different options based on how many points they had. But it kept getting more complex, and even though I initially wanted to describe the whole process of writing this game and how I made things work, I realized that it would take me forever to explain, plus, as someone who's just learning all this stuff, I'm not in a position to do it well.

It was definitely an interesting experience that I, surprisingly, enjoyed, even though it was frustrating at times.

The result is a solarpunk game based on building relationships within a community, but it starts in a brutal world, so, if you choose to play it, beware of the following content warnings: war, missiles, violence (not graphic).

It's very short, and that was the point: so I could finish it fairly quickly and use it in my portfolio, but that brings obvious limitations. A lot is omitted and glossed over for the sake of brevity. I have so many thoughts about what it could look like as a complete game, but these are just fantasies. Otherwise, I don't think I want to say more, just play it if you want. It's basically interactive fiction, just white text against black background since I'm only learning about the narrative aspect of game design and didn't even try to make it look good.

If there are people among you who have some understanding of Twine/SugarCube and want some details, here are some things that I learned.

Variables that I used to assign and subtract points, determine whether the player was doing something for the first time, start showing the points at a certain time in the game, etc.

Objects consisting of variables that I later used in functions that checked if the player has done none of the tasks, at least one of them, a certain number of them, or all of them (in more technical terms, if all the keys in a certain object were false, or at least one of them/a certain number of them/all of them were true), which determined what happened to the player.

Widgets for reusable code bits to keep my code DRY (don't repeat yourself) — the abbreviation made me chuckle.

An array of news items that were shown to the player one by one in a particular order every time they came back to a place where watching the news was possible, but they couldn't watch more than one piece of news at a time, since the idea was that some time passed between the segments. That required a whole setup of different things, and even some CSS (like I said, I didn't try to make my game look good, but I wanted the news to look a bit different from the rest of the story).

A StoryInit passage that contained all of the above and a StoryCaption passage to start showing the points at a certain time.

I also used lots of if conditionals that determined what happened in the game based on the number of points earned or the number of tasks completed, or whether any tasks were completed at all, or whether the player was somewhere for the first time or not, etc.

That's it more or less. Pretty basic stuff, but all new to me. I have an idea for another game that will be about fighting against an oppressive regime. Hopefully, I'll have some time to start writing it soon.

Featured image by RosZie.

Want to discover awesome SFF books?Subscribe!