top of page

The Random Game

A small game made in C++ in MaktusEngine (a friend's game engine) during summer 2024.

Main attributes

  • Wavebased gameplay

    • Creating a system with rounds with chosen spawned game objects.​

  • Player, enemies & boss

    • Creating a player that defeats all different kinds of enemies currently present in the round.​

  • State machine

    • Implemented on player, enemies and bosses.

Wavebased gameplay

This game is inspired by Vampire Survivors, you spawn as a player in the scene, one random pickup, and enemies. Each round you begin powerless until you pick up the pickup which gives you a random weapon to use. Some weapons are strong towards one kind of enemy, another towards another kind of enemy.

​

In the beginning we have 9 tutorial rounds, first you get the weapon that's strong towards the enemy, then you get randomly the other weapons the next rounds.

​

Each round has selected which enemies should spawn, how many, and if it's supposed to be randomized. You'll get to the next round after beating every enemy on stage.

WaveBasedGameCroped.gif
WaveBasedGame2.gif

Player, enemies & boss

PlayerCroped.gif

The sword is strong towards Goos, a goo-like monster that dashes at you.

The gun is strong towards Bats, flying monsters that also dashes at you.

The dash is strong towards Caterpillars, a stretching monster that flies arounds and attacks you once it's alerted.

Player

Both player and enemies and boss uses the same state machine.

Player picks up the random pickup, which gives a randomized weapon, either a sword, a gun, or a dash.

Weapon.gif
EnemiesAttackingPlayer.gif

Enemies

The enemies are loyal towards their own kind. They of course attack player when they're alerted. BUT...

...they attack other kinds as well. If they are harmed by others, they attack others, with the help of their friends. If one Goo was attacked by a Bat, that Goo and other Goos will counter attack that specific bat and vice versa.

EnemiesAttackingEachOther.gif
Boss.gif

Boss

Boss is using the state machine hierarchically! Each state has it's own state machine, determining what action to take.

Boss can spawn enemies, have small tree minions who can attack the player

For each state the attack with minions gets stronger, first it's just one minion attacking, second it's two, and in last state ALL minions attack player.

BossFullAttack.gif

State machine

Used everywhere!

The state machine is used on almost every game object, while in normal games that's not recommended, I felt for the scope of this game that is was possible!

​

The state machine is very general, it holds a container to a virtual State class, which includes Start(), Update(), End() and Interrupt(), counts cooldown for every state, and more!

While I don't like that you have to inherit it, I usually like to just have a pointer towards the class (or better, have a decent component system), I chose to do it here since almost every game object uses it, but haven't done it since.

​

Another thing, nowadays I usually use unique_ptr, since it's safer for avoiding memory leaks, but you always learn from projects like these!

Hierarchical state machine

The boss used a state machine in every state, so for example, in first state, boss uses a state machine that either walks (idle), spawns enemies or attacks with his treebranches.

Sprinkles on top!

Lerping background colors

Every 30 seconds the game determines a new random color to lerp towards, it happens so slowly that most play testers didn't even notice it, but I thought it was a fun plus mechanic!

ColorLerper.gif
HPPickup.gif

Pickups

I have two pickups in the game, the random pickup which gives you a randomized weapon, and the health pickup, which spawns after an enemy is killed, randomly with your HP as a percentage to the likelyhood.

Respawn after dying

If you die in a stage the game will remembers where you died, and which state was the latest you would respawn in.

Dying.gif

Win or lose?

When you defeat every enemy, UI elements will show up and say "Yay!". Same if you lose, UI will show "Boo!"

DyingShorter.gif
Winning.gif

Conclusion

The Random Game was a fun summer project! After studying school it was nice to do this project all alone, where I did everything, could prove to myself that with time and motivation I could do this!

​

There are many things I do very differently now with code. I learned so much when expanding the project, how to write more sustainable code that helps you in the future, to use unique_ptr, and that code doesn't need to be perfect to work!

​​

Boss.gif
EnemiesAttackingPlayer.gif

​I wanted to continue on this project but had an internship that was about to start, and now I want to move on to other projects. But I still look back to this project with happiness and still enjoy playing it!

 

I had several people playtesting this and got so excited when most of them liked playing it! One obvious feedback was the graphics, I'm not a graphic designer and only used paint, and it would have been wonderful working with one, but it was fun drawing as well!

bottom of page