aoe2 and hero3-why they are so smooth?

Started by
16 comments, last by LEET_developer 18 years, 9 months ago
Hi, I am new to tile-based games and I want to know how do they make such smooth graphic? 1. What do they store in their tileset? snow->grass,snow->dirt,ground->water,water->grass... If there are m and n types of terrain to intersect, then I have to store m*n tiles for the edge?? Or I just store one type of terrain in one tiles and draw multiple times to achieve the same effect? But the latter approach seems a bit slow... 2. The terrain brush in the editor is very cool, do you have any ideas to implement it? Many thanks!!
Advertisement
In Heroes of Might & Magic 2 and 3, the terrain system works pretty simply. Each tile has just a terrain type attribute; all those fancy edges are actually picked at run-time, and stored only in memory only while on-screen, and re-picked when they come on-screen. It's not an expensive operation, but it does take more work than would make doing it at render-time acceptable.

All they do is decide the fringe based on the adjacent terrains. And there are a half-ton of restrictions that make it work in a limited art set.

No tile can have no adjacent tiles of the same terrain type. The minimum adjacency is one vertically adjacent and one horizontally adjacent. No 1xX paths, no 1x1 spots. This way, we chop out a huge number of possible fringings.

And to prevent fringing from every terrain type to every other... have you noticed that water always borders on sand? Fire up the editor and turn on the grid. Water tiles border only on sand. Sand borders on anything, and dirt borders on anything. But snow will border on sand or dirt, but nothing else.

So if some map-maker puts snow next to jungle; on the snow tile, fringe from snow to dirt, and on the jungle tile, fringe from jungle to dirt. Try it out; you'll notice that rock wall (Heroes 3) borders only on sand, and then the 'subterranean' borders on sand.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
Thank you for your reply!

But I am a little confused about "edges picked at run-time"...
Does Hero3 use this kind of tileset?

Each tile is 16x16 and there are 9 tiles in the above image.

I think edges are pre-edited and can not change at run-time, or we'll get
a different looking map every time?
Yes; the graphics aren't generated at run-time, but which fringe graphic (the outer 8 in that tileset you posted) to use at a given tile is chosen at run-time, to save memory.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
You mean even the MAP ARRAY is generated at run-time?? I can
hardly believe it... :(
This totally overthrow my understanding of tile-based games...
I thought what we got from a map editor is a two dimension map array.
This array should be very small. For a ushort map element indexes
into a tileset with each tile to be 16x16, a 4096x4096 pixel map only need a
256x256 map array, which only take 128kB memory. Does we really need to save
this memory?
If the map array is generated dynamicly, then what data do we save
from the map editor?
No, I think what he meant, is that you have a basic grid of terrain types which are read in at load time, but the smooth transitions between the different terrain types are calculated when you load it in, so that it can be made to look pretty. But those transitions aren't stored in the file.
Yes, it's also how I do it.

Basically I read base tile data from the map file, and store this in an array. Then I create a second array of equal size for the transition tile data, and calculate for every tile the appropriate transition offset in the grid. This is all done when loading the map, so that displaying the map is only a matter of looping bith arrays and drawing textures on screen.
Doing as the above posters suggest is the way I did it with Golem and with the Accidental Engine. After the map is loaded into memory (or randomly generated, as is the case with my work) a post-processing pass iterates over the map and for each tile it counts the neighbors of the tile that share the same basic landscape type, generating a unique code for a given neighbor pattern and using this code to index into a table of transition tiles. Unlike previous posters suggested, I did not place any artificial constraints on base type placement (isolated 1x1 blocks of terrain were allowed) thus necessitating a larger set of transition types. (46, to be precise). I highly recommend setting limitations, since a 46-type tile set can quickly get out of hand if you want to provide randomized alternatives for each of the transition patterns, to eliminate some of the more obvious repetition.
I am really confused... maybe because my bad English :(
So you mean that you are actually modify the GRAPHIC DATA(the image file)
when loading it? So you don't store this kind of tileset in your image file?


I am wondering what your tileset will look like?
My guess (and that really is just a guess) is that AAA-games like AOE2 use terrain splatting or a similar technique to create smooth transitions. So they store the terrain texturesd (grass, sand, rocks) and blend these together using an alpha map they deduct from the terrain type map.

This topic is closed to new replies.

Advertisement