No More Levels Map Files

Engine Design

The NML engine is a small, compact raycasting engine that has been under development for some weeks now with the soul purpose of being a usable retro game maker. The engine was modeled after the Wolfenstein 3D engine in the methods and algorithms it uses to calculate the graphics, but takes a more modern approach when it comes to object handling and scripting. Using a basic 2D map file, and some lua scripting, the game generates everything it needs to run on the fly. No 3D models, no shaders, just a few basic scripts and a map file and the game will run.

Making Mapfiles

The map files in the NML engine are a slightly updated map file from a 2D engine I programmed several years ago. This eliminates the need to completely rewrite a file parser and map editor. After some light tweaking, the level creator and loader base was ready.

The current tile editor for the NML Engine

With this tweaked map file and editor, I could create levels as easy as drawing in Paint, and the Raycasting engine would do the rest of the work turning it into a 3D environment.

An island map in the NML Engine

As a programmer I am often worried about how things like the map file or parser look. Is it easy to tweak if needed? Is it easy to read? Well yes. Yes it is! The map file is written in chunks. It starts by writing the header data. After that, the locations of the textures. The rest of the map file is a 2D array of integers defining what tiles go where on the map.

A snip of the NML level file

Limitations of the Map File

In an effort to preserve usability and simplicity, this engine has a few hard-coded limitations. Effects are one of the main limitations. Because shaders are not quite possible when Raycasting, every effect must be hard-coded directly into the rendering routine. Therefore, any effects that are needed require a change to the engine itself.  Currently there are several effects already in the engine that can be selected by applying an effect number to tiles in the map editor. These effects include reflections, water ripple, or corruption.

Another limitation is the lack of hard-coded collisions for non-wall objects. Because the walls are drawn based on whether a tile has collisions or not, if an object is to be drawn as a sprite, floor, or ceiling tile, it cannot have collisions hard-coded through the raycasting routine. There are simple work-arounds such as programming the collisions into a game script, but this is slightly inefficient. I have been working on modifying this aspect of the level file, but in it’s current state, that limitation will stay.