Tile engine
A tile engine is a computer graphics technique which generates a larger graphic from re-using a number of smaller graphics to save RAM and increase real-time rendering performance.
Basic tile map history
In the early days of video game development, proper RAM economy was a must for a successful game engine, much more so than it is today. One of the largest problems, graphics rendering performance, came down to the amount of RAM dedicated to storing graphics for the game worlds and characters, and fetching these graphics and displaying them on screen in as rapid and smooth a way as possible. An early hack which not only stored larger game worlds in less RAM, but also made use of fewer, smaller sized pieces of graphics rather than the full scale overall image was the tile map, a technique taking the stance that if you are rendering a grassy field, chances are most of that field is going to look the same anyway, hence the smart approach would be to re-use one small graphic over and over to shape the grassy field. This approach became widely used in specific game genres such as platformers and role-playing video games, and reached its peak during the 8-bit and 16-bit eras of consoles, with games such as Mega Man (NES), The Legend of Zelda: A Link to the Past (SNES) and Shining Force (Mega Drive) being prime examples of tile-based games, producing a highly recognizable look and feel.
The tile-map model was introduced by the Namco Galaxian arcade system board in 1979. The most common tile size used in video games was 8×8 pixels. A tilemap consisting of 8×8 tiles required 64 times less memory and processing time than a non-tiled framebuffer.[1]
Simple theory
The typical tile map consists of a 2-dimensional array/matrix containing references to a tile object. This tile object holds information such as the type of terrain, if it is possible to walk on it, if it causes damage to the video game character etc., as well as the identity of the graphic to be rendered whenever that tile is to be drawn. This approach allows for simple, visual map data, letting level designers create entire worlds with a simple text editor and a tile reference sheet, though most if not all accomplished tile-based games utilize dedicated world editor software and highly optimized map formats.
The tiles themselves are usually simple geometric shapes, ranging from the simple square to more complicated shapes such as hexagons or even circles in some cases. These tiles are drawn at intervals dictated by a uniform height/width, though in many cases the interval is decided by the size of the tile to be drawn.
Variations on the tile model include: separate layers to describe graphics vs. gameplay data (such as collision, damage, entities, etc.), level data using "material tiles" that are procedurally transformed into the final tile graphics, and groupings of tiles as larger-scale "supertiles" or "chunks," allowing large tiled worlds to be constructed under heavy memory constraints. Ultima 7 uses a "tile," "chunk" and "superchunk" three-layer system to construct an enormous, detailed world within the PCs of the early 1990s.
Examples of three most popular shapes:
- square tile engine – squares
- isometric (or paralax) tile engine – rhombuses
- hexagonal tile engine – hexagons