For my first prototype I was tasked with creating my own rendition of a ‘Cookie Clicker’ game. An idle game that only requires the clicking of buttons in order to score the highest number you can with zero fail state. Rather than going with the standard theme of food I decided to incorporate my own interest of medieval fantasy into the project. Following this theme, I found it suitable that instead of the player acting as a baker they could act as a blacksmith instead – forging clicks with an anvil rather than cooking.
Early Stages
The first step I took was laying out the foundations such as placing the main button which will be the primary source of clicks and then the counter which informs the player of their current total. The way I did this was by using Unity’s basic button and text assets as my own assets can come later down the line. All of which is shown in the image below:
Now I’d placed the assets which will be the core pieces to the puzzle, it was then time to create scripts that actually make the cogs turn. And so, I created a folder that would strictly contains the scripts that are going to be using purely for organisational purposes. Using the material provided to assist me in scripting I eventually wrapped up all the lines of code I needed and applied it to the button, this included code that was needed in order for the text counter to work in unison with button so I struck two birds with one stone. A visual of this code is shown below:
Building Up
After completing the core part of the game it came to my attention that is was quite boring and offered no other purpose that to tire out your fingers to watch a number go up. So I once again paid attention to the material I was given and saw it was time to implement my first upgrade. This began with adding yet another button, however it had to be less prominent than the main one to avoid confusion and so I made it smaller with the label: ‘UPGRADE’. This will just be a placeholder until the implementation of my assets in future. Shown below is a visual:
A button doesn’t do much without a script, this meant I created yet another script in my allocated folder and opened it up in Visual Studio in order to begin stringing together lines of code to give my upgrade button a purpose. The whole point of this upgrade is to increase the amount of score rewarded to the player when clicking the primary ‘Forge!’ button, though it comes at a cost which will rise whilst mirroring the amount which will be rewarded. For example if a player spends 20 clicks to get 1 extra click, they can pay 40 next time to get an extra 2 clicks and so on. Sticking by my theme, I labelled this as a “Furnace” to withhold that sense of roleplaying; with more furnaces yielding better output. A visual of this code is displayed below:
Polishing things Up
After I’d integrated my upgrade button and squashed any issues I was having, such as minor misspelling, there was yet another addition ready to made. Considering you have to manually earn the clicks, it defeats the point of an idle game as you’re actively working for little reward. And so the concept of an automatic clickforger comes into the mix in which I yet again sought out from the material handed to me. The way it works is that the player can spend their clicks on what I’ve labelled as a ‘Blacksmith’s Apprentice’, which will automatically add to their total without them even touching a button similar to an apprentice helping the player out. Just like the Furnace, the amount it will tick up by will increase with each increment of clicks spent. This gives the player a choice between either upgrade and reach a substantial amount of clicks very quickly. Shown below is the complete button display:
As always it comes back to the point that a button can’t do anything alone, but this time it’s different. This is because two scripts are needed for this one, one to purchase the upgrade and another that allows the upgrade to even function. This is where I ran into a few issues where the upgrade was either not purchasing, the number went up unprovoked as soon as I started up the game and even just it not working what so ever. Once I’d overcome the frustrating obstacles the work had paid off and I at last had the relief of all the cogs turning correctly. Shown below of examples of each script of code:
In Conclusion
The main goal of this project has been reached, that being that it’s a working prototype. However it’s still within my interests to implement my own assets to give it the character it needs in order to further immerse the player into their role of being a Blacksmith and give it a lot less of a bland look. Regardless of this, I have learned a lot about Unity’s basics and scripting with C# and can confidently say this practise will help me with future projects.
Additonal Content
After finishing the basic prototype I immediately turned to Illustrator to create my UI buttons to make the game more visually pleasing thus creating the logo, anvil, furnace, apprentice and even the cursor. After the fact I then used FMOD to add sound and actual feel to each of the buttons, aswell as a bit of a soundtrack to pair well with it.
A Playable Version of Clickforge: https://sirdoormat.itch.io/click-forge