Custom Maps (UFO2000)

From UFOpaedia
Jump to navigation Jump to search

Getting Started

Terrain Requirements

Each UFO2000 terrain (such as Moon Base) requires 3 elements:

  • Tileset(s) (collection of tiles, which are the ground, walls and objects)
    • A tileset requires both images and code to determine their game characteristics
  • Maps (the individual blocks that form the battlescape)
  • Code for battlescape generation (written in .lua language)

UFO2000 and X-COM terrain file formats

There are 2 types of file formats for the tile and map files required.

Terrain Tileset images Tileset code Map files B. Generator code

  • The UFO2000 format, which uses .LUA and .PNG files.
  • The original X-COM format, with .MCD, .PCK, .TAB and .MAP file formats. WARNING: If using the X-COM format there are several size limitations that apply:
    • There's a maximum limit of 253 tiles usable, due to .MAP file restrictions
    • Images have to use the UFO or TFTD colors palettes and be converted to .PCK files.
  • The formats are interchangeable, i.e., a terrain can have its maps with the .MAP format while the tiles come in a .LUA and a .PNG file.
  • A tile is composed of two assigned elements: its image and physical properties on Battlescape. The images are organized into .PNG format file(s) (or .PCK/.TAB), while the code for its physical properties uses a .LUA format file (or .MCD).
  • Tiles are organized into tilesets, named after the terrain (e.g. moonbase) or the images it contains (e.g. roads, urbits, urban, frniture).
  • The battlescape code always comes in a .LUA file.

Terrain Tileset images Tileset code Map files B. Generator code
Future terrains.PNG.LUA.LUA.LUA

The Tileset and Battle Generator code can be included on the same .lua file.

Basic Terrain Concepts

  • The layout of the battlescape is composed from several maps, and a map consists of individual 3D cells, with the size of 16x16x24 pixels.
  • Each individual map 3D cell is made of tiles, which are interactive terrain items, such as walls, doors, ladders, lifts, etc.


Tiles are organized into tilesets and there are 4 types of tiles:

  • Ground (floors, roofs, lifts, etc.)
  • Left (a.k.a. West) Wall
  • Right (a.k.a. North) Wall
  • Object


  • A file with templates for the basic contour of a cell, walls and other basic figures is available on the links section here.
  • If the image is bigger than the 16x16x24 'box' determined by the dimensions mentioned before, it will overlap over the tiles around it.
  • The game engine places the images in the following sequence: ground, walls, objects. Any overlapping images from nearby cells will also follow this order.
  • When designing a tileset remember to add an additional tile with a destroyed version. This makes the map more realistic: when it gets hit by gunfire, instead of the wall (or another tile) simply disappearing, it will be replaced with a wreck (this is set on the tileset code).

Tile Properties



  • The minimal length and width of a map is 10x10 cells and the largest 60x60. The game cannot accept maps with dimensions that are not multiples of 10 (20, 30, 40...).
  • The maps can be either squared (e.g. 20x20) or rectangular (e.g. 20x10).
  • The maximum height is 16 levels.

Other requirements

  • Each terrain should contain at least 1 10x10 map, especially when the map set includes non-square maps. Otherwise UFO2000 will crash when building the battle area if there are spots that can't be filled by a map. An exception to this is when the Battlescape is composed of a single map (40x40, 50x50, 60x60).
  • In the case of maps like X-Com Base or Warehouse there must be connections on the necessary sides of the maps, otherwise these maps can become isolated.
  • The maps belonging to a terrain must all be assigned the same tilesets. The order by which they are listed must be always maintained.
  • All map and terrain files names should be all lower case, e.g. sewer00, not Sewer00.

Map Design Tips

  • It is better to assign the tiles to their proper locations (ground, walls,etc.) otherwise the map might look/act weird during gameplay.
  • The West walls that look like small pillars should be placed at the intersection of West and North walls when it points downward, otherwise it will be possible to look thru the wall into buildings (see existing maps to see what is their proper placement).
  • Concerning walls, in some maps there are outer and inner walls (especially on buildings). One example is the light blue brick (outer side) and yellow (inner side) walls on City.
  • The ground of a map's 1st level must be filled.
  • If a door is placed as a wall at a corner of a intersection of walls, when it is opened it will occupy the place of the opposing wall. If the door is closed again, the wall will disappear.
  • To help visually the players to distinguish between floor levels and to spot holes made by weapons, use different tiles for the ground of each floor.
  • You can make buildings having its parts across several maps but you will have to use specific Battlescape Generation Code for them to connect correctly. Otherwise, if the battlefield is generated randomly you will have to apply differently the principle of the XBase and Alien Base terrains: instead of all sides connecting, the maps must all have one or two sides that has a connecting part, either to form a larger structure or to serve as end to a building.
  • Large maps or buildings can look very nice and be fun to build. Unfortunately, they also can turn boring and be difficult to play very easily. The same can happen with lots of small rooms, narrow corridors, lots of objects and maps with several levels.
  • It is best to keep terrains simple, with space for units to move and easy communications between maps.

Battlescape Generation Code

Extensions Folder

  • All new terrains must be placed on the /extensions folder of UFO2000, inside its own separate subfolder.

Creating a New Terrain

Each new terrain must have its unique .LUA file, containing the following code:

AddXcomTerrain {
        Name = "terrain name",
        Author = "author name" optional field
        Tiles = {
                "$(extension)/tileset name.*"
                additional tilesets, if any
   Maps = {
       "$(extension)/map001 map file",
       additional maps, if any


AddXcomTerrain {
        Name = "Moon Base",
        Author = "nappes",
        Tiles = {
   Maps = {
  • Notice that on this case the moonbase tileset does not require $(extension) because the tileset code is included on the .LUA file that contains the Battlescape generator code.
  • A .LUA file can be created by simply copying and renaming an already existing .LUA file, then opening it with a text editor.
  • On the terrains which use UFO/TFTD the $(extension) is replaced with the location of the UFO/TFTD subfolders inside the UFO2000 folder.
  • This is the simplest code for Battlescape generation: it will choose maps randomly from those listed and create the Battlescape from them.

Advanced Battlescape Generation

Relevant Links