How To Make Tilesets

From OPU Wiki

So you want to make a new tileset for OP2? This article will teach you how.

Table of contents

Tools you Need

  • Outpost 2, v1.3.3 or later (1.3.3+ has enhanced support for game modding, which you need in order to create tilesets)
  • OP2Mapper, v2.1.2 or later (2.1.2 supports VOL editing within the program directly, as well as the tilesets.ctl file described below)
  • The image editor / tools you will be using to create and assemble your tilesets. (Paint Shop Pro, Photoshop, or any other editor supporting BMP works great for new tilesets. If you are importing a set from another game, you'll need proper tools to convert the tilesets to BMP format).
  • Any plain text editor, Notepad works great.
  • Lots of time and patience =)

Getting started

An OP2 tileset is nothing more than a series of 32x32 tiles arranged in a vertical column, in a BMP file. If you can create a column of 32x32 bitmaps arranged in one vertical filmstrip with an image editor, you can make a tileset.

OP2 is capable of reading two formats: a standard Windows BMP file, or the OP2 native format (I'll call it PBMP since no one has really given thought to it, and that's the text tag inside the file that signifies that it's a tileset bitmap).

Some considerations

There are a few considerations to be made on tilesets and maps within OP2. They are:

  • You can have as many separate tileset bitmaps as you want in your map. The original OP2 tilesets consist of 13 separate bitmaps. You could put your entire tileset into one bitmap, it's up to you really. (However it's easier to keep 13 tilesets like the original tileset has. This makes converting existing maps more easily, and has some other plusses described below).
  • If you plan on having lava in your map, you must have at least 8 tilesets. (The 8th tileset - well0007 in OP2s original set - is a special case, because it contains the lava animation sequences. This might change when we can edit the transformation tables, see the next point for more information)
  • It's easiest to use the same positions that OP2s original set used for images such as tubes, walls, bulldozed land, rubble, etc. This is because we don't yet have a way to edit the transformation tables in the maps, which tells the game what graphics to use for tubes, walls, etc.
  • A map can only have a maximum of 2048 mapping indexes, so that's a hard limit of 2048 unique tiles (less if you use animations).
  • The image format must be Windows bitmap, 32 pixels wide, and they should be uncompressed. (Do not use RLE compression or any other BMP compression)
  • Tilesets must have a color depth of 8 bit (256 colors). OP2 will abort loading any map with tilesets that are not 8 bit. Each bitmap has a local palette for this, this is another reason where it might be advantageous to have multiple tileset bitmaps (each has its own palette).

However, when editing, leave your graphics at 24 bit or better. Only convert to 8 bit color when you are totally finished (doing so will save you a lot of pains during the process).

Creating the tileset graphics

There's mainly two ways of getting new tileset graphics: either create them yourself using your own tools, or import them from another game.

I can't provide any details as to how you create or import tilesets, the steps are up to you. This is more graphic design than anything -- this article is simply meant to teach you how to get them into the OP2 format.

After you've created or imported your graphics, you need to save them into a vertical column of tiles. A GIF editor may be helpful for doing this, by adding 32x32 bitmaps frame by frame, then using the "filmstrip" mode to export them as one vertical bitmap.

Adding the tilesets to a VOL file

After you've created all the vertical bitmap files, convert them to 8 bit palettized color using your image editor. Save them as normal windows bitmaps.

For compatibility, try not to use any names that other tilesets use, and number your bitmaps starting with zero if you have more than one. (For example, the standard OP2 tilesets use names well0000 - well0012, and Greenworld uses grnwld00 - grnwld12).

Once you've done this, load OP2Mapper and goto File > New. Create a new VOL archive and add the tileset BMP files into this VOL file. Save the VOL file under any desired name into your OP2 folder.

The tilesets.ctl File

