This page is out of date
You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't
been updated in over 5 years, and much of the information here is
very out of date.
We've kept it because some of it is of historic interest, but all the
information relevant to modern versions of Ren'Py has been moved elsewhere.
Some places to look are:
Please do not create new links to this page.
Tile Engine for Tile-Based Maps and Unit Engine for Turn-Based Games
The Tile Engine and Unit Engine are extensions, written by Chronoluminaire, for adding isometric or square-grid tile-based maps into Ren'Py.
Contents
Where can I get them?
- The demo games can be downloaded here: Windows , Linux, or Mac, or download the Ren'Py 6.6.1 game directory. This includes v1.0 of the Tile Engine and Unit Engine, as well as four extensive demos that show what's possible and how to do it, as well as providing a number of sample isometric and square tiles. (Note that the performance will be very bad if you try to use the game directory in versions of Ren'Py earlier than 6.6.1.)
- The Tile Engine file on its own can be downloaded here.
- The Unit Engine file on its own can be downloaded here.
What are they?
The TileEngine is a Ren'Py object you can use to represent and display a map that's built out of tiles. It'll do the following:
- Display your map from either an isometric view or a square-grid view
- Let the user scroll around the map with keyboard or mouse, optionally displaying a cursor sprite
- Display sprites on top of the map, given their grid co-ordinates.
- Provide functions for converting screen co-ordinates to or from grid co-ordinates, respective to your chosen view (isometric or square-grid).
The UnitEngine is a Ren'Py object that builds on top of the TileEngine, providing a lot more infrastructure for games that want to move units around the map, especially in a turn-based way. It lets you do the following:
- Define Unit objects, which are Sprites with a bunch of extra properties.
- Let the player move Units around the map by clicking or by keyboard control.
- Calculate which squares the unit can reach within its allocated Movement or Action Points, with capability for different units having different costs to move through different types of terrain.
- Calculate the route and do the movement step by step when you or the player move a unit to a given square. If you supply animations for the unit moving in each of the eight directions, it'll use them.
- Let the player select Actions that units can take, from a list you supply - for example, attacking or healing other units, or perhaps transforming the map square they're on.
The UnitEngine works either with "Movement Points" or "Action Points", and you specify which one you want to use when you create it. In the Movement Points (MP) system, each unit gets to move a certain number of spaces per turn, and also gets a specified number of actions per turn (usually 1). In the Action Points (AP) system, movement and action both come from the same allocation of Action Points each turn.
It has a Callback system so that your own Ren'Py code can be executed whenever the user selects a unit, moves a unit, or takes an action.
Restrictions:
Known bugs
- AP mode doesn't yet work properly. Only MP mode is fully implemented.
- Scrolling is currently jerky.
- If you return to the main menu from the UnitEngine, any overlays will still be displayed once you start a new game.
Features for a possible later version
- In Version 1 of the TileEngine, there's no 3D, either layers or heightmaps. You can give each square a "Height" property if you want, and have your custom code do special things to it, but the engine won't do anything to it unless you override some methods. Version 2 may have layer-style 3D.
- There's no way to rotate the view. That's possible for Version 2.
- The performance isn't great. I plan to write a custom displayable to handle the tiles, which will fix both this and the jerky scrolling mentioned above.
- Animating units is fiddly, and animating tiles currently isn't possible. I plan to fix this for Version 2.
General
- I'm afraid that to use the TileEngine or UnitEngine, you're going to have to do a little programming. Not much, but your game's script will have to be more complicated than a simple Ren'Py game. We've tried to explain things gently here, and Chronoluminaire will be happy to answer questions in the Ren'Py forum. But this is just a warning that the TileEngine and UnitEngine won't completely do every line of programming for your tile-based map: you'll have to do a little bit yourself.