CS2D
Not enough ratings
[Mapmaking] Creating custom tiles
By alucinação
Part of a series on mapmaking. Tilesets and blocks.
   
Award
Favorite
Favorited
Unfavorite
What are tilesets?
A "tileset" is an image file containing all "blocks" that you can use when building your map.

When you first open the Map Editor, click the topmost icon to the very left of the screen, which looks like a vertical rectangle. That is the button for creating a new map.

You will see this screen:



Click the field to the right of "Tileset" to choose a tileset. You will find a folder containing all tilesets currently included in your game, those being the ones that come in the vanilla installation or any tilesets you may have downloaded with custom maps.

The "cs2dnorm" tileset is the default one chosen by the editor. On the next step, we will learn how to create our own, using this one as a basis.

Also, take note: most tilesets are 32x32 pixels each block. If you want to have a different resolution in yours, you need to specify it on the "Tileset Size" field, seen above.

Editing
Navigate to your Steam folder. This is usually on "C:\ Program Files (x86)"

Then, enter the "steamapps" folder, followed by "common" and "CS2D". You will need to enter this folder many times, so i'd suggest creating a shortcut to steamapps.

Modding CS2D is very easy. In the "gfx" folder (which stands for graphical effects) you can find all graphical assets, in "sfx" (which stands for sound effects) you can find all sound files, etc.

Go to the "gfx\tiles" folder. Search for "cs2dnorm.bmp". All of those red squares you see are empty spaces, so there is still plenty of space for us to add new tiles. Instead of creating a new tileset from scratch, we will copy this one and rename it to whatever you want.

Then, open it with an image editor of your preference. Zoom in on a block to edit it (make sure you are only editing a 32x32 area, or one tile's contents may "leak" into the next one. Here's an example of what you could do:



At this part its important to make sure your block is "tileable". That is, some blocks look good in the editor, but terrible when you place several of those one next to the other. There are several tutorials on achieving this effect on the internet, and i won't go over this right now.

Alternatively, you can copy an existing block and make changes to it. I made an example of this technique here:



Blocks with transparency

On the default tileset, you may find some blocks (namely, metal grates) that have pink areas in them. This is the colour CS2D interprets as transparent, so you may copy it if you want that effect. Keep in mind it will show as black unless you set a custom background for your map (on the field seen on this tutorial's first screenshot).

Transparent blocks seen in the default tileset:



IMPORTANT: When dealing with this pink transparency, be it here or creating custom weapons etc., never use a soft brush. The colour values need to be EXACTLY these, so the brush's soft edges would actually show up as pink. Use a hard pencil tool or a bucket fill set to Bicubic.

There's no need to make hue or rotation variations

Look at the three tiles below:



These are included in the default tileset, from a time where in-editor hue variations were not possible. However, today you can right-click the tile that is currently selected (inside the map, not in the tile selection screen), and select "Color" to change its tone:



All the tiles you see below are the same, edited in-engine. As you can see, you can easily change their brightness and apply colour tints on top of them:



This also means you could replace the 2 darkers variants of the concrete tile, if you needed more space.

An easier way to control tiles, with or without editing them

Right-clicking a painted tile once acts like a colour picker, letting you start painting with that tile. Right-clicking again after selecting a tile opens the menu we discussed above. You can use rightclick to switch between the different edited versions of tiles you created, since variants won't show up in the tile selection menu. For example, after creating the last image seen above, my brush only applied red tiles, but you might find out that yours isn't switching from the default variant after creating a new tile variant, in which case a simple right click will fix that. This also means you don't have to edit hundreds of tile individually, if for example you need many different rotations to a tile, to break visual monotony. To go back to a tile's "default" version, re-click it on the tile selection menu or right click in in the map.
Saving & Configuring
After you make changes to a block's properties, painting with it will spawn more edited versions of it. For example, after creating the last image seen above, my brush only applied red blocks. To go back to a block's "default" version, re-click it on the block selection menu.

After you have added any blocks you might want to this tileset, it is important to always save it as a 24-bit .bmp file. If you try to save it as a 32-bit .bmp for extra quality/depth/whatever, the game won't recognize it. I have not tested .png tilesets, but if .bmp works so well and is a lossless format, why bother? Also keep in mind to never save as .jpg, because you will lose some quality in the image.

Now make sure you placed the new tileset on the gfx\tiles folder, and open CS2D. On the map editor, select this tileset as the one to be used for this map (see first image).

And voilà! The new blocks we created can be painted into the world:



However, we are not quite done yet.

Hovering over any block, you can see its properties. For example, tile number 1 on the default tileset has the "Floor-Dirt" properties. "Floor" means it can be walked on. "Obstacle" means you can't walk over it, but can see and shoot over it. "Wall" Means, obviously, that it blocks your movement, vision and bullets. "Obstacle w/o shadow" and "Wall w/o shadow" means the block will act as a wall or obstacle, but appear as if it was a floor.

The words that follow "Floor" will determine what sound the floor makes when someone walks over it - 'Step' floors will sound like concrete, 'Snow' floors will make a crunchy, muted sound, etc.

The tiles you created were previously on empty slots, so they are defaulted to soundless floors. Since making no sound is irrealistic, click the new tile on the selector menu, then go down to "Tile Properties".

Select whatever is best suited for your new block, then click "Save as default properties". This makes it work like that for every map.

If you need an exception - for example, if you want a block to function as an obstacle in this particular map, but not on all other maps that use it, simply select the desired option then click "close", without saving it as default properties.
Don't forget to pack your .inf !
When releasing your map online for others to download and play, it's important to include:

1. The .map file itself

2. The custom .bmp tileset you made

3. The tileset's properties - These are a .inf text file that is automatically created when you save default properties for your new blocks (see previous section). It must have the same name as the tileset image, and be left in the "tiles" folder along with it.

You can also, obviously, create a general-purpose tileset that is not linked to any specific maps.
Final words
I hope this guide helped you, but it is obviously not all you need to know in order to create a good, detailed map. The CS2D editor is a very comprehensive tool with complex scripting capabilities, and you can do some amazing stuff in it. I plan on releasing more mapping tutorials, so feel free to make requests. Cheers!