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 kind of project including commercial ones

Cross-platform

Tilengine is written in portable C99, without dependencies on any OS, framework 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 compiled 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, acting as a slave renderer on any externally provided video surface

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 mixing SNES mode-7 with Sega SuperScaler system


Transparency

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


Animation engine

Tilengine has a built-in sequencer to animate sprites, tilesets and palettes


Visual effects

Many built-in retro effects: mosaic, column offset, CRT emulation...

Collision detection

Pixel accurate collision detection in sprites and tilemaps

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)

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

engine.delete()




Made with Tilengine

SMW

Thunder Force IV

Mode 7 distortion

RetroPang


For more samples, please visit Tilengine youtube channel