Jump to content
  • Advertisement
Sign in to follow this  
lanceking

aoe2 and hero3-why they are so smooth?

This topic is 4747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!