The summer period is coming to an end and slowly we all go back to our regular life or at least this is what we have been hoping for a couple of years. I allowed myself a few days of holiday trying not to fall into the temptation of starting Unity and Blender and taking some time to think about the best solutions to propose in the temple level. Then, as per my nature, as soon as I had some good ideas, I threw myself headlong into modelling and inserting what I had thought into the engine. So I’m going to reopen this appointment on the development of the game by telling you about the first puzzle you’ll encounter in this chapter. As I mentioned earlier, the first puzzle is based on a kind of memory game, a sequence of characters to be entered in the right order, which, when solved, will allow you to proceed to the next section. To introduce this puzzle, I started by modelling a scene representing a small cave in which our protagonist will have to interact with a panel full of buttons, each button will illuminate a symbol, and the choice of the sequence of these symbols, if inserted in the right order, will give the possibility to continue.
With the help of my trusty modelling program Blender, I created the various three-dimensional meshes, which I then cut along the correct sides to be able to represent them on a two-dimensional plane and thus have the possibility to colour them, achieving this result.
After this, I exported these objects so that they are ready to be inserted on the Unity engine, logically taking into account that it is not possible to export the whole scene in a single block, but depending on the use of a certain object, this will have to be exported separately from the rest (for example the panel has a number of buttons and each button will be a separate object, this is because when one of these buttons will be pressed, only it will have to change its position, its lighting, its material, while the rest of the buttons will have to remain unchanged). After setting on Unity the scene previously created with blender, and creating hotspots for each button, I can finally move on to the logic of the puzzle.
To do this, it is necessary to have a clear idea of how the puzzle is intended to work, to create variables, and to start with a fairly painstaking job of assigning each button press its behaviour, resulting in a sequence of instructions that will be processed when the button is pressed.
What you are looking at in the upper picture is the sequence of instructions that are executed:
-disable the button hotspot -lock the movement of the player -change the material of the button to an emissive one (so that you can see that it has been pressed) -change the position of the pressed button -execute a sound effect (the typical “click”) -Using a check, I make a check on a local variable, to see if the button pressed is the correct one, restoring the material of the button and its position in case of a wrong answer, or keeping everything and going to modify the local control variable so that it can be ready to be compared with the button that will be pressed next.
It seems quite complicated, and I admit that the first few times I tried it I had my headaches to orient myself and remember all the steps to follow, but then with practice and perseverance, I began to organize myself by following the steps noted in order to minimize the possibility of error (even if many times you make mistakes, and then sometimes you have to spend hours to find them in the middle of everything).
In any case, I think I’m lucky to have the possibility to manage the logic through this graphic interface, which helps me a lot, unlike having to write lines and lines of code of which I have no knowledge. As I said before, Adventure Creator gives me the possibility to do all this without necessarily being a programming language expert, just by replacing the written code with this window representation.
I test all the possible combinations, making mistakes several times, inserting random sequences, trying in every way to create situations that bring to light the weak points of the logic that I have devised, and most of the times I notice errors that had not been foreseen, forcing me to take up the sequence of instructions again to modify it. But at the end of the day, when everything works as it should, the satisfaction is great, and seeing the puzzle work, which a few weeks earlier was only an idea sketched on a sheet of paper, makes up for all the time spent creating it.