Can somebody please explain me the algorithm for the map generation

methosmethos

Chieftain
Joined
Mar 14, 2016
Messages
1
Hi

I am really struggeling alot with that problem but i cant find an answer.
I understand how the pcx files work and that they combine 3 different tiles + all the combinations.

I understand how they are summed to calculate the correct tile.

What i dont understand is the how all of that works together.

When i open the editor and place one grasslandtile i can see that one tile is basically a combination of 4 different images from the pcx files.

But not necessarily from the same file.

When i try to create one plain tile i can see it takes 2 images from xdpc.pcx and xpgc.pcx file.

I hope somebody can solve that mystery for me.

regards
 
I understand how the pcx files work and that they combine 3 different tiles + all the combinations.

I understand how they are summed to calculate the correct tile.

What i dont understand is the how all of that works together.

When i open the editor and place one grasslandtile i can see that one tile is basically a combination of 4 different images from the pcx files.

But not necessarily from the same file.
A good starting point to wrap your head around it is that the grid on the map & the tiles in the pcx are not precisely isomorphic. By that I mean that ... the simplest way to put it is that the center of an individual pcx tile straddles the border of the grid "tile". I'm not sure anyone has found a complete solution, primarily because we do not have access to the game code itself. So we will probably never understand the stochastic element in the algorithm.

At least that's my understanding based on what I've read here of the research by the master artists who have delved into it -

For all base terrain graphics (grassland, plains, tundra, desert, sea, ocean and coast), the graphics is done by associating the corners.
Ie the graphics have offset by half a tile compared to the grid.

You cannot just replace the inside of a square.
I have made the modification over-sized on the tiles. ... The other reason I made them over sized is so when two of them meet they will overlap and depending on the direction they meet will determine the pattern, this should give the impression that alot more tiles were modded.

Also you can see that when it shows up in a mountain valley that it seems to blend in fine.
From Pounder's work we know that you can let your pcx tile graphics overun the diamond borders a little bit. Because of the way the game engine handles the terrain it will blend the tiles.

... each file is setup with it's tiles made to fit together in a specific way, so to find which tile is the tile for those specific spots in the pic above will require alot of testing. Best bet may be to determine which they are by making a copy of the file by placing graphical numbers on them, then view it in the editor so you know which tiles to use in the pcx file.

Terrain tiles can be confusing to make complex changes unless you are willing to spend a fair amount of time to understand them, and more time making and testing the graphical changes to get them showing up properly.

I believe there was a tuturial on terrain files somewhere that may be very helpful to read first, but I can never find anything when I try to!
You are - as tom2050 points out - going to have to invest some sweat equity into whatever tile set you are creating.
So having chosen a terrain type to modify, I take a generic version of that terrain and make a "blank" template, then number each diamond on it.

Then, in the editor, I put that terrain onto the spot where I want my new building, and note which numbered tiles make up the four squares (for instance) of my building.

... Now, because the terrain files often have many more than four tiles to work with, I'll usually try to use all of them somewhere in a city terrain, ... One caveat: these tiles often repeat in various configurations, and the only variables seem to be the surrounding terrain, ...
I think that what has to be realized is that there is no: grass files, plains files, desert files, etc.....

Each file is actually a transition from one terrain type to 1 or 2 other terrain types.

... Even if you want to display only grassland in your game, the displayed grassland will be drawn from 5 different transition files randomly.
The game engine stochastically selects from a pool of possibilities. So you need to do some testing to find all the combinations that affect your design & adjust accordingly. As Balthasar points out, making a set of pcx with numbers or other labels to identify each tile helps. You need to do the experimenting for yourself, because there is no complete and general solution posted here. AFAIK everyone does what works for them then stops, but making and posting a map of every possible combination of all terrains has never been done. If you know anything about permutations and probability you'll understand why. Too much time needed, too difficult to ensure every combination is represented.

A good set of tiles to work with when you experiment. AFAIK WildWeazel & tom2050 have posted the most detail on how they've actually experimented, including providing templates, etc.
 
There are also - to my mind anyway - annoying, if not bizarre, hard-coded cases where, e.g., a Plains tile cannot be adjacent to Tundra and, of course, using the standard editor, the only water tile which can be adjacent to any land tile is Coast. - Oh, yeah, and desert adjacent to a river automagically becomes a Flood Plain :crazyeye:

-O.
 
Back
Top Bottom