A very confusing puzzle game I made in Unity
Tags: showdev, unity3d, gamedev, devjournal
Published: 2021-10-18 16:57:26

If you liked what you read feel free to connect with me on [linkedin](https://www.linkedin.com/in/albert-bennett/) or follow me on dev.to :)
Here is a link to where you can download the game: https://play.google.com/store/apps/details?id=com.MindOfBobGames.ThePenteract&gl=IE
<br/>
### **Introduction**
My career started in the mobile games dev industry. It is where I had spent the first few years of my career, as such I made a few games in my time...
Most of what I had created was POCs to see if the core gameplay mechanics would work out. One of these POCs was The Penteract.<br/>
### **History of the Project**
Before the game was released on to the Google Play Store it was sitting in a folder on my laptop for several years. The original POC for this game was built but, apart from that there wasn't anything else to it. I had a general idea for where I wanted it to go and what I had wanted to do with. Finally last year I got around to finishing it off to a point where I could be proud of what I had done.<br/>
### **Concept**
The initial idea behind it was a 3D puzzle game that has the player trapped inside of a box where they had to make there way to the center of said box. The player's goal is to solve puzzles on the doors leading to other coloured rooms with different symbols on the walls. The aim of the game was for the player to reach the center of the Penteract before it collapsed in on itself. The problems that I had run into was all around planning the mechanics around the concept and how to display them.<br/>
### **Development Issues**
Conceptually it seems simple however, its implementation was not. I had many issues with implementing the original concept mostly around how to make it fun and rewarding to players. I could have changed the concept but the main benefit that I could see from this approach is that the puzzles could be made using a tool, allowing me to add 1,000s of different variations on the main set of puzzles also having only a few models to UV map and animate was a huge bonus. Below I've gone into greater detail of these issues.
#### **Problem 1: Atmosphere**
With the restrictions in place that being a limited number of assets being present in the game, I felt that the atmosphere needed to be on point. I wrote a short story for what The Penteract was, taking inspiration from the physics concept of 5 dimensional space. I felt that it was a strong theme to set the game in a dark SIFY world as well. Where the device was a 5 dimensional cube, in which the occupants can go through time and space. This also could be used to explain why some puzzles and cube configuration can repeat as well as solving the limited assets problem. 
![Main menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wcncmrwznt21c2yjqspm.png) 
For the rooms I had to used various bright colours, so the colour palette was quite broad except for the door panels. These were all grey to stand again some of the brighter coloured rooms they had been animated using a render target so that when the lights would flicker they would still show up so that the player would still know where they were.
![Sample room from The Penteract](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glerglf86hxo25qzp5fm.png) 
Music was another key part of the atmosphere, this done quite simply using AI because I can't make music :( and also it was a huge time saver for me. The service that I had used has now been discontinued but I believe that https://soundraw.io is fairly close to what I had used. I focused on slower beats with a SIFY twang to them.<br/>
#### **Problem 2: Making the game fun**
With the main pieces in place for the atmosphere the gameplay aspects fell into place.
Firstly if the player could solve puzzles to make it to the center of the Penteract then where does the challenge come in to it, would it all not be the same number of puzzles to get to the center. Sure I could have used a random number of puzzles to solve the issue but that felt like a cheap way of solving the problem. Instead I decided to do something much more convoluted. The puzzle system itself is simple, the colours and symbols on the walls dictate the number of points allocated to that particular puzzle. The rooms are designed so that in each room:
- Two doors give no points and don't change the state of the Penteract.
- One room grants the user the highest number of points thus bringing them closer to winning
- One room gives the user a small number of points again progressing their win condition
- Two rooms that help to breakdown the Penteract in either minor or major ways.

To limit player frustration the breakdown of the Penteract is done in levels from a little broken where 20% of all doors that give the player <1 point can open to a broken room to flashing lights and timers restriction on puzzles. I really like the timer restrictions, and I animated the puzzles to look like a clock counting down using rectangles. I feel like the timer restrictions really help to add pressure to the player where the broken rooms helps the player to choose the more correct options.
The one real issue I had and still have is that to facilitate all of this the way the player can figure out which doors can help progress their game state is very convoluted as I needed to use colours to show the player that the rooms they were going into was different from each other. In the end I also placed a set of randomly flashing patterns above a puzzle to help but... it didn't help. I'd go into how the actually system and how the combinations fit together but, the code has been lost. It is also why the images in the blog post are all from the store page. 
<br/>
#### **Problem 3: The puzzles**
It worth noting that there are two types of puzzles in the game intrinsic (door puzzles) and extrinsic (room layouts).
The Penteract is a mobile game as such I needed the intrinsic  puzzles suited to touch controls that can have many, many variations whilst still maintaining the same format and also can be very recognizable to the player especially as the player could be put under a little pressure. So right of the bat complex puzzles were gone.
So I thought of a series of short puzzles that most people could do in quick succession: mostly either word, math or pattern based puzzles. I had recently played some mobile games that used a combination of them to compete with other players, so why not...
The variations of the puzzles come by means of pre generating them using a WPF application that exports out a JSON file where each object in the file defines another variation of the puzzle. The way the game makes use of these files is by randomly selecting a puzzle format checking the difficulty of the game and then randomly selecting a puzzle in the file. In the game I think there is about 7,000 different variations of the set of puzzles.
![Timer puzzle](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3xu1x1peus3p9zwqomh3.png)<br/>
Apart from these issues the rest of the game was fine, I mean programmatically speaking there isn't much complicated about it.

Thanks for reading all about a game I had siting in a folder that I finished last year and the challenges that I had faced when completing it. I thought that it might good for me to share some of my experiences in the games dev world, I rarely talk about it nowadays. I'm not sure if I'd return to it though but maybe, if the right idea/ project came along...