Create a small game in Unreal Engine 4.27.2 with 2 keywords: "Capture" and "Rage".
This would be for the course "Game Mechanics"
Making sure that this game is fun enough to play.
Making the mice feel realistic.
Making the player rage enough to enjoy it.
Since we had to work around those 2 keywords, I was thinking of a game where you need to capture something before something "raging" happens.
Further thinking about this route, I came up with the idea that you are a cleanup guy trying to catch all mice in a kitchen.
If you take too long, the headchef will rage so hard that you will be fired and lose the game.
I know that the visuals will never represent this good enough, because I am not an artist and do not have enough time to put into this.
But with that concept in mind, I proposed it to my teachers, and they liked it.
Of course this concept alone is very bland, so I made it a goal to add more mechanics throughout the game when the player progresses.
This way, in level 3, the player will find mousetraps that will hold the mice for a few seconds before they can escape.
And in level 5, there are barrels that can be pushed over to block a pathway.
Of course, in level 7 you get both mechanics combined in a very big level.
Nearly everything from this project was done using blueprinting. All except the Timer/RageBar.
The Player:
The player is really simple. It just has basic movement input using 'WASD' and turns the way he's moving.
They also have an "inventory", where they can store 1 mouse trap. It's not really an inventory but more like a boolean.
When a mouse has been caught, the player has an event that triggers, this will call the Game Mode, to add some time to the timer.
This also notifies the HUD to display the "Mouse Caught" text.
The Mouse Traps:
Once again, very simple. When these are placed down, they are stuck there forever until a mouse walks over them.
If this happens, they will "trigger", they will turn red, the movement of the mouse will be disabled and a loud "snap" can be heared.
But this cheap catch isn't free, you only have a few seconds to grab the mouse. Otherwise this trap will break and the mouse is back on the run!
The Barrels:
No suprise, again very simple. When you stand aside it and press 'E', it will fall onto the ground and block the path. Trapping the mouse (or yourself).
However, this doesn't break the navmesh but spawns an invisible wall. You'll see what effect this has on the mice later on.
The RageMeter:
Did you expect this one to be easy too? Correct. This is basically just a timer that is ticking down.
If I had some more time to display the Rage element, this timer would basically work inverted and would be a meter that fills up; representing the Rage.
Yet because the core concept is the same and time constraints were high, I decided to make it just like a timer.
I first made this one in blueprint, but after that I remade it using C++.
Because this part is basically the most important concept of the gameplay, and I am really proud how I implemented it, I wanted to give it a seperate section.
To get some realistic feeling mouse behavior, I first off had to increase their speed. Basically making it impossible for the player to manually catch up to them.
This will get a bit of rage flowing to the player, possibly making them more addictive.
But this also forces the player to really think to where they move, since every seconds counts.
But when they catch a mouse, they will get a small reward of a few seconds.
So how would you handle the decision making of the mouse? Where do they go? When do they go?
To make it simple, I added an image above, showing how I handle it.
Basically the mice have a trigger sphere. Whenever the player enters this, they will start moving.
At first they would just move the oppisite way that the player is facing, but this didn't work out at all. They would constantly get themselves stuck in corners.
So to fix this, I gave them 5 possible directions to flee towards. This is also based on where the player is standing.
1 of those is straight the difference between the player and the mice, the others are basically offsets from it. Tackling multiple angles.
Whenever the player enters the radius, they would choose 1 of the 5 directions. But how do they choose the best option?
Every direction will fire off a raycast. Only checking for walls or invisible walls, like the barrels.
With all those hits, they check which had the longest distance. Because you want to avoid short distance movement since this is really slow and inefficient.
If they arrive, they will once again check if the player is in the radius, basically sending them in an infinite loop of movement if the player is close.
Doing it like this will avoid corners. Because the angles make sure that if 3 hits are in a corner, the other 2 should face out of it.
This results in very fast-paced mouse movement and is very enjoyable.
Honestly, I am pretty proud of the mouse AI.
I never thought it was going to be this fun to play around with nor even that I would get it this good.
Also didn't really have a choice but to get it good, otherwise this entire assignment was going to be a flop.
This was a fun way to experiment with the AI functions that Unreal Engine uses.
These got me confused at times and sometimes the MoveTo would just straight up not work.
But in the end, it really turned out great in my opinion.
If you want to clone this project and dive into the spaghet that is blueprints, you can find my code on my GitHub.
And if you just want to play the game and enjoy everything, feel free to download the game using the button below!
If you beat the game, the last level will just loop, so keep that in mind.
The last level isn't included in the gameplay video because we needed to stay below a certain time limit.