Tutorial: adding new terrain tiles with hex editor

embryodead

Caliph
Joined
Jan 1, 2003
Messages
5,179
Location
basement
Using a simple hex editor it is possible to edit stuff that is normally unavailable in the standard C3C editor. This tutorial explains how to add new Landmark Terrain (LM Pine Forest, LM Tundra, LM Flood Plain, LM Jungle, LM Marsh, LM Volcano, LM Coast and LM Ocean) to your maps.

Warning: whatever you do, always backup your files. It's very easy to make the BIQ unreadable with a small mistake.

Tools needed
First, install a hex editor, such as HexCmp. Then, download my HexPak.zip.

Enabling new LM Terrain
If you're into hex editing, you can do it yourself by changing the "Landmark enabled" byte from 00 to 10 for each terrain (see BIQ reference link at the bottom of the post). However, inside the HexPak.zip, I've included Landmarks.biq that has all the new LM Terrain added already. You can edit their stats in the editor like any other terrain.
lmtundra.gif


Note that in order to include this in your own scenario, you can import this part of the ruleset into another BIQ (File->Import->Rules->Terrain).

New LM Terrain and the editor
While you can change the new terrains' stats easily, the C3C editor will not properly place these tiles on the map. Also, it will get confused with the old LM tiles, so that they get shifted. Fear not, it's just an inconvenience, e.g. to place the usual LM Forest, I have to select LM Hills... etc.

Now, in order to place the new LM Terrain on the map, first place the base terrain in the C3C editor, e.g. Tundra or Pine Forest. Then, open your BIQ file in the hex editor yourself. Also, open one of the calc sheets provided in the HexPak.zip (one is for Microsoft Excel, another for OpenOffice). The files are based on Shay Yates Roberts' great excel stylesheet :worship: and make the editing much easier/faster. Follow the instructions inside the calc sheets.

Just to reiterate what is explained there: for each tile, after you entered all the red data, read the "Landmark offset" (=file position) to edit in the hex editor:
hex1.gif


All you have to do now is use the Jump to Offset function (CTRL+G in HexCmp) to jump to "Landmark offset" you've read in the calc sheet:
hex2.gif


...and change the two-digit number from 00 to 20.
hex3.gif


Graphics
For some of these new Terrains you can have new graphics. These are all located in the Art/Terrain as usual.
LM Tundra uses LXTGC.pcx
LM Coast uses numerous PCXs... basically all L*.pcx that have coast in it
LM Ocean uses LWCSO.pcx and LWOOO.pcx
LM Pine Forest uses 5th and 6th rows of LMForests.pcx
LM Jungle, Marsh and Volcano use their base graphics and cannot be changed

The Result
More terrain! Some quick ideas:
- Real tundra vs. Glacial terrain - like on the screenshot below
- Named LM Volcano with different stats e.g. Vesuvius or Mount Doom
- LM Ocean with lower movement cost (winds,currents)
- LM Coast with higher movement cost (reefs, shoals) - over it you can place a resource, e.g. rocks, since it works better than editing the terrain PCXs
- LM Pine Forest - adds variety to the terrain

Here is a screenshot showing Tundra vs. LM Tundra with new graphics; Jungle, Marsh and Volcano with LM marks, LM Pine Forest with Sn00py's forest-marsh graphics contrasted with Palm-Trees-LM-Forest at the bottom. It also shows Jungle-on-plains, which will be explained in another tutorial, though you can figure it out from the calc sheet already.
landmarks3.jpg


Credits:
AlanH, darndt, Gramphos, KingJoshi, MagForceSeven, Mercator, Nero Would, pdescobar, Tventano - for BIQ file format reference
Shay Yates Roberts - for the Deepwater Harbours idea in the Age of Piracy scenario and the original XLS spreadsheet
 
LM Jungle, Marsh and Volcano use their base graphics and cannot be changed
If I do not wish to use one of these base terrains, wouldn't it to be possible to replace the base graphics & then have access to 2 new useful terrains (the new base + the new LM)? For example If I was building a mod on Tibet I would not need Volcano graphics*. If I replace them with mountain graphics wouldn't I then have four usable mountain terrains (2 base + 2 LM)? This would let me do a lot as far as mapping the Himalayas, etc.


