Debug Tools

Home / Uncategorized / Debug Tools

Twelve Minutes content has grown quite a bit over the last year, and since everything is interconnected, every time I do a major change, playtesting takes longer and longer.
It also regularly happens that friends that are playing the prototype run into bugs, or strange behaviors, and are unable to tell me what exactly happened.
These and other smaller issues made me realize it was time to take the debugging tools to the next level!
It  has been a fun and  extremely rewarding task. It not only sped up my workflow but it made me aware of even deeper issues that I would have missed otherwise.

Due to my limited time on this project, I only put the effort on something that clearly brings value to the game and this means that if I can get away with a rough version of it, I will.
The debug tools of Twelve Minutes have grown this way, little pieces of code here and there to help test specific issues, but now I have enough tools that it was time to make a proper thing out of it. (I also wanted to get my hands on the Unity Editor windows so this felt like the perfect opportunity).
I merged all these different tools into 3 custom panels described below.

The first, called Debug Menu (picture above) allows me to load/save game profiles, quickly select any actor or force an actor to do a specific  ‘task’ (e.g. prepare dinner, read in living room).
It also allows me to give the player any item available in the house immediately.
My favorite part though, is the ‘bookmark’ section (collapsed in the picture due to spoilers) that allows me to go to a tailored specific point in the gameplay (e.g. player has done X and X, wife is doing Y after having done Z, etc)  so I can test a complex situation that would only happen 4 or 5 hours into the game.
I should also point out that the world itself is also an ‘actor’ so any environment moments that might happen can also be triggered earlier than needed.

The second panel is called Actor Knowledge and allows me to load/unload any knowledge for any of the characters. For example, I can decided that the wife is pissed off about something, or that the player knows about a specific event. This is specially useful in debugging conversation trees, allowing me to try several variations in a short amount of time, going back and forth on what each actor knows.

Finally, the third panel called Actor Properties, displays the shared properties of all actors. Stuff like who they can see or not, what room they are in, the amount of damage, if they are tired, scared, thirsty, busy or any other global property.
Each character also has a set of unique properties that are grouped here, but unfortunately I can’t show an example that wouldn’t be a spoiler! (Same reason why I can’t really show screenshots of these panels).



In-game shortcuts

Then I have a set of ingame shortcuts assigned to different key combinations. Stuff like making time go faster so I don’t have to wait for something, or time go slow so I can see what is going on. I can also snap actors to any point in the house immediately  (sometimes with hilarious results), or I can take over the NPCs state machine and control them just like if they were the player. This helps me fix unique scenarios like, what happens if “two characters try to sit down on the same spot at the exact same time.” or “everyone tries to open and close the same door”. (Doors are a nightmare, they deserve their own post once I’m done with them.)

An interesting aspect of these tools is that they allow me to reflect on the gameplay elements. For example, if I often speed up the time because a certain puzzle takes too long, doesn’t that mean the player will feel the same?
Several times this has allowed me to find a new way to solve an issue, or remove it completely so it flows better. The last thing I want is frustration or drawn out repetition that wastes the player’s time.


Player Log

As I mentioned at the beginning, one of issues I run into, is having someone playing the game, tell me about an issue they ran into, and me not being able to reproduce it.
It’s usually hard for them to tell me the precise steps they did to make it happen, and since its all a time loop….it’s very easy to get confused.
To remedy this, early in the project I setup a system that writes a log file on each playthrough. It logs any action you or the NPC does and I can read it like a ‘story’ of what happened. It reads something like this:

LogFile_v2Player actions in white, NPC are in green

This has proven very useful but it still doesn’t let me see WHY the NPC decided to do a certain action, only that he did that action. This means that if a NPC starts doing some nonsense, I cannot look at the log and understand what made him behave this way.
To fix this I decided to go through every single possible task and write down a custom log entry that explains why it was triggered. Kinda like this:

“NARRATIVE: Wife sees front door open and Player is away, so CloseFrontDoor()”

Just like it says, it means that the wife saw the front door was open, and since you were too far away from it, she decided to start a new task called CloseFrontDoor().

It might seem straightforward, but it’s very easy to line up a series of complex reactions from different characters at the same time and this allows me to see exactly what triggered what. Also, in case you are asking, I tried to automate this process, just like the action descriptions showed above, but the WHY is always a lot more nuanced and hard to automate. It also made me re-analyze the reason for some tasks and if they are clear or not.

I have a few more smaller tools that help me calculate the more technical stuff like (e.g. line of sight, dropping items, etc) but these are more generic implementations that most games do and not really worth mentioning.