View Full Version : Tutorial: adding new terrain tiles with hex editor


embryodead
Jul 20, 2007, 08:33 AM
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 (http://www.fairdell.com/downloads/). Then, download my HexPak.zip (http://forums.civfanatics.com/downloads.php?do=file&id=6175).

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.
http://forums.civfanatics.com/uploads/25392/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:
http://forums.civfanatics.com/uploads/25392/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:
http://forums.civfanatics.com/uploads/25392/hex2.gif

...and change the two-digit number from 00 to 20.
http://forums.civfanatics.com/uploads/25392/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.
http://forums.civfanatics.com/uploads/25392/landmarks3.jpg

Credits:
AlanH, darndt, Gramphos, KingJoshi, MagForceSeven, Mercator, Nero Would, pdescobar, Tventano - for BIQ file format reference (http://apolyton.net/forums/showthread.php?threadid=105623)
Shay Yates Roberts - for the Deepwater Harbours (http://forums.civfanatics.com/showthread.php?t=150624) idea in the Age of Piracy (http://www.civmods.com/) scenario and the original XLS spreadsheet

rifleman
Jul 20, 2007, 02:34 PM
This is really good, thanks ed

Blue Monkey
Jul 20, 2007, 07:52 PM
LM Jungle, Marsh and Volcano use their base graphics and cannot be changedIf 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).

embryodead
Jul 20, 2007, 08:02 PM
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.

embryodead
Jul 20, 2007, 08:07 PM
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.

Shay
Jul 20, 2007, 10:30 PM
Wow embryodead, you sure made a great tutorial. You are a real asset to the civ community. Great work, my friend!

-Shay-

Blue Monkey
Jul 21, 2007, 04:22 AM
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.

embryodead
Jul 21, 2007, 03:23 PM
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.

Pounder
Jul 21, 2007, 04:48 PM
This is great!

Would you be able to do anything with global warming with the hex editor, so that global warming could be better implemented, example; maybe sea levels could appear to rise as wetlands turn to coast, etc...

embryodead
Jul 22, 2007, 03:51 PM
@Pounder
No, BIQ only holds data about the map/scenario, can't change how the game works.

embryodead
Jul 22, 2007, 04:08 PM
@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.

Pounder
Jul 22, 2007, 04:23 PM
@Pounder
No, BIQ only holds data about the map/scenario, can't change how the game works.

I was thinking that the set up for the global warming transformations were set up in the biq, but you are right, it is the game that is not acting on that setup.

Blue Monkey
Jul 22, 2007, 06:00 PM
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?

embryodead
Jul 22, 2007, 06:18 PM
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)

godrick
Jul 28, 2007, 01:47 PM
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

godrick
Jul 28, 2007, 01:51 PM
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

embryodead
Jul 28, 2007, 06:22 PM
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.

Varlin Saliptor
Aug 12, 2007, 01:15 PM
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.

embryodead
Aug 14, 2007, 02:09 PM
Yes (since it's the BIQ that's hex-edited, not the Editor).

Varlin Saliptor
Aug 14, 2007, 03:07 PM
That's what I figured.

WilliamOfOrange
Sep 11, 2007, 09:07 PM
I am giving this a try. Does this Hex editor have a 15-day trial? I wonder what I will do if after 15 days I wish to edit more maps.

embryodead
Sep 13, 2007, 05:54 PM
Yeah HexCmp is shareware with 15 or 30 day trial. Since my trial ended long time ago I switched to Notepad++ (http://notepad-plus.sourceforge.net/uk/site.htm), it's free and IMO the best text editor there is, with hex support of course.

BadKharma
Sep 15, 2007, 01:19 PM
Notepad ++ is an excellent program and is also very good as an xml editor.

imperator1961
Feb 27, 2008, 01:58 PM
Notepad ++ is an excellent program and is also very good as an xml editor.

My Hexcmp's trial perriod is ended. I download Notepad++ but it works differently and I dont'understand. There is someone that can halp me to use this program? Thanks

general-jcl
Apr 22, 2008, 02:37 AM
Thank you, Embryoded, for this good tutorial
I've tried this in my new mod about the vendean wars in France (1793-1796)

Just some details:
-you need a uncompressed biq file to make the changes with the editor
-you write "02" at the point 7 in the xls file, but it's "20" to put LM terrain on


I tried to create LM coasts terrain. This new terrain is clearly identified as LM terrain in the editor. However, LM coast part in the editor, is still not active. So I can't modify the characteristics of this new terrain. I guess that's because I did not create a pcx specific to this terrain?
I do not know what form should have this file, and which civ3 files must be changed. I hope you can give me some guidance ...
Thanks a lot

Balthasar
Apr 24, 2008, 03:54 PM
I tried to create LM coasts terrain. This new terrain is clearly identified as LM terrain in the editor. However, LM coast part in the editor, is still not active. So I can't modify the characteristics of this new terrain. I guess that's because I did not create a pcx specific to this terrain?
I do not know what form should have this file, and which civ3 files must be changed. I hope you can give me some guidance ...
Thanks a lot

That's because the landmark coasts are already included in other files. You'll find them in lxdgc, lxpdc, lxggc, lxpgc and lxtgc in the Art/terrain file. If you mean coastal waters, look in lwCSO.

To anyone: is it possible to get LMRoads/Railroads? LMrivers? or LMVolcanoes? I'd give anything for that. If so, I've got a biq I'd like someone to hack for me.

Blue Monkey
Apr 25, 2008, 01:46 AM
That's because the landmark coasts are already included in other files. You'll find them in lxdgc, lxpdc, lxggc, lxpgc and lxtgc in the Art/terrain file. If you mean coastal waters, look in lwCSO.

To anyone: is it possible to get LMRoads/Railroads? LMrivers? or LMVolcanoes? I'd give anything for that. If so, I've got a biq I'd like someone to hack for me.AFAIK which LM terrain is available is hard-coded. Roads/RR & rivers are overlays anyway - not terrain.

LM Volcanoes would be handy. Personally, I don't understand why there is LM Sea, but no LM Coast.

general-jcl
Apr 26, 2008, 10:48 AM
If you mean coastal waters, look in lwCSO.
Thank you Balthazar, i'm going to try this
And yes, i think it's possible to have LMVolcanoes.

Blue Monkey
Apr 26, 2008, 12:51 PM
Thank you Balthazar, i'm going to try this
And yes, i think it's possible to have LMVolcanoes.If you're successful, please post the results.

Civinator
Apr 26, 2008, 12:54 PM
To anyone: is it possible to get LMRoads/Railroads? LMrivers? or LMVolcanoes? I'd give anything for that. If so, I've got a biq I'd like someone to hack for me.

Do you mean roads/railroads allowed on LM-terrain or LM-road graphics?

I tried to create LM coasts terrain. This new terrain is clearly identified as LM terrain in the editor. However, LM coast part in the editor, is still not active.

If you need a biq with a LM-coastal terrain and all other missing LM-terrains, embryodead gave such a biq to the Civ-community. This biq of course also contains LM-volcanoes.

Blue Monkey
Apr 26, 2008, 02:00 PM
If you need a biq with a LM-coastal terrain and all other missing LM-terrains, embryodead gave such a biq to the Civ-community. This biq of course also contains LM-volcanoes.Thanks, Civinator. In spite of having it bookmarked I had forgotten that the zip included the BIQ. I should have reread the whole thread before being erroneously pessimistic.

embryodead
Apr 27, 2008, 04:35 AM
Thank you Balthazar, i'm going to try this
And yes, i think it's possible to have LMVolcanoes.

Of course it's possible, I showed an LMVolcano in the tutorial ;)
It is not possible to have a different graphic for it, however, just different name/stats.

I tried to create LM coasts terrain. This new terrain is clearly identified as LM terrain in the editor. However, LM coast part in the editor, is still not active. So I can't modify the characteristics of this new terrain. I guess that's because I did not create a pcx specific to this terrain?
I do not know what form should have this file, and which civ3 files must be changed. I hope you can give me some guidance ...
Thanks a lot

You don't need / can't create any new PCX files. They are all already there. Modifying how LM coast tiles look is possible but won't be nice because of how terrain blending works, which is why I suggested using overlay resources instead.

If you can't edit the new terrain's characteristics, it means you missed the first step - "Enabling new LM Terrain" in the tutorial. I recommend doing what Civinator suggested - downloading my HexPak and importing the terrain rules from my Landmarks.biq into your own biq. That'll force you to redo some of your stats, but you'll have all LM terrain enabled.

LMRoads/LMRailroads, as in roads/RRs with different stats/look, are not possible.

Balthasar
Apr 27, 2008, 07:05 AM
Edit: after re-reading this thread, I realized that just importing the Landmarks biq rules wasn't enough; I still have to edit the hex file. So I downloaded all of the tools described, and got hung up on the very first instruction in the calc file.
It says, "1. Open the BIQ in a hex editor and search for the “TILE” string (not hex string)" I'm looking for volcanoes, and the little chart says that is "AA", so my question is:

I swear that once I get this, I'll stop asking dumb questions.

embryodead
May 02, 2008, 01:28 PM
Balthasar,
Yes, importing BIQ rules only enables the terrain in the editor, the actual placing of tiles should be done using the hex editor.

Two fixes for your problem, apply both:
1. Make sure the BIQ is uncompressed (turn off View->Options->Compress BIC files in the Civ3Conquests editor, and save).
2. When looking for "TILE", use string search, not hex search. Both HexCmp and Notepad++ have that option in the search box.

embryodead
May 02, 2008, 05:49 PM
Oh and one more thing since I didn't read it carefully earlier. The "AA" will be on the right side (the left is side is the address), but the only thing you should use search function for is "TILE" string. To find specific tile location use the stylesheet - once you enter all the values, it'll show you the exact address where the "AA" you're looking for is located.

Virote_Considon
May 10, 2008, 12:43 PM
Sorry to bump but I have a couple of questions:

1. Is it possible to have Tundra Jungles in the same way as you can have Plains Jungles? Because this would be mighty useful for me to represent Taiga!

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.

2. Does the above statement mean that the graphical representation in the editor is the correct one, and not the named one? Stupid question, but I don't want to go around making mistakes! :)

embryodead
May 10, 2008, 07:26 PM
Sorry to bump but I have a couple of questions:

1. Is it possible to have Tundra Jungles in the same way as you can have Plains Jungles? Because this would be mighty useful for me to represent Taiga!

Yeah should work in the same way. Simply change the desired tundra tile to a jungle using my stylesheet. Doing this you only change the "overlay" value of the tile, while the "base" value remains the same - in this case tundra. The tile will be now treated as jungle in terms of rules (or LM jungle if you set the LM byte).

2. Does the above statement mean that the graphical representation in the editor is the correct one, and not the named one? Stupid question, but I don't want to go around making mistakes! :)

The graphical representation is the correct one. The names on the map etc. are correct as well, it's only the terrain menu that is mixed up.

Virote_Considon
May 11, 2008, 10:32 AM
I'm not sure the names on the map are correct - When I hover the mouse over LM Mountains (graphic), it tells me they're LM Flood Plains (name), but I feel safe that it counts as LM Mountains...

Thanks for your help!

chaseclift
Sep 18, 2008, 01:20 PM
is there anything like this for Civ3 plain? :(

WilliamOfOrange
Dec 16, 2008, 02:39 PM
Sorry if this is a huge bump, but I have been away for a few months.

What I would like to know is if there is any way to make a different terrain type be the base terrain. If I don't want grassland as the base terrain type for all the pcx files. Can we use this editor to make, say, desert the base terrain type. I could (or have) gone and edited the pcx files to have desert and grassland switched. Would this be possible? Just curious here, it's not really a big deal.

Also, from VC's question up above, I was wondering about how one goes about making jungles over plains or tundra. I had an idea about changing the jungle graphic to the forest and then forest graphic to that of rocks and boulders. The "forest" could then represent an avalanche or rock slide. This way, I could use the Plant Forest worker action for units that "cause rock slides", not to attack, but slow down enemy troop movements through narrow parts of terrain where wheeled units have only one path through mountains.
Sweet? I think so!

However, the plant forest feature would only plant normal forest, not LM forests. I guess I could swap the pcx files for them, having the normal forests be piles of rocks or ice and the LM forests look normal.

Is there anything I am missing here? Would this work?

Oh, and can you really make LM pine forests in addition to the normal LM forests?

Blue Monkey
Dec 18, 2008, 08:23 PM
However, the plant forest feature would only plant normal forest, not LM forests. I guess I could swap the pcx files for them, having the normal forests be piles of rocks or ice and the LM forests look normal.

Is there anything I am missing here? Would this work?You've got it correct; swap the pcx

Oh, and can you really make LM pine forests in addition to the normal LM forests?The pine forests are rows within each of the forest pcxs. - The editor will assign then the same value as whatever named forest they are part of.

againsttheflow
Dec 20, 2008, 02:44 AM
The pine forests are rows within each of the forest pcxs. - The editor will assign then the same value as whatever named forest they are part of.

I'm not sure, I wasn't able to figure out a way to assign any sort of LM terrain to use the pine forest rows in the LM forest .pcx. I may be missing something...

Blue Monkey
Dec 21, 2008, 07:10 PM
I'm not sure, I wasn't able to figure out a way to assign any sort of LM terrain to use the pine forest rows in the LM forest .pcx. I may be missing something...If you want all the LM forest to be pines, then just cut and paste from those rows over the other other kinds of trees.

againsttheflow
Dec 21, 2008, 11:14 PM
Right, but going by the original question I had thought you were referring to a way to get LM pine forest in addition to the other.