Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Tilengine

2D retro grapics engine with true raster effects for creating 8/16 bit style games · By megamarc

Use Cases

A topic by Pixelevator created Jan 07, 2023 Views: 308 Replies: 4
Viewing posts 1 to 3

I was a little confused when I read about this engine - it's not used for drawing, editing or mapping - so I'm wondering what use cases it's aimed at. So far I'm thinking 2D sprite scaling for mode 7 style racing games, where the engine does the calculations and outputs to a game engine like Unity or Godot without having to manually script that functionality in the game engine... ?

it's not an engine in the sense of "comes with a full editing environment" like Unity, Godot, etc. It's more like a rendering engine. You have to bring your own text editor, pixel art software, map editor, and programming language (there's Python bindings which are probably the easiest way to get started).

You can use it to faithfully make games in the style of the 16-bit era, using sprites, tilemaps with animated tiles, palette tricks and per-scanline effects (including parallax, & mode 7 like you said).

You don't have to use it with another engine, because Tilengine is also capable of spawning its own window and handling user input. (But of course you could use it with another engine if you wanted to, as long as you were able to get it rendering to a texture.)

Developer

Hi!

That's just like @exelotl explained. The library only includes the rendering engine. Assets must be authored in standard external tools, and high level gameplay mechanics must be provided by the application layer. Same for sound effects support. That's why it's called a "graphics engine" and not a "game engine".

"Mode 7" in Tilengine works very similar to how it works on a real SNES or GBA. These classic consoles require providing an affine transformation matrix whose coefficients must be computed by the game developer, in order to scale/rotate/skew the background plane. Altering this transformation matrix on each scanline, progressively varying scaling factor, creates the illusion of 3D projection. In Tilengine I eased a bit the process, as you must provide the translation, rotation and scaling factors, and the engine computes the affine matrix for you. But the working principle is the same. So you won't find a pre-made "3D projected mode-7" function, as the original SNES doesn't have it either. It's just a clever trick.

You can setup Tilengine to render to a 32-bit RGBA texture instead to a window, so you can compose its output with other engines. I know it has already been done with Unity without much effort, I don't know about Godot capabilities in this regard.

Yeah, no clue what I'm doing. Downloaded it, clicked on install, something flashed on the screen for a tenth of a second. I've got my dunce hat on, running on Windows 11. I'm used to programs like Dragonruby or Folia where you write code in any text editor you like then run a single executable to see your results.

(1 edit)

I'm not on Windows but you can try this:

1. Install Python.

2. Create a new folder for your project.
2a. Download the Win64 Tilengine release from itch, and copy Tilengine.dll into your project folder
2b. Download the PyTilengine repo as a zip file from github.com/megamarc/PyTilengine and copy src/tilengine.py to your project folder, as well as the assets folder from the examples.

3. Use a text editor to create mygame.py which contains the following code:

from tilengine import Engine, Window, Tilemap
engine = Engine.create(400, 240, 1, 0, 20)
engine.set_load_path("assets/sonic")
foreground = Tilemap.fromfile("sonic_md_fg1.tmx")
engine.layers[0].setup(foreground) 
window = Window.create()
while window.process():
    window.draw_frame()

Your folder structure should look like this:

MyProject
├── assets
│  └── sonic
│      ├── Base.png
│      ├── Base.tmx
│      ├── Base.tsx
│      ├── Sonic_md_bg1.png
│      ├── Sonic_md_bg1.tmx
│      ├── Sonic_md_bg1.tsx
│      ├── Sonic_md_fg1.png
│      ├── Sonic_md_fg1.tmx
│      ├── Sonic_md_fg1.tsx
│      └── Sonic_md_seq.sqx
├── mygame.py
├── tilengine.py
└── Tilengine.dll

4. Open a cmd.exe or powershell window in your project folder.  (here's some ways to do that in Windows, it changes all the time) and type  python3 mygame.py  and hit enter to run your game.