Developer Diary - Sustainable-Games/trapped-in-tucson GitHub Wiki

I thought it would be interesting to collect some of the decisions I made in the process of creating Trapped in Tucson and issues encountered along the way for future reference and for others who might want a glimpse into my thought process as I created the game.

Objectives for the game

I am very passionate about using technology to address issues related to the UN Sustainable Development Goals and educating people about them. What better way to engage with issues of sustainability than through games? Of course, the issues facing Tucson, Arizona are very serious and can feel overwhelming...especially water shortages and increasing temperatures. I'm trying to strike a difficult balance: make a game that is challenging and impactful without leaving the player with no sense of hope. There are things we can do to address these issues and I want to explore them in this game, while also including a survival and exploration element. We'll see if I succeed.

Creating an inventory system

One challenging aspect of the project has been creating an inventory system that feels organic. I wanted to be able to update the inventory without sending the player to a new passage to manage the inventory and taking the player out of the flow of the story. The solution I ended up with was to use the link macro to execute a run macro that would push the item into the inventory array. This seemed to be pretty robust, at least in terms of adding elements to the inventory reliably; however, I ended up putting in links to passages for each item (and checking to see if the item was already in the inventory to determine which text should be displayed) because the silent addition of items to the inventory didn't provide any feedback, so it was confusing. I'm still not happy with the interactions - especially for the initial inventory (grabbing things from the car). I'll probably return to this later to see about a different approach, like adding a macro to hide the items that have been taken. I'm not sure how to do this without passage transitions in Twine.

I also need to think about what the limits should be for carrying inventory items or if I shouldn't set an arbitrary limit at all (unless, of course, I add larger items later that would be hard to carry without additional conveyance, like a shopping cart). If I don't set a limit, then it might be necessary to expend or lose items. It's very likely that expending or losing items will become part of the game anyhow.

Exposure and health system

The next game component that needs to be figured out (though the inventory system could use some polish, as well), is to calculate the effects of exposure to sun and high heat, limited water availability, and health effects that would result. This also means that it's necessary to track multiple variables: heat exposure in direct sunlight; heat exposure in the shade (which can still be pretty close to direct sun in urban environments); time elapsed without rest, water, or food; the quantity of water consumed per hour; the inability of the human body to recover from heat exposure when nighttime temperatures are too high (generally above 27° C); limited availability of artificial cooling (which would be needed for recovery); tracking day/night cycles; etc. The environmental factors and health effects should be as realistic as possible and I'd like the player to get in-game cues that their health is degrading without a game-like element, like a health bar. This will likely require a silent macro to calculate and track the multiple variables that will cause some passages to be unavailable or be displayed at appropriate times, e.g., when the player is getting delirious from too much heat and not enough water.

I looked into some rather clunky ways of checking the status of various game state variables, including — I kid you not — the goto macro, whose use is as inelegant as it sounds like it would be. However, in the notes for goto there is a reference to a new API function added in v2.13 of SugarCube: Config.navigation.override. This function intercepts every passage navigation and checks for a condition (which can include checking one or more state variables) and returns the original destination passage name in the callback if the condition is not met or a new passage name if it is. This is exactly what is needed for checking when the player's health has degraded too much to continue. I would also like to have some conditional events that have a greater probability of happening when some of the state variables increase in value, e.g., the player may be more likely to fall into a trap if the confusion state variable is high; but this will greatly streamline the passage code by avoiding conditional event checks in every passage.

Knowing how to use twine to check for health variables for each new passage helps a lot in impacting gameplay with health factors, but the challenge I've faced in implementing the system is trying to figure out how various environmental factors affect the health of the average healthy human being. The very young and the very old are susceptible to heat effects, but there's not a lot of definitive science about the limits of human endurance. Some people can tolerate extremes for a long time, while others will succumb to them quite quickly — even otherwise healthy people. How do I account for this variance in response to environmental extremes?

For the purposes of developing a game, I decided to have these various factors (heat, sun exposure, thirst, hunger) combine to create a health measure which decreases over time unless steps are taken to increase it (like find artificial cooling or drink some water). The health level is calculated for each passage (to indicate the passage of time). The lower the health measure is, the higher the likelihood of a negative impact when there is more than one possible outcome from an encounter. For example, if someone is lying in wait to attack the player, the possibility of being surprised by the attacker increases as the health measure decreases.

