Implementing the crafting system in Unsolved


In Unsolved, the player can collect clues by examining furniture around the room.  A list of clues and associated recipes is listed in the player's notebook in the top right corner, and when the player collects or crafts a clue, the icon of the clue turns green.

The clue collection was a simple boolean edited if the player pressed E when inside a trigger zone, with one boolean for each clue collected. The hard part was displaying the data on the player notebook.


The first issue I had was that my code is attached to and calls to the notebook game object in the scene. However, unless the player opens the notebook in the game, it does not exist; the notebook UI is not enabled until the icon is clicked, and furthermore, it's deleted again when the player closes it. I solved this by creating an empty game object that does exist upon loading the scene (and continues to exist even when the notebook is closed)and making the notebook and its associated buttons a child of that game object. I also moved my script from the notebook to the empty object. Overall this was a pretty easy fix that not much time was spent on.

Every clue also has an associated piece of text that plays when the player picks it up. The text that plays is a single TextMeshPro variable that changes depending on the clue. I created a Text Manager script that stored all the different player texts and changed the TextMeshPro variable. This Text Manager script called to the player movement script, which also checked for if the player was in trigger zones or not.

Every icon of a clue on the notebook is actually a Button component of the canvas. Each button is non-interactable, so the player can't click on it and cheese their way into gaining a clue without playing through the game. After picking up a clue is registered in the Text Manager script, the data is passed to a Notebook Manager script that keeps track of every button and changes the icon to have a green overlay. This wasn't super complicated as a concept, but because there are 19 buttons and each button had its own boolean value getting passed around multiple scripts, it was important to keep things organized in my head. I wrote the "ingredients" and recipes down on a piece of paper so I could constantly refer back to them. Implementing this for every button  and figuring out how to access the buttons in the script efficiently took the majority of the development time.

The small rectangular buttons under the crafted product in the notebook are gray and not interactable initially, but become green and clickable when the player gains all the required ingredients for an object. The logic for the crafting buttons in the code is similar to that of the clues, just checking if three different clue booleans were true rather than one. If this were a finished game, there would be animations when crafting the object and in fact, we did have sounds made for this scenario(as well as when the player picks up any clue) but we decided not to spend time to implement them. The crafting mechanism is arguably what would set this game apart from other detective/murder mystery games if it was a full release, so hypothetically the act of clicking the craft button would need to feel extremely rewarding to the player. The buttons do say "craft", although in small text. The text could have been made bigger at the cost of notebook space, however, I felt that it is not actually important for the player to be able to read those buttons, and the illegibility seems to go well with the pixelated scribbles that represent text on our sprites for letters and insurance papers, plus the fact that the other objects in the notebook have no text. Perhaps in the full version the buttons would have no text, only color, or have a checkmark. With how simple the crafting process is, the player couldn't mess up the crafting process as a result of being unable to read the craft buttons.  Alternatively, again with more time, we could have implemented a page turn or scroll in the notebook UI that would allow recipes to take up much more space. 

The booleans controlling all the logic are stored in a DontDestroyOnLoad script so that they will retain their value even if the scene changes. I set the scripts up like this early on because we wanted to implement some more engaging mini-games(specifically, we wanted the player to have to physically dig through the trash and click and drag discarded items out of the way to reveal clues underneath) and I thought that maybe these minigames would take place in a separate scene. Again, we chose not to spend time developing this idea, but if Unsolved was a full game we would probably put things like this in there. Other scrapped mechanics include a system that flickers the lights in the room, which is suggested to be caused by one of the suspects, a timer for crafting objects(the detective has to send and get back forensic samples from the lab), and a secret room behind the bookshelf where the player would find more clues.

Leave a comment

Log in with itch.io to leave a comment.