Tilengine

Tilengine is a free, open source cross-platform 2D graphics engine for creating classic/retro games with tilemaps, sprites and palettes. Its scanline-based rendering system makes raster effects a core feature, the same used on actual 2D graphics chips.

GitHub clone Itch.io download

Main features


Open source

Tilengine is released under the LGPL license, making it free for any project even commercial ones


Cross-platform

Tilengine is written in portable C99, without dependencies on any OS or third-party proprietary component.


Multiple languages

Beside its native C API, there are full bindings for other high-level languages like C#, Python, Pascal...


High performance

Tilengine is high-speed native code. All samples run at 60 fps with CRT emulation enabled on a Raspberry Pi 3.


Embedded

Tilengine can be easily embedded inside other game engines as a slave renderer on an user-provided video surface.


Easy

Tilengine has a very lean API, designed to be easy to learn but yet get impressive results with very little lines of code.

Graphical features

Raster effects

Modify rendering parameters for each scanline. This technique is used to generate visual effects

Transforms

Scale sprites, rotate and scale any layer. Like combining SNES Mode-7 with Sega SuperScaler!


Transparency

Several types of blending available for mixing, lighting or shadow effects for layers and sprites.


Animation engine

Animate sprites, tilesets and complex color cycles with Tilengine's built-in sequencer.


Visual effects

Many built-in retro effects: mosaic for SNES-like pixelation, per-column tile offset, CRT emulation...

Collision detection

Pixel accurate collision detection between sprites vs sprites and sprites vs tilemap background

Basic example

The following snippet illustrates how easy is to use Tilengine in your program. It initializes the engine at 400x240 resolution, with one background layer, no sprites and 20 animation slots. Then loads a map in Tiled TMX format, attaches it to the layer, and finally creates a display window and does a main loop until the user closes the window.

#include "Tilengine.h"

void main(void){
    TLN_Tilemap foreground;

    TLN_Init (400,240,1,0,20);
    TLN_SetLoadPath ("../assets/sonic");
    foreground = TLN_LoadTilemap ("sonic_md_fg1.tmx", NULL);
    TLN_SetLayer (0, NULL, foreground);

    int frame = 0;
    TLN_CreateWindow (NULL, 0);
    while (TLN_ProcessWindow()){
        TLN_DrawFrame (frame);
        frame += 1;
    }
    TLN_Deinit ();

Made with Tilengine

Here are some short clips of programs and samples powered by tilengine. To watch more working examples, please visit the official youtube channel.

Claasic platformer

Shoot-em up

Mode7-like distortion

RetroPang