Puzzles

One thing that intrigues me about interactive fiction are good puzzles as part of the story and one thing that frustrates me are extraneous puzzles that don't advance the story line in any way. One of the challenges of Trapped in Tucson (I hope) is finding out how to survive, and possibly even thrive, in the dystopic Tucson of the future. But I also want to have some mini-challenges that will take the form of puzzles. The challenge will be to make them interesting and challenging without being frustrating.

I'm also thinking that events that happen to the protagonist should have an element of randomness to them, so that there is some replay value to the game even if the player follows the same path. This will be a bit challenging, but I think it will be worth it.

Outcomes and lessons

Spoiler Alert There are some potential solutions to the climate crisis we find ourselves in and some dangers of not dealing with the issues. Outcomes in the game illustrate some of these solutions and issues. They are also intended to provide insight into some of the current science on the issues.

The following are outcomes in the game and the reason I included them.

Negative outcomes

There are a lot of bad things that can happen to the player in this future dystopic Tucson. Here are some of them.

  • Death from excessive heat exposure: The most deadly natural disaster in the United States is excessive heat. This will only get worse in the future if we stay on our current path. In the game, this outcome can occur when you can't find shelter from the heat. Before succumbing to the heat, you will start to notice physical and mental effects. This outcome is determined by the exposure variables.
  • Death from thirst: A human can survive much longer without food than without water - especially in hot, dry environments. Before succumbing to thirst, the player will start to notice physical and mental effects. This outcome is determined by the exposure variables.
  • Death from starvation: While a healthy human can live for an extended period of time without food, that time is reduced with exertion and exposure to environmental factors that demand greater calorie input. Prior to succumbing to hunger, the player will start to notice physical and mental effects. This outcome is determined by the exposure variables.
  • Death from violence: A threat in a city that has largely been abandoned is a breakdown in law-and-order and in established societal norms. There are situations where the player could be killed by hostile NPCs for a number of reasons - protecting their own property, trying to take the player's property, or outright hostility. The chance of being killed in a violent altercation can increase with increased exposure (decreased health).
  • Death by accident: In a city where the infrastructure is not being actively maintained, there is a risk of injury or death from falls or crushing injuries from structural failures.
  • Death by wild animal attack: While a hotter future city will have less wildlife that can survive the harsh conditions, there will be some hardy animals that can survive or even thrive. Some of these will be dangerous - either an immediate threat, like a mountain lion or a pack of coyotes, or a lingering threat, like snakebite or venomous spiders.
  • Death by natural disaster: Tucson is expected to be hotter and drier in the future but that doesn't mean there won't still be the possibility of severe storms - which could have high winds that down structures or trees, lightning storms that could cause electrocution or fires, or flash flooding in riverbeds and washes.

Positive outcomes

Not every outcome in the game is negative. The player can discover some positive outcomes that illustrate possible adaptation strategies and positive aspects of human nature, especially when working together as a community. Here are a few that will be discoverable in the game.

  • Self-sufficient maker community: Inspired by Tucson maker spaces like Xerocraft, this outcome envisions the player discovering a community of makers who have found a way to build a thriving community within the extreme conditions of a future Tucson. Some possible homebrew solutions are large-scale rainwater storage to take advantage of storms, localized power generation and storage, distributed computing and networking resources, vertical farming and aquaculture, and possibly others. This could also be an opportunity to delve into the gift economy as an alternative economic system. This outcome was also inspired by Cory Doctorow's Makers.
  • Permaculture community: Based on the lessons learned about desert-adapted food systems, this outcome imagines a community living within the Sonoran Desert living agricultural museum, Mission Garden. Relying on harvested rainwater and desert-adapted crops, this community is able to thrive within the walls of the reconstructed Mission San Agustin gardens.
  • High-tech hermit: A largely empty Tucson with infrastructure that could be used to advantage with the right resources could conceivably be the location of a high-tech self-sufficient home for a wealthy resident who desires isolation. There are certainly other examples in Arizona of this phenomena, like the archetypal Arcosanti or the more recent Desert Nomad House.