Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Engravings and tilesets  (Read 1259 times)

Grimmash

  • Bay Watcher
    • View Profile
Engravings and tilesets
« on: September 15, 2013, 02:38:45 pm »

Hello!

I've started trying to wrap my head around making a tileset, and I can't seem to find an answer to this question:

When I look at other tilesets, the default walls always seem to have engravings already on them in the base tilesets.  But when you play, those engraving do not show up until you actually engrave something.

So, what is the mechanism by which the game understands how to use engraving tileset portions?  Is there some way the game masks or unmasks the tiles?  I really don't get it :(.

Thanks!

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: Engravings and tilesets
« Reply #1 on: September 16, 2013, 06:09:14 pm »

What you need to understand is that the tile is colored with two colors, foreground and background color, and that the tileset has transparency. When a tile is colored in, all its pixels are tinted with the foreground color. Then all the transparent bits are filled up with background color, and finally the tile is drawn to screen. If you played without a tileset before, you'll know that the background color of an unengraved wall is black, while the background color of an engraved wall is normally a darker version of the foreground color. Now if you paint engravings in a black/transparent pattern on a wall tile, you will see solid black when you look at an unengraved wall, but a black/dark pattern when you look at an engraved wall, because the background color shines through. If you don't want the unengraved walls to be solid black, you can make the engravings semitransparent but lighter than the surrounding opaque pixels, to compensate for the black that gets mixed in when you use a solid wall.
Logged

Obsidian Soul

  • Bay Watcher
  • ...and the severed part sails off in an arc!
    • View Profile
Re: Engravings and tilesets
« Reply #2 on: October 08, 2013, 01:00:51 am »

I assume, you know how to work your way in photoshop or gimp? Do this: take a tileset that uses pre-engraved walls/floors and open it up as one layer.

Now make another layer beneath it and fill it with black (the default background color). Notice that the engravings disappear.  You are now seeing the wall/floor as it would normally appear unengraved.

Now fill the bottom layer with white or some other color, and the engravings reappear. This is how the wall/floor looks like when engraved.

The tiles for the floors and walls have semi-transparencies in the pattern of the engraving, as MagaMcFry says. These are adjusted so that when overlaid over a black background, the transparent areas will become the same gray as the rest of the wall or floor, thereby "removing them". But when the background is anything other than black (which will automatically happen ingame once you engrave a wall or floor), the patterns will show.
« Last Edit: October 08, 2013, 01:02:51 am by Obsidian Soul »
Logged

Taffer

  • Bay Watcher
    • View Profile
Re: Engravings and tilesets
« Reply #3 on: October 16, 2013, 08:06:30 pm »

I assume, you know how to work your way in photoshop or gimp? Do this: take a tileset that uses pre-engraved walls/floors and open it up as one layer.

Now make another layer beneath it and fill it with black (the default background color). Notice that the engravings disappear.  You are now seeing the wall/floor as it would normally appear unengraved.

Now fill the bottom layer with white or some other color, and the engravings reappear. This is how the wall/floor looks like when engraved.

The tiles for the floors and walls have semi-transparencies in the pattern of the engraving, as MagaMcFry says. These are adjusted so that when overlaid over a black background, the transparent areas will become the same gray as the rest of the wall or floor, thereby "removing them". But when the background is anything other than black (which will automatically happen ingame once you engrave a wall or floor), the patterns will show.

As a warning, this method doesn't work if the colour scheme's background isn't black. That doesn't bother most people, but can be frustrating if you're not expecting it.
Logged