OP2Mapper can use a file inside your tileset VOL, named tilesets.ctl (short for Tileset Control). This file is a text file specifying what the names of your tilesets are, so when a user creates a new map while using your tileset, the editor will automatically add your tilesets to the map file. To create this file, open a new file in any plain text editor such as Notepad. Specify tilesets, one name per line, without the .bmp extension. Blank lines will be skipped. You must have at least one entry in this file. Save the file as a plain text file with ANSI/ASCII encoding. (Do not use Unicode/UTF-8 or any other encoding, it won't work). The tilesets.ctl file for the default tilesets would look something like:

well0000
well0001
.
. (so on for all the other names)
.
well0012

If you fail to provide a tilesets.ctl file, the mapper will revert to the default 13 well0000 - well0012 tilesets. It is in your (and your users') best interests to use a tilesets.ctl file.

After adding your tilesets.ctl file, save your VOL again. You're now ready to start making maps with your new tileset!

Using the Tileset to Make Maps

Open OP2Mapper. When it loads, go to View > Options. There will be a section about "VOL Override." This allows you to use your own VOL containing the tilesets in place of maps.vol. Activate the override by clicking the 2nd option button, then enter your VOL filename in the text box to the right. Click OK, then close and restart the mapper to switch it into the new tileset mode.

If you experience any errors at load, check the text of the errors. It could be due to the VOL file not being found, or an invalid tilesets.ctl file. Correct these errors before continuing.

Now go to File > New, select Map File, and press OK. Select the size for your map, and hit OK.

A small note on the option "Start with no tilesets": If this option is checked, the mapper will only add the first tileset listed in your tilesets.ctl file (or well0000.bmp if no tilesets.ctl is found). This tileset, in the standard OP2 set, contains a single placeholder tile that is colored blue. This setting is mainly for manually adding tilesets later thru the Advanced Edit window. (See Using Advanced Edit for more information on this). If the option is left unchecked (default) all tilesets specified in tilesets.ctl will be loaded into your map.

You can now start editing your map. There are a few options in the editor that can make life easier for you:

  • The Mass Edit button on the toolbar can quickly set a rectangle in your map to the same tile or cell type, if you use it.
  • You can paste a block of tiles which are consecutively ordered from the tileset window into the map as a rectangle of tiles. For example, if you have tiles that make up a tree or rock image that appear like this in the tileset: A B C D (A is the lowest numbered tile and they are all adjacent tiles)

But the image should appear like this in the map file:

A B
C D

There is an easy way to do that from the tileset window. Find the beginning of the sequence and right click the first tile in the sequence. A menu will pop up. Choose the option "Paste Consecutive Tiles". Next, specify a rectangle in the map where you would like to paste. The program will always paste left to right first, then go to the next row. If at any time it runs out of tiles it will abort.

Alternatively you can enter a tile ID where you want to start copying from. The first tile in a tileset is ID 0. (You can see the ID when you click, in the status bar. Consecutively-numbered tiles go from left-to-right in the tileset window, skipping to the next line as needed).

  • On the right click menu of the map window there is a tool to change all tiles with celltype X into celltype Y. The tool is pretty self explanatory.
  • Use copy and paste to easily build up groups of tiles. You may wish to create a separate map file to use as a "palette" of completed tile groups to copy from, for "real" maps. (Eventually the map editor will allow you to add tile groups directly into the map file, don't expect this functionality soon however).
  • Save frequently (including backups). The mapper does crash, and you wouldn't want to lose all that work would you?

Now for the final part: testing your new tileset in OP2.

Testing the Tileset

First you need DLLs to test with. You can either hex edit existing ones to reference your new map files, or create new ones in C++.

Note: for ease of distributing your new tileset, place all your .map files into the tileset VOL file. The only limitation is that you cannot place DLL files into the VOL.

To test in OP2, v1.3.3 or above, rename your VOL file to maps04.vol. maps04.vol is a blank VOL file at distribution time, meant for people making new tilesets to be referenced by the game. Back up this file before overwriting it, in case it contains other tilesets (such as Greenworld).

Note: A maps04.vol (even if it is blank) MUST exist. If it doesn't exist OP2 will output an error when it is loaded.

After naming your VOL, start OP2, and load up one of your DLLs. If it is a multiplayer DLL or some other hard to test DLL, press D at the main menu, then click Run Script to directly run your DLL file.

The game should load up. If not, and you get a Could Not Initialize Game error, check for the following:

  • Is the map file referenced by the DLL accessible to the game? (in game folder or a VOL)?
  • Are the tileset files accessible (Do they exist?)
  • Are the tileset files in the correct format? (32 wide, non compressed BMPs with 8 bit color depth)
  • (Less common) Is the DLL referencing a techtree file that exists?

If it doesn't work, look at these and try to fix the problem. You'll eventually get it.

Hopefully, this information will lead you on the way to making new tilesets!


Also see

Personal tools