Tilengine

Tilengine is a free, cross-platform 2D graphics engine for creating classic/retro games with tilemaps, sprites and palettes. Its unique scanline-based rendering system makes raster effects a core feature, a technique used by many games running on real 2D graphics chips.

Clone on GitHub Download itch.io

Main features


Free

Tilengine is released under the permissive MIT 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 many high-level languages like C#, Python, Java, 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 snippets illustrate how easy is to use tilengine in your program. Both snippets are equivalent, one in C and the other in Python. They initialize 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.

C language

#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 ();
}

Python language

import tilengine as tln

engine = tln.Engine.create(400,240,1,0,20)
engine.set_load_path("../assets/sonic")
foreground = tln.Tilemap.fromfile("sonic_md_fg1.tmx")
engine.layers[0].setup(foreground)

window = tln.Window.create()
while window.process():
    window.draw_frame(0)

engine.delete()






Made with Tilengine

SMW

Thunder Force IV

Mode 7 distortion

RetroPang


For more samples, please visit Tilengine youtube channel