* I could either shut down the activity (explained elsewhere) or swap the lava explosion graphics for snowstorm (also posted elsewhere).
 
Not sure if that is what you want: Yes, it will be 4 usable terrains but with 3 graphics, since LM Volcano will still use whatever graphics you put in Volcanos.pcx.
 
There's a way around it though, I just realised. Complex, though: for each map tile, there's a byte that corresponds to a predefined image: in case of volcanoes it's Volcano.pcx and forest/jungle versions. You could have something else at Volcanos jungle.pcx, and turn all your LM Volcanoes on the map into Jungle volcanoes (no matter if there are jungles or not). If that's something you're up for, I can search for the byte and add to the sheet.
 
Wow embryodead, you sure made a great tutorial. You are a real asset to the civ community. Great work, my friend!

-Shay-
 
There's a way around it though, I just realised. Complex, though: for each map tile, there's a byte that corresponds to a predefined image: in case of volcanoes it's Volcano.pcx and forest/jungle versions. You could have something else at Volcanos jungle.pcx, and turn all your LM Volcanoes on the map into Jungle volcanoes (no matter if there are jungles or not). If that's something you're up for, I can search for the byte and add to the sheet.
I think any info that's not too hard for you to track down would be useful, since it would still be up to us to develop the actual mods and graphics. In this specific case I'll eventually be making a Huge map focusing on the Indian subcontinent. The Himalayan range may be 10 or more tiles thick at certain points. It would be nice to have as many options as possible for variations of mountain graphics and values.

As an example of how this could be used: I can have besides the base mountains: impassable mountains, mountains where small cities can be founded, true LM mountains like Kailas and the other sacred mountains in Tibet, or any other combination of 3 graphics, 4 total sets of stats for one terrain type. And the limit of graphics types is actually an advantage: I like the idea of having hidden features that players must discover through exploration. Think of how this might be useful in, for example, a Dune scenario.

By the way I realized I just posted the same question in the other thread where this is being discussed. Just ignore it and I'll edit it to link to your answer here.
 
Thanks Shay, wouldn't be possible if not Age of Piracy and Civinator inquiring on it :)

@Blue Monkey
4 terrains with 3 graphics is what you can do with this tutorial already (there's also snow-capped mountains too for more variation ;) )
I'll soon post an additional stylesheet that calculates the place of the image index; just so it is clear though, this change will behave in the same way as Shay's deepwater harbours - editing the map in C3C editor will reset the changes.
 
@Blue Monkey
Looks like 4 tiles with 3 graphics is the best you can have. It appears that the image index of the volcanoes is not saved in the BIQ, but automatically chosen by the game.
 
It appears that the image index of the volcanoes is not saved in the BIQ, but automatically chosen by the game.
I interpret this to mean that the game chooses whether to use the straight volcano or the jungle volcano graphic? But I could still have the LM stat/rule variation while using the same graphics for both it & the standard volcano terrain?
 
I interpret this to mean that the game chooses whether to use the straight volcano or the jungle volcano graphic? But I could still have the LM stat/rule variation while using the same graphics for both it & the standard volcano terrain?

Precisely (had to use to cool word to get past 10 chars)
 
im not really into the modding thing usualy but ide like to make a map and im just not sure how
can any one help me on how to get the files needed to make a map from scratch
 
im new to this whole modding thing and im looking to get all the files needed to make a map can any one help with finding the files needed to do this
 
Godrick: this is hex editing tutorial, not map making one. In order to make maps all you need is the editor that comes with Civilization 3, accessible through your Start menu.

Also, for general questions like that, please use the General Creation & Customization forum.
 
I have a (probably obviously answered) question:

If I create a scenario/mod with the Hex-Edited Editor, then can it be played by others if I upload it?

Again, this is probably a stupid question, but I just wanted to make sure.
 
Back
Top Bottom