Feature Study

Breath of the Wild Cooking in Unreal Engine 4

I chose to reacreate the Breath of the Wild cooking mechanic as a personal project. Over the course of 5 weeks I planned, researched and developed this mechanic in Unreal Engine 4.

In Breath of the Wild, The player is able to loot food items and later place them in their hands, up to 5 objects at a time. If these items are brought to a cooking pot with a fire under it they can be combined into various foods. Depending on what is put into the cooking pot a different meal is made, although usually the only difference is the name, sprite and potentially a prefix.

I am not recreating the inventory portion of the mechanic, as it's not needed . When an item is picked up from the ground it immediately goes to the "held" state. 

STEP 1: PICKING UP FOOD OBJECTS

Before this project started I had had very limited experience with Unreal, meaning that the whole process would be a learning experience. Thankfully there is plenty of documentation and "getting started" resources available letting me get going and move forward at a good pace.

After the first week I created a first draft of the food and carrying mechanic, allowing the player to see two types of food and be able to pick them up. Seeing as how I had recreated the Bone Socket system from unreal in two engines so far I had a pretty good idea of how it worked and used it to display what items the player had picked up.

STEP 2: DIFFERENT TYPES OF FOOD & ADAPTIVE RECIPES

From the second week the project really took off, because I really started to get the hang of UE4. The food is at this point now all derived from a base blueprint and can be configured individually. This means that any amount of additional food types could be created easily and small variations on the food is also possible to implement. So far I have decided to add Meat, Fish, Vegetables, Fruit, Grain and Spice as the available food categories. There is only one generic food cube object for each category but since all variations would function the same this is sufficient for now.

The next goal was to creating a cooking pot/table that the player can bring ingredients to and turn those ingredients into food. I had started getting used to Unreal Engine at this point so this went along very smoothly and I kept slightly ahead of schedule for the rest of the week.

Finally I put in a lot of effort and brain power to think up a neat system to determine what kind of food is produced at the table. I managed to emulate the system from Breath of the Wild faithfully.

The final task for the second week was to create a system that produced a specific meal based on the ingredients. I researched how Breath of the Wild behaved, and found that it has a system of priority. The priority I created to emulate that system is as follows:

Complete Recipe -> Meat -> Fish -> Fruit -> Vegetable -> Grain

It starts by counting how many of each ingredient is used, then it checks if there are any complete recipes that correspond to that combination. In the top picture on the right a recipe calling for two pieces of Meat, two of Vegetable and one of Fruit is used and produces a dish named Meatballs with Mashed Potatoes and Fruit Jelly. The picture below it is 2 Meat which simply produces a Meat Skewer.

In Breath of the Wild, the cooking mechanic prioritizes one food over the other, and ignores all other additions (it adds their HP restore number to the final sum but it does not change what kind of dish is produced). For example one Meat and one Apple would produce a Meat Skewer.

I added 14 different recipes in the various categories.

STEP 3: STATUS EFFECTS & MEAL PREFIX

Next step was adding many foods with status effects. In Breath of the Wild many of the different base foods grant beneficial status effects when used in meals. When used, these base foods also add a prefix to the recipe name to indicate that the dish has a property.

I added Mighty Dragonfruit(Damage), Extra Chewy Meat(Toughness), Conductive Rice(Electric resistance), Cool Salmon(Heat resistance) and Chili(Cold resistance)

In Breath of the Wild combining two different types of status effect foods negates both effects. However, since there are no monster parts featured in my project the easiest way to display the "Dubious food" function was to make food that had its status effects negated turn dubious.

Adding several of the same type of status effect food to a dish increases its potency and adds another prefix (Very for 3  or Super for 5) in addition to increasing the time the effect would last.

Food from the spice category now also serves to increase the time an effect would last.

I also took the time to add a cooking animation to juice up the act a little.

FINAL STEP: ANIMATION VARIATIONS & LOADING RECIPES FROM FILE

If you fail the cooking and produce Dubious Food, an animation displaying buzzing flies plays around the food. I created this animation using the Niagara System editor.

When you succeed in cooking there is a 10% chance to critically succeed, causing the food to be of +50% better quality and playing a bigger success animation.

Because I learned Unreal Engine a lot faster than I thought I found a bit of extra time. I wanted to create an editor that would allow a designer to create the recipes that the game would use. Unfortunately I didn't have enough time to create that, so I settled for making the game able to load recipes from a file. This file could in theory be created in an editor, so if this project would have continued I could have easily made a tool. If I were to have these files edited manually, or if I wanted to future proof, I would've upgraded the load process to be able to read a missing type as false. This would ensure that future types could be added and past recipes still work, as well as make the recipes much easier to read and write in the JSON file.

The loading of recipes maintains the priority mentioned above. 

 Final Words

Cooking Minigames are very special to me and I am grateful to get to work with it for a longer time! This project was honestly a blast and I have learned a lot from it. I picked up Unreal Engine C++ much faster than I thought I would and now consider myself moderately proficient! This let me get ahead in my planning enough to squeeze some features in I didn't think I'd have time for!

All in all I consider this project a huge success. I am glad that my project supervisor was equally excited about it as me, it gave me a lot of motivation and inspiration!