Sunday, January 27, 2019 - 12:00 AM
First-person cooking simulator
Home Cooked is a game I worked on with 6 other developers over 48 hours for the 2019 Global Game Jam. The theme for this year's jam was "What home means to you", and we settled on "a home cooked meal" as our creative direction for the game.
The game is all about cooking a delcious meal for hungry Billy. He'll eat anything you put on his plate, even an entire uncooked chicken! You only get points for the cooked parts though, so make sure you cook all the meat!
There is also a cutting board where you can chop up veggies to add to the meal. Each chopped piece gives you an extra point, so add as many as you can!
I took charge of the frying pan mini game. My inspiration was the frying minigame in the latest Mario Party game. This required me to implement some custom physics constraints, as Unity's built in physics and physical materials system didn't work the way I wanted it to. My solution involved a sort of invisible pendulum system to determine the position of the food item based on gravity, which I then combined with a simple spherical interpolation ("Slerp") on the food item rigidbodies to create the greasy pan effect.
To cook the different sides of the meat items, I created a pair of custom shaders. One shader takes as input a "decal map", which is a black and white sprite sheet (sequence of images combined into one large file). This shader takes as input the list of cooked sides, uses those to calculate UV offsets into the sprite sheet and the generates a compound decal map. The map is then used as an input texture in another shader which simply combines a cooked/uncooked version of the food texture based on that decal map. This made it very easy to add new food items, as all the artist needed to create was two textures (cooked/uncooked) and one decal map spritesheet.
The result seems to work pretty good. Unfortunately, the final build of the game we submitted has a bug we didn't catch in time where the surrounding kitchen geometry interferes with the pendulum's raycasts, so the mechanics can feel jittery. The video below shows the smooth version with no surrounding geometry.
One simple way to improve the mechanics would be to simulate friction and apply delta forces rather than a simple slerp. Doing this would add some realism, and make the food items feel heavier.
Another improvement could be to create a custom flipping animation. I don't necessarily mean a keyframed animation, but something that is controlled by more than just the physics simulation. Currently, tossing the food into the air with right-click works (more or less), but is very difficult to control the angular velocity of the food as it goes up. For the sake of gameplay, it would be better if this mechanic could behave more reliably, even if it sacrifices realism. This change would require a lot of trial and error and play testing to implement, but I think it'd be worth the effort in improving the overall experience.
Another idea is to change the geometry of the frying pan. The model in the mario party game has a much deeper center, which makes a big difference to the physics. Due to time constraints, I didn't really get a chance to experiment with different frying pan geometries, but that is something that could lead to some significant improvements.
Experimenting with different food shapes could also be interesting. The mario party game only has one food item shaped like a cube, but ours has a couple of different shapes. The shape of the food items make a huge difference to the difficulty of the game, so this is one obvious place to experiment. For example, creating a food item that is shaped like a pyramid or a (low poly) cylinder, could add some interesting challenges.
It might also be interesting to experiment with adding sauces to the game. For example, the tofu is small and slides around the pan very easily. An extra mechanic could be to have some sauce particles floating around the pan, so the player has to try to slide the food over the sauce to absorb it. This could add some depth to the game as the player could try experimenting with different sauce combinations to create different flavors.
Something that a lot of players naturally asked when playing the game at the jam was "can you burn the food?". The answer to that question is no, but it is something I considered adding while making it. The reason I decided not to was that I figured it'd be more frustrating than fun, and the fact that the mario party game doesn't let you burn the food either kind of supported my theory (since Nintendo knows what they're doing!). However, I think this is only true for the cube item which is very difficult to cook evenly on all sides. With the other two-sided food items, it is very easy to flip them and therefore it might make more sense to add a burning mechanic. This could go together with a cooking temperature mechanic, so that items can be cooked rare, medium, well done, etc.
© Alejandro Ramallo 2022