project thumbnail of Modular Combat State Machine

Row

The ocean is not big enough for two captains. Outlast the other player by throwing fishes to sink their boats or smack them with your oar.

Made for a 48-hour game-jam (Global Game Jam 2024). As the main programmer I coded the 2D physics, player control, game state logic. Game Jam version available on itch.io, linked below.

Features

2D physics

We wanted this game to have some silly physics: a barely floating boat, a oar that is too heavy to swing sometime, and some silly looking fishes. Most of the physics were using unity's 2D physics, but also some custom modification.

The oar moving the boat was the part that went through the most tweak, the custom calculation translate the oar's movement to a force which moves the boat in a way that looks natural.

The oar was done as a joint rigidbody to the player. This also went through various tweaks. We wanted it to be a double edge sword, when it is extended it moves the boat faster and has better reach, but also it shifts the player's center of mass so much that a big moves make it looks like the player is going to fall over.

The player is also an joint rigidbody connected to the boat. I had to do some hacks to make the player try to stay upright while still looking like a physics object.

Fish AI

The fish swims across the ocean from one side to the other. But it can be thrown around, out of the water, and sometimes off the map to Narnia. Made a simple way AI that goes to specific waypoints, so that even if its AI is interrupted by the player it can still resume afterwards.

Also made object pools for the fishes. Memory management is always good practice no matter the scope 👍

The wiggle animation is done with a simple 3D animation by me. (#TechArt)

Enemy AI

I made the character controller that it can take either player 1 input, player 2 input or from an AI. We didn't have time to make it too complex so I made it to row left for a long random duration, then row right for a shorter random duration.

But as it turned out, that was enough to defeat 80% of the players who tried the game… We got complains that the AI was too hard… Sometime I'm scared by my own creations…

Game State Logic

The win lose conditions. I wrote all that, not much more to say.