Skip to main content

The Engine

MD Engine uses a custom-made compiler to generate code that can then be compiled with GCC into machine code.

The game then runs using TBCE (Two Black Cats Engine) which is built on top of SGDK library.

The compiler enables the needed modules on the fly depending on the used events and engine settings.

Events to C process

When building the game, MD Engine will convert all the events into either C code or ASM code depending on the specific event.

Optimization process

When creating the final C functions from the scripts, the compiler will try to optimize the output to produce the smallest number of functions, so if you have several actors with identical events but different parameters for some of the values, the compiler will try to use a generic function with a params argument to match the needed arguments per actor.

This generates a smaller code footprint but introduces a small overhead due to parameter passing. In the vast majority of cases, this is preferred over having each actor in each scene have its own function.

Async Scripts

MD Engine has async events, these are events that start on one frame and finish some frames later.

You can check more about async scripts on the ASync Events section.

Scene Processes

Scenes follow a lifecycle of Start, Update, Exit, and Pause processes. For detailed information on each process, see Scene Processes.

Actors Depth on Scene

The order in which actors are added to a Scene reflects their current depth. You can change the depth by right-clicking and selecting Depth and the desired action.

Changing actor depth

This will also change the order in which their script functions are run.

Changing the depth during playtime won't change the function execution order though.