← Back

Metroidvania engine

Metroidvania engine is an engine I made together with 2 other programmers during my second year at Breda university of applied sciences. I worked on this project as an engine programmer while the other 2 worked as gameplay and graphics programmers.

Quick summary of my work:
* the general structure of the engine
* real time level editing
* Collision
* Audio
* Making it portable to Nintendo switch

General Structure:

The general structure of this engine is inspired and very similar to Unity's structure. You Can derive from a base scene class to create levels and objects in the scene are compromised of components.

the scene itself keeps track of the objects in the level, makes sure they are rendered, and contains the physics manager which is mainly used for collisions

Game objects by default have a Transform to keep track of their location in the scene, A rendering component to visually show them on the screen, and a physics component so they have collision (which can be turned of to improve performance).

Real Time level editing:

As a level editor I decided to use LDtk because it gave us a big variety of features to use specifically for metroidvania's, like having different layers in the same level to split enemies, players, and background.

I also choose it because I found an easy to use Library that helps Read the JSON file LDtk generates, this was made by A person called Madour.

With these 2 tools I was able to easily read the information on the JSON file and load the level even during runtime. To Improve performance I made it so you can turn real-time editing on or off in the settings menu.

Collision:

For collision I used AABB collision because it is one of the quickest ways to test for collision and beforehand it was already decided that everything in the game would be squares.

To make it easy for anyone to check for collisions I made 2 functions.
-"Check for collision checks" if the object it currently colliding with another object
-"Box collision check" checks if there is an object within a certain area

Audio:

For audio I decided to use FMOD this made it very easy for developers to play sound in the levels like below.

Portable to Switch:

Sadly enough because of the NDA, I can not show too much, but I made sure to keep the project portable by making everything that needed to be accessed into variables that can be used on both platforms using IfDev's and platform-specific files.