Undercooked | 2021

Thumbnail

Project Details

Technical

  • Engine: Unity
  • Language: C#
  • Platform: PC
  • Roles: Lead Programmer, UI Artist / Designer

  • Development

  • Duration: 3 weeks (pre-production), 6 weeks (production)
  • Release Date: December 1, 2021

  • Overview

    Gameplay

    Undercooked is a first-person wave shooter about fighting overgrown food using a range of culinary weaponry. Each wave you must fight to survive, using your microwave gun, a-salt rifle and pepper shotgun to defend yourself against the relentless hordes of strawberries, bananas and onions. Reposition to access new areas with the handy grappling hookshot and other movement skills, such as a slide and ledge mantle. After each wave, seek out the temporarily active upgrade station and refill your ammo, increase your health and damage using fibre earned from combat. All the while, charging up your magic cleaver by dealing damage and when things get dicey, throw it out at a nearby enemy to cast a devastating chaining bounce attack that restores your missing health points.

    Production

    The game was designed, developed and produced solely by a group of ten students which consisted of two programmers (myself included), four designers and four artists. This was our final assessment of the first year of the course. We met with an industry panel of experienced developers for feedback on our production planning process and early prototyping which helped us bring the scope of the project to a reasonable level for the six week production period. We kept everyone on track throughout development by holding a morning standup meeting each working day and managing ongoing tasks with a shared Hack'N'Plan board. We also used Git through the GitKraken client for version control.


    Contribution

    On this project I contributed...

  • All gameplay-related scripts
  • Animator controllers for enemy AIs
  • Multiple unique enemy AI behaviour trees utlising the Unity NavMesh system
  • Graphical UI assets created
  • UI layouts designed and developed
  • All sounds sourced and implemented
  • Creation of the Technical Design Document

  • I was also responsible for setting up and managing the Git repository and helped the rest of the team members learn how to use it and gave assistance to those who needed it when asked. I also created and set up the Unity project for the URP pipeline which we were required to use.


    About the code

    As I wrote all of the code used in the gameplay scene and some of the code used in the main menu scene, my responsibilities and contributions to the code side of the project were quite varied. As I also set the organisation standards within the Technical Design Document, I endeavoured to make the code as organised and easy to navigate as possible.

    Movement

    I started out by making the player movement, after making multiple platformers over the years I have learnt a lot about the best practices when managing acceleration and drag on a physics-based character, allowing them to feel fluent and intuitive to control. In the player's movement ability set is a slide, which gains acceleration appropriately on slopes, accompanied by a smooth crouch and sprint, a basic fixed height jump (with coyote time and input buffering) and a grappling hookshot, to allow for more vertical traversal options. I also added automatic ledge mantle to make the platforming more forgiving and some surface magnetism code to prevent slopes leading to unintended bumpiness when changing gradients.

    For the player's grapple hookshot I was inspired by Wilnyl's grappling hook rope effect, and decided to attempt to recreate it for our own grapple ability. To do this I used Desmos to model the desired sin and cos curves, then I projected them onto the rope in world space as offsets from the straight line from gun to target point, using a float timer as the input. In addition to this, there are also animation curves and other configurable properties which play into it and can be changed in the inspector to achieve the desired visual effect. Here is the end result of all that math.

    The grapple hookshot being unlocked and used in game.

    Combat

    Once the movement was completed, I moved on to the combat system, more specifically, the frameworks that would be needed to implement the 4 weapons that are featured in our game. The piercing Microwave Gun was first, then the rapid-fire A-Salt Rifle (we're hilarious), and lastly the final gun, the devastating Pepper Shotgun. Finally, I built a custom system for the player's ultimate ability and final weapon, the Magic Cleaver. All of the guns however, operate off separate instances of an identical script, which is simply tuned differently to give them distinct behaviours like bullet piercing, unlimited ammo, spread shots, and their sound and visual differences.

    I wanted to make all of the weapons use the same script for a few reasons:

    1. Reduced amount of scripting required, so I could work on developing other things for the alpha milestone.
    2. It meant there was a unified type which could be referenced to get information about a weapon (helpful for UI & upgrades).
    3. Designers could be more creative when tuning, as the weapon wasn't restricted to a certain archetype or set of characteristics.

    If you are interested, here is a copy of the script that we ended up with for the guns, and some gameplay of them in action.

    The different guns of Undercooked being used in game.

    Enemy AI

    The game's Enemy AI was created using custom behaviour trees which I designed, and the navigation was achieved using Unity's in-built NavMesh system. I started off making a base class for all enemies, which could control basic shared behaviours like taking damage, updating the health bar and despawning when out of range of the player. I continued to build on the base class as I created the child enemy classes later. Undercooked has three enemy types:

    1. A goofy banana bunch that attacks with a melee and splits into smaller, faster bananas when destroyed
    2. A tactical strawberry that fires homing seeds and repositions to be in sight of the player
    3. A tanky onion which has multiple layers of defensive armour and attacks the player with a fast charge

    Creating these enemies was certainly a new challenge for me in many ways, I didn't have much experience with creating enemy AI in 3D games beforehand but nonetheless took on the challenge as I knew it would lead to a good opportunity to improve my skills. In addition to this, I budgeted my time to allow enough room to make numerous mistakes and changes along the way when developing these enemies and this helped me learn lots and overcome the challenges that I faced in the process. Prior to this assessment I had experience with writing the A* algorithm from scratch and that helped me understand all that was going on in Unity whenever I encountered an issue with the NavMesh. To facilitate enemies of different sizes in such an relatively expansive environment, I opted to use the new Unity NavMesh Components package, which allows multiple different NavMesh surfaces to be baked for different agent types. The final set of NavMesh surfaces are shown on our map below.

    NavMesh Surfaces in Undercooked

    The NavMesh surfaces which enemies use to navigate the environment of Undercooked.


    Thank you for reading!

    Feel free to check out the store page for the game on Itch.io or simply return to the home page.