How to generate a correct tilemap?

How to generate a correct tilemap?

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
Vehementi
Posts: 67
Joined: 28 Apr 2005, 23:27

How to generate a correct tilemap?

Post by Vehementi »

We've got a tilemap bitmap that we generated in accordance with all of the tutorials, which agree with eachother and say that it's a standard bitmap with no special formatting. MapConv.exe is finding the file, but says that it can't read it:

Error opening tile file ...

It's failing on line 48 of MapConv.exe:

Code: Select all

TileFileHeader tfh;
ifs.read((char*)&tfh,sizeof(TileFileHeader));
if(strcmp(tfh.magic,"spring tilefile\0")!=0 || tfh.version!=1 || tfh.tileSize!=32){
	printf("Error opening tile file %s\n",fi->c_str());
	continue;
}
We did some debugging and it's failing all three criteria. Since it is a standard bitmap, obviously it doesn't have a header of those specifications, so of course it's failing. So, how do we generate a correct tilemap? Exactly zero of the tutorials mention this. Are we missing something super simple that's not even worth mentioning, or are you all wrong and has nobody ever used tilemaps ever in any map in the history of everything ever?

While we're on the topic, can somebody provide an explicit and complete format for tilemaps?
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

The creator of River Dale/Cliff Run/Sparewood used a tile file in his map. But a tile file is not required at all, and none of the tutorials actually need a tile file. They all use tiles, but not tile files. These are two seperate things. Try compiling the map with just the texture, metal and height maps, plus a black feature map if you using Mothers MapConv.
Vehementi
Posts: 67
Joined: 28 Apr 2005, 23:27

Post by Vehementi »

We know that you don't need a tile file, and we've created maps without them, just making the texture map a giant... uncompressed texture file. But all the "complete" tutorials say "use a tilemap!" then don't tell you how to generate it (or explicitely say it's a standard bitmap, which the above code proves it cannot be), or don't use them at all in the actual map example.

We also want to test how well the compression algorithm compresses (afaik blindly using a normal compression algorithm on a custom graphics format is incredibly useless) compared to using a pure tile-based setup.
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

Using a tile map will not help with compression. If you really want to use a tile map, again ask the Riverdale creator, but if you want to use it to help compression, dont bother. Unless you are trying to include multiple maps in the one .sd7 file. If your doing that then this will help with compression.

I THINK the MapConv will output a tile file somewhere when it compiles which you can then reuse for your other maps. I do not know if it is possible to create one manually.

This is how Spring maps are compressed:

1) The compiler loads in the texture file.
2) The compiler examines the texture to see if any tiles(32x32 section of the texture) are the same as any of the other tiles. The compression you set in the MapConv program is the
3) If they are, dont worry about that tile.
4) If they are NOT, add that tile to the tile file.

If you specify a tile file, then the compiler will also include those tiles when comparing tiles to each other. Then, when the compiling is done, it will reference to that tile file in the new map files. Because of this, then only way you will save space is by making a few very similar maps, and packaging them together in the same .sd7 map file.
Vehementi
Posts: 67
Joined: 28 Apr 2005, 23:27

Post by Vehementi »

Thanks a bunch. So, when you say that trying to use a tile map to help compression doesn't work, are you saying that Spring isn't smart enough to use a tile map as a compression method instead of having a giant texture map, or are you saying that the compression method is so good that doing that wouldn't be significantly useful?
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

Im saying that Spring does compress the map into a Tile File, and you can reuse that tile file in other maps to save space. So for single maps, tile files will not make a difference at all, as it already uses a tile map, but for multiple maps it can save lots of space.
User avatar
aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

Post by aGorm »

Just thought Id point out, It defiantly dont say "USE A TILEMAP" in any of my tuts. You may be confusing it with a line like, "Use tiles to make your map compress better" but taht is totaly different, and also I had to leave it relativly unexplaned due to time constants. My new tut will cover it though.

aGorm
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

I might clear mine up a little bit as well, if to many people are getting confused.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

When I say "use a tiled map to save on filesize", what I mean is make sure that when you create your texture map in your image editor of choice, make sure it is made of 32x32 tiles. The compiler will then recognise by itself that many 32x32 area are identical, and will take advantage of it to get a better compression.

So, when creating your texture map in MS Paint, The Gimp, Paint Shop Pro, Photoshop, or whatever, if you have to fill large area with a repeating pattern, make sure the repeated motif has a 32x32 size.
Post Reply

Return to “Map Creation”