Toadally Cool Potions
Role: Gameplay Programmer
Team Size: 9
Time Frame: 2 Weeks
Toadally Cool Potions is a relaxing potion-brewing game Created by me and 8 other team members during our first group project at FutureGames. For this project we were tasked with creating a game that fits the theme Magic of Nature and magical transformations. The game was put on exhibition at Tekniska Museet as part of the “Making Magic” exhibition. The game was played by kids around the ages of 11-15. We got a lot of important feedback and the project was a great learning experience.
The game is a 3D point-and-click game that blends 2D and 3D graphics, where you create potions to aid forest creatures in need. You earn points by completing the customers' quests by using the specific ingredients required for the potion they request. Completing quests will earn you new ingredients and recipes for different kinds of potions.
Feel free to read more or download the game on itch.io
In this project, I served as the gameplay programmer and wrote scripts for most of the level elements and point-and-click controls in our game. Since our designers and artists had just started their education and had little experience with unity, I worked closely with both groups to make sure their ideas and artwork were integrated into the levels. This involved a lot of work with prefabs and building the levels. Overall, I enjoyed collaborating with the team and helping bring their visions to life in the game.
Since the game is designed to be point-and-click and controlled entirely with the mouse, the cursor is enabled and the built-in Unity functions OnMouseDown(), OnMouseUp(), and OnMouseDrag() are used. These functions work similarly to raycasting, in that they return the first object hit by the cursor. Instead of using a player controller script, all of the functionality is directly on each object, with the relevant OnMouse function for the interaction. This allows the player to interact with objects in the game using the mouse.
In this game, the buttons, recipe book, cauldron, and ingredient spawners use the OnMouseDown() function to handle mouse clicks. For the moveable objects such as ingredients and potions, a script is used that works for both. Since the game is a point-and-click 3D game, the player needs a way to manipulate objects in the X, Y, and Z axes. To do this, the OnMouseDrag() function is used to grab an object and move it around. When holding an object, the object's X and Y positions are set to match the position of the cursor, and the Z position is set to an offset from the camera's Z position, to keep the object out of range from other objects and collisions in the level.
To release an object, the OnMouseUp() function is used. To release the object at the correct location or right amount in the Z axis, four trigger boxes are used, each with its own tag. A new raycast is created from the camera position towards the direction of the cursor, and depending on which boundary box is hit, the object is moved to the desired location.
One of the other programmers on the project created an amazing database for our ingredients, potions, and potion recipes. This was incredibly helpful for me when creating reusable scripts for potions and ingredients. Each ingredient and potion has its own index, which we assigned to each prefab according to the database. The cauldron can hold two ingredient indices at a time. When two ingredients are dropped into the cauldron and their indices are stored, the cauldron lights up and can be clicked on to start brewing the potion. The function compares the two indices to the recipe book to see what potion it creates. After a short minigame, the potion will spawn next to the cauldron, and the player can hand it over to the customer.
On the left side of the table, there is a recipe book. To add a potion to the book, the player must successfully create it. By pressing the button on the right side of the table, the player can empty the cauldron and cancel the brewing process without adding the potion to the recipe book.
In this game, the player can spawn their desired ingredient by pressing on the corresponding spawner button under the table. I created an ObjectManager class to store references to all the ingredients in the level in a list. When an ingredient is spawned, it calls the ObjectManager and adds itself to the list. The ObjectManager then checks the number of items in the list, and if there are already 20 ingredients on the board, the oldest ingredient is destroyed and removed from the list to prevent the level from becoming too cluttered.
What I learned
Working on this project was an incredible learning experience for me. I had just started my education in unity and this was my first project using the platform. With my limited knowledge and the tight two-week deadline, I had to adopt a problem-solving mindset and learn as I went. Exploring the documentation and experimenting with different implementations was fascinating and I gained a lot of knowledge from it. This was also my first time collaborating with other developers on a game project of this scale, and it introduced me to the scrum method and the benefits of working with a diverse team.
While the project was stressful at times and required some extra effort to finish, it was an incredible experience that I really enjoyed. I'm proud of what my team and I were able to accomplish in just two weeks