PDA

View Full Version : Terrain hex codes



Hapuga
July 5th, 2010, 22:45
Maybe someone will find this useful.

The Map file is read by the game from left to right, from top to the bottom, like a book. The layout mirrors the map in the editor. Each map tile is made of 4 pairs of hexadecimals. For example, if you have a 5x5 map with Keeper 1 dungeon heart, the first tile line in the editor (border in.r, 5x dungeon h, border in.r.) will read as 011E0201 010E0301 010E0301 010E0301 010E0301 010E0301 011E0201. This should give you a hint on how to find different terrain types in the map. The North-Western coordinate is the beginning of the file, and the South-Eastern is the end.
Some codes will have a * after a digit. This symbol indicates that this is a progressing code, and you can easily alter the numbers for different players. For example, the heart for player 1 is 010E03*01. This means that for player 2 it will be 010E0401, for 3 - 010E0501, for 4 - 010E0601, etc. Remember, that 01 = Good Player, 02 = Neutral player, 03 and higher – players 1,2,3,4,5.
Terrain
Border impenetrable rock code - 011E0201
Impenetrable Rock – 01010201
Diggable Rock – 01020201
Dirt Path – 01030201
Water – 01040201
Lava – 01050201
Gold – 01060201
Gem Seam – 01070201

Rooms, portals and walls
Clamed Tile (Good Player) – 010801*01 (01080201 is an equivalent to 01030201(dirt path) because there is no tile for a neutral player)
Reinforced Wall (Good Player) – 010901*01 (01090201 is an equivalent to 01020201(Diggable Rock) because there is no fortification available for a neutral player)
Mana Vault (Good Player) – 012001*01
Hero lair (Good Player) – 012301*01
Dungeon Heart (keeper 1) - 010E03*01
Portal (Good Player) - 010C01*01
Lair (Good Player) - 010B01*01
Hatchery (Good Player) - 010D01*01
Library (Good Player) - 010F01*01
Training Room (Good Player) – 011001*01
Treasury (Good Player) - 010A01*01
Workshop (Good Player) – 011301*01
Casino (Good Player) – 011801*01
Guard Post (Good Player) – 011201*01
Wooden Bridge (Good Player) – 011101*01
Stone Bridge (Good Player) – 01240101; (Neutral player) – 011A02*01
Prison (Good Player) – 012401*01
Torture Chamber (Good Player) – 011501*01
Combat Pit (Good Player) – 011901*01
Graveyard (Good Player) – 011701*01
Temple (Good Player) – 011601*01
Hero Gate Final (Good Player) - 011C01*01
Standard Hero Gate (Good Player) - 011C01*01
Hero Gate 3x1 (Good Player) – 012501*01
Editor Mercenary Portal (Good Player) – 012801*01

P.S. I have it uploaded to google dox.

Ty, Necror.

Here (https://docs.google.com/document/edit?id=1kO_4yxD2vaoOnh3H-BtGMLrlJWsxXPV3GcIMRFpaWys&hl=en#)

Necror
July 6th, 2010, 06:39
upload the word doc on Google docs (http://docs.google.com/).

dst
October 21st, 2010, 00:41
Hi,

first of all I'm not sure if this is interesting news or common knowledge - couldn't find anything on the forum.

Regardless of the chance of bringing old news:

I fiddled with the mapfiles and I think it is possible to make bigger maps than the max editor size of 128x128 by editing the file with a hex-editor.

Up until now I found out, that bigger maps can be loaded, but the editor crashes a lot (every 1-2 minutes).
It is possible to load a 255x255 map in the game and play it. A 1000x1000 map can be loaded in the ditor but crashes DK2 shortly before the loading bar is finished if you try to play it. Perhaps because 1000 needs more than 2 Bytes. Haven't checked smaller maps with height or width bigger than 255.

At the moment I'm trying to work around the editor crashing problem by making smaller maps and copying them into the 255x255 map.

I'll check back, as soon as i get the 255x255 map running. Or if i don't, or if someone tells me that this isn't news at all :-)


Oh and here are the offsets for mapsize:

width: 0x000014 - 0x000015
height: 0x000018 - 0x000019

Those 2 Bytes have to be switched (i.e. hex: 00 40 (dec: 64) becomes hex: 40 00)
The maptile data starts at 0x000024 (36th Byte) and takes up the rest of the file.
Like Necror said there are 4 Bytes for each maptile arranged row after row from left to right. So if you change the size manually, you have to add the appropriate bytes at the end of the file.
E.g.: 10x10 map: 100 Tiles x 4 Bytes = 400 Bytes after 0x000023 (after 35 Bytes of map info)

You don't have to make those impenetrable border rocks, which would be a real hassle typing the right Bytes. It's sufficient to delete everything from and including 0x000024 and then adding the correct amount of "diggable Rock"-Bytes. As soon as the map is loaded the editor makes the impenetrable Border by itself.


Last but not least: if the editor crashes while loading check your filesize: 35 Bytes map info + 4 * width * height Bytes maptile data:
10x10 map: 35 + 4*10*10 = 435 Bytes
100x100 map: 10035 Bytes
50x50 map: 2535 Bytes
255x255 map: 65060 Bytes

And as i am a selfish person I'd like to welcome everyone who thinks this is interesting (or is just a nice person) to help me out with some questions. I'll post them in a new thread because they have nothing to do with hex editing map files.

Bye

Keeper Nocturnus
June 11th, 2011, 13:42
Map size bigger than 128x128?Finally someone noticing the best thing thats missing from the Editor.(No offense)