Terrain Editing

Nathiri

Commander
Joined
Oct 7, 2014
Messages
797
Location
Georgia, US
I cant seem to find a tutorial for this. This part of modding I have tried to steer away from because it looks rather difficult to do. But I've become a little unhappy with a few parts of certain terrain packs, whether it be their brightness or just their art style. There are also a few incomplete terrains done that I think look quite good or they have a few errors when you place them together. I want to get rid of a terrain or two for my mod and I'm sort of limited to something simple like the marsh, but I can only do so much with that particular terrain. Or if I wanted to do a special landmark terrain like a mountain.

So could someone point me in the right direction on how to start?
 
So I have been experimenting with terrain with the Kardashev 3 mod, so this stuff is relatively fresh on my mind.

First, the terrain graphics are generated in layers. The first layer is the most complex layer, the flat land terrain, such as Tundra, Plains, Grassland, Coast, Sea, Ocean. If you look in the game terrain art files, you see things named like xdgc.pcx, or wCSO.pcx or something. The first letter indicates the type of terrain class x is for land tiles, and w is for water only. C for coast, S for Sea, O for Ocean, D for desert, G for grassland, P for plains, and T for Tundra. The graphics themselves are actually generated in the intersecting corners of tiles, rather than centered on the tile itself. Basically if you have 1 grassland tile in game, you splice 4 different graphics together, based on the tile types adjacent to it. Each graphic is the corners of 4 different terrain blended together.

For example, if you have the following terrain configuration:
Ex.png

Green is grassland, yellow is plains, white we don't care.

The central grassland tile is comprised of 4 tiles, in red. The top one is made of 4 corners, the south belonging to grassland, while the north, east, and west belong to plains. For the bottom one, the north belongs to grassland, west, east, and south belong to plains, etc.

If you look at the graphic files, they go through each of the combinations of the 3 provided graphics. However, there isn't overlap between Desert and Tundra, and Tundra and Plains. This is the reference grid that I use when stitching the terrain together:
Spoiler :

Blank Tiles abc.png



Basically, xABC.pcx corresponds to A, B, and C in the terrain.

The next layer that is generated are the forest layers. Forests are applied on top of the flat lands, and they are determined by whatever they happen to be on top of. "plains forest.pcx" is generated on top of plains, "tundra forests.pcx" on top of tundra, etc. Jungles are also included in the various forest .pcx files, in the labeled Jungle section, however this is only really applied using the "grassland forests.pcx" file. The tiles are centered on the center of a tile rather than corners. I don't know if you can place Jungle terrain on top of plains and have it show up as the plains version, as I haven't tried. Any of the invisible colors are rendered with whatever terrain is underneath, and if the forest spills out over its assigned tile, the forest will graphically do so as well.

The top layer generated are the mountains and hill files. In the graphics files, there is a tile and a band above it which is the pink color, which gives it the illusion of height by designating area where the mountain rises above the surrounding terrain and graphically blocks the tile behind it. The tiles are centered on the center of a tile, rather than corners. Fairly straight forwards otherwise. If there are nearby jungles or forests, the mountain and hill tiles generate using the "mountain forests.pcx" or "mountain jungles.pcx" files. I'm not exactly sure when it decides there are forests or jungles on top, but the concept is there. Beneath mountains are always grassland, so the invisible color will show grassland underneath.

Next, you get the rivers and resources.pcx applied on. The rivers are applied on the edges of tiles, and if there are mountains involved, have waterfall graphics. If it passes next to a desert tile, it applies the floodplain.pcx graphic over the desert tile, and if it exits to water, it applies the deltaRivers.pcx file.

Terrain improvements are next to be generated, such as roads, rails, irrigation/mines (Irrigation has different graphics based on the base terrain, indicated by "irrigation DESETT.pcx" for desert, "irrigation PLAINS.pcx" for plains, "irrigation TUNDRA.pcx" for tundra, "irrigation.pcx" for grassland.)

Finally, cities and rubble is generated on top of that.
 
Last edited:
An excellent explanation, Bluemofia. I'm glad you have looked at this recently; it's been quite awhile for me. But your description is accurate to the best of my memory.

I don't know exactly how it decides whether to use mountain forests.pcx or mountain jungles.pcx, either. I gave up trying to figure out terrain formulae after spending far too long trying to figure out the formulas for which mountain and forest graphics (within the files) were used on a particular tile.

I also didn't know about the waterfall graphics by mountains. I'm happy to have learned something new! :goodjob:
 
Edited my first post to add the promised reference grid.

Anyhow, so if you carefully draw your terrain, you can generate unique location graphics by ensuring that that particular situation does not exist anywhere but in your area. For example, if all desert tiles are surrounded entirely by grassland tiles, and never plains, you can then use desert bordering plains graphics to represent something else entirely. Actually executing this is a complex thing, and I myself have not attempted to do so. Blue Monkey did writeup on this a while back, and recently bumped the thread for reference:
https://forums.civfanatics.com/threads/help-lm-mountain-to-planet.454063/
 
Last edited:
The advice written here so far is very valuable in my opinion. Creating good terrain sets is time-consuming and can be very complex. Adapting and adjusting existing terrain graphics can be rewarding, not as complex, and a valuable introduction to working with terrain.

Random thoughts:

It's very liberating once you start thinking of the terrain names as abstract tags which can be attached to any kind of visual content. One of the very first projects I posted was a set of LM Hills made to look like the surrounding Mountains.

WildWeazel's template set is a very good guide to constructing terrain "freehand". Combined with tom2050's excellent stuff it makes for a great set of tools.

Not exactly a template, but while you are trying to figure out how to blend the edges of your various terrain it can be helpful to make a version with a big fat letter or number in the middle of each tile. Otherwise it can be difficult to figure out which part of which pcx needs adjustment.

What we see as a map tile in-game is constructed from where the corners of 4 "tiles" from the various pcx files meet. Pounder posted a grassland set that demonstrates the value of adding a bit of graphic outside the diamond (tile).

Look at the magenta/green of a terrain pcx & ignore the "actual content" for a moment. These reveal the constraints you can't get around when creating terrain. The base terrains are more or less limited to the size of a tile. The mountains and hill are also limited by similar constraints. The boundary boxes for the overlays such as forests, jungles, & marshes are much larger. You are not limited to the precise size of the existing forest (or jungle or marsh) graphics. Whatever fits within the box is allowable. I've never done a systematic test to find out which boxes within the pcx overlap which others when there is more than one adjacent overlay. This can affect what visual results you are able to accomplish. None the less ...
 
Top Bottom