[eINFO] About Stamps for random maps

By on October 29, 2012 5:06:22 AM from Elemental Forums Elemental Forums

Heavenfall

Join Date 07/2008
+436

 

 

Edit: It is not my intent to make creating stamps look difficult. It is very simple. This is a very technical walkthrough for those interested in the behind-the-scenes and to get some ideas on how to design well-functioning stamps.



I've been tinkering with stamps since way before release (in XML) and now that the map generator is out with a Stamp tool I thought I'd chip in and talk about what stamps are and why they're important.


What are stamps?

Stamps are pre-built pieces of maps that are used when a map is randomly generated. Think of stamps like Puzzle pieces that make up the total Puzzle (map) when put together. Here is a Small stamp in the Cartographer: http://i.imgur.com/4CLVN.jpg


Why are stamps important?

Because stamps determine what Random maps look like, they play a crucial role in several ways:

Visual Appeal: If you saw an area in-game that consisted of 19x19 Plains tiles, all brown, you would not be impressed. A stamp is an opportunity to give an area of the map character - why not a volcano?

Good gameplay: Starting positions, natural chokepoints, proximity to secondary and tertiary city locations, terrains like Forests and Rivers.

Replayable game: By combining (and rotating) stamps differently, every random game produces a random map which increases the fun of replaying the game.

 

Let's get technical. How do stamps work exactly?

Map Sectors

There are different sizes of maps - Tiny, Small, Medium, Large (and Tactical maps, which are not randomly generated and not covered here).

Each map size consists of a certain number of sectors. I have printed the sector count out below for your convenience. From each number subtract 1 for the final count. Also note that one sector is commonly blocked by a Cloth Map compass (silly, but there it is).

Tiny Map: (Width 4) * (Height 3) -1 = 2*3 -1 = 5 Sectors.

Small Map: (Width 5) * (Height 4) -1 = 4*3 -1 = 11 Sectors

Medium Map: (Width 6) * (Height 5) -1 = 5*4 -1 = 19 Sectors

Large Map: (Width 7) * (Height 6) -1 = 6*5 -1 = 29 Sectors

Here is a Tiny map, divided into sectors (also notice the Compass taking one sector): http://i.imgur.com/aZ554.jpg

Here is a Small map, divided into sectors: http://i.imgur.com/3nGjg.jpg

Each sector consists of 16x16 in-game tiles

Edit: Note that maps are technically larger as per http://forums.elementalgame.com/435333/get;3264664. But the above list is the relevant list of sectors for the purposes of random stamp placement.

Map Stamps

If you paid attention when looking at the sectors above, you should have noticed something odd. Certain map features such as the Arctic wildland stretch across multiple sectors.

This brings us to how Stamps are structured. Stamps come in different sizes. They have padding on their sides so they are slightly larger than sectors, this helps improve how they merge (see Stamps Merge)

A Small stamp covers 1 sector, 19x19 tiles.

A Medium stamp covers 2 sectors, 19x35 tiles

A Large stamp covers 4 sectors, 35x35 tiles

A Huge stamp covers 6 sectors, 51x35 tiles

You'll notice, of course, that the numbers don't quite "add up" to the size of sectors. I will talk about this later on when discussing how "Stamps Merge".

 

(there are also custom-sized stamps, wildlands. They aren't quite the normal size of stamps)

 

Maps and Stamps combined

In CoreMaps.xml we find more details to how exactly Stamps get put into random maps. The XML below is from Tiny map:

   <TinySeedSpawns>2</TinySeedSpawns>
    <SmallSeedSpawns>2</SmallSeedSpawns>
    <MediumSeedSpawns>0</MediumSeedSpawns>
    <LargeSeedSpawns>0</LargeSeedSpawns>

So, we see here that a tiny map appears to be limited to Small stamps and Medium stamps. Don't be confused by those tags, by the way (they lost the names in translation). Small stamp = TinySeedSpawns. Medium stamp = SmallSeedSpawns. Large stamp = MediumSeedspawns. Huge stamp = LargeSeedspawns.

In addition, a tiny map appears to be limited to 2 of each. So, here's an example of a Tiny map: http://i.imgur.com/bBdJZ.jpg

I have manually placed a Small Stamp (1 sector, yellow outline) and a Medium stamp (2 sectors, green outline).

 

Stamps Merge (and clever Stamp design)

A normal randomized (tiny) map does not contain 5 sectors separated by water. The Stamps merge together at their edges.

This presents a problem that a maker of stamps must face. How do stamps merge together at the edges? They merge together by clever Stamp design, and some background coding when randomly placed. Clever Stamp design means the stamps are built to be flexible around their edges - mostly plains. Effectively, a Small stamp is a Cube of plains, with various terrains filling up the inside. This is also why you'll get random maps that are mostly Square around its edges - because the stamps making up the map are.

Very rarely some players reported during beta that they had started on maps that were divided into islands. This was a result of bad stamp design that didn't quite reach the edges of other stamps.

Players also reported that there were "floating waterfalls". This occurred when two stamps merged at their borders, and one border was no longer a cliff but a plains tile. Imagine a river that floats to the very edge of a stamp and then into water. If that stamp gets rotated and placed in-game, it may end up in a position where there isn't any water.

Another thing you'll notice when playing with existing stamps is they have no Cliffs whatsoever around the edges. In the entirety of all the Stamps in the game, there isn't a single Cliff tile placed near an edge. Cliff tiles are Plains tiles that get automatically converted into Cliffs for being the border between an Ocean tile and a Plains tile.  This is something you'll need to be acutely aware of when making your own stamps, because the Cartographer will turn those particular tiles into Cliff tiles by default. But under no circumstance should your Stamp contain any Cliffs around its edges. This will lead to severe distortions in-game when your tile does get placed (because Cliff tiles are NOT returned to Plains tiles when they border two Plains tiles). Placing Cliffs in the belly of a Stamp is fine however.

 

Making my own Stamps

Forging my stamps

If you skipped down to this part, go back up and read "Stamps Merge".

The easiest way to create a new Stamp is to go into the Cartographer, place an existing Stamp and edit that one. This will give you a stamp that is the "right" size for the sectors of a random map. Make sure that the stamp is not connected to any other stamp in the cartographer, or you'll have troubles selecting it when its time to export it.

I won't go into detail here about how to use the Terrain tools and stuff like that. Just play around with it and you'll get the feel for it.

When finished with the terrain,use the Selection Wand, click on a Plains tile and your Stamp should be automatically selected: http://i.imgur.com/haaCI.jpg

Note: The Cartographer has a bad bug that prevents you from generating a map (empty or not) then generating a new one. When you are on your second map, you will be unable to see or place Starting Positions, and you'll have difficulties selecting stamps using the wand. I strongly advise that you re-start the game after you fill the first map up.

Note: It is STRONGLY advised that each Stamp has at least 1 Starting Position with at least 4 possible tiles to settle in. Keep in mind that those tiles may well contain Monster Lairs or World Resources or Quests that prevent you from settling there. Unless you are careful, you may inadvertently create a starting position that the player cannot settle in. In order for a tile to be settlable, it must fulfil certain conditions that are too numerous to tell here, but SPECIFICALLY, one tile must be Plains or Forest, and it must be surrounded by 8 other tlies that are also Plains, Forest or River (no more than 4 forest!). ALL those tiles must also be either Kingdom or Empire environment (use Environment tool). That means that in order to create 4 suitable locations, you must cover an area that is at the very least 12 tiles large. Pay special attention to the Starting Position tile, because that is the one tile that is guaranteed not to contain Monster lairs or World Resources.

Note: Keep in mind your stamp may be rotated in any direction (north, east, south, west). Take this into account when planning your stamp. It must connect at all 4 corners to be sure that the Stamp will not create islands. Also consider how the stamp is laid out if it ends up in the very corner of a map.

If your stamp has Cliffs in it at the edges (remember, it shouldn't!), I suggest you go into the XML of the Stamp (\Documents\My Games\FallenEnchantress\Stamps) and search for Cliffs and then replace them all with "Land". Keep in mind, cliffs in the belly of your stamp can be safely turned into Land because they'll be turned back into Cliffs when the stamp is placed.

 

Examples of bad Stamps

Examples were replaced in 1.02 with new stamps, they are no longer broken but I keep them here as a demonstration of poor stamps.

Consider the following stamp: http://i.imgur.com/e783M.jpg. It is the infamous S_Generic_Medium_08 stamp (green borders). Notice the starting position in the top left. A very small starting position with only one direction to expand. There are Hills and Forests and Swamps that will slow the expansion down. To top it all off, once that player gets off the "long dong of doom", there is actually a starting position placed there which means there may be another AI placed there on what is the first natural expansion. And to make matters EVEN WORSE, the distance from the top-left starting position to the top-right small isle is perfect for the game to place top-level monsters there, such as Dragons and Umberdroths. If you start in that top-left position on this map, I suggest you kill yourself because you are going to lose. Even if the stamp isn't rotated horribly, is it still a fun stamp to have in a game? Potentially taking up ~40% of a tiny map? I don't think so.

Here is another stamp with a terrible start: http://i.imgur.com/RRNWS.jpg. The S_Generic_Medium_03 stamp offers similar problems as the one above. Over 20 tiles of Forest, Swamp, Hills. And the first natural expansion actually has another starting position, which means there's a good chance there'll be an AI there waiting.

But I think all those pale in comparison to this next stamp: http://i.imgur.com/k1lRU.jpg. The dreaded, instant-game ender S_Chasms_medium_05. The red cross is a starting position. It looks alright, doesn't it? A nice little peninsula with tile yields that will give you a decent start? WRONG. The Plains tiles around the starting positions get turned into Cliffs, which means with a nearby Champion, World Resource and Monster lair you are 95% certain to not get any settlable location at all. Making matters worse, there is a big nasty forest blocking your way off the peninsula (commonly ripe with Black Widows now).

 

Saving my Stamps

Once you are satisified with your stamp and have it selected like the screenshot above, Click Save Stamp and you'll be taken to this menu: http://i.imgur.com/wESWi.jpg

Make up a unique name for your stamp, then ignore all the other settings because I literally have no friggin idea what they do.

When it is saved, go into the Stamp XML (\Documents\My Games\FallenEnchantress\Stamps) and replace stuff as follow:s

Small stamp:

<Frequency>2</Frequency>
        <Style>Generic</Style>
        <Style>Fertile</Style>
        <Style>Swamps</Style>
        <Style>Forests</Style>
        <Style>Desert</Style>
        <Style>Chasms</Style>
        <Style>Mountains</Style>
        <Style>Rugged</Style>
        <Rules>65537</Rules>

 

Medium stamp:

<Frequency>2</Frequency>
        <Style>Generic</Style>
        <Style>Fertile</Style>
        <Style>Swamps</Style>
        <Style>Forests</Style>
        <Style>Desert</Style>
        <Style>Chasms</Style>
        <Style>Mountains</Style>
        <Style>Rugged</Style>
        <Rules>131073</Rules>

 

Large stamp:

<Frequency>2</Frequency>
        <Style>Generic</Style>
        <Style>Fertile</Style>
        <Style>Swamps</Style>
        <Style>Forests</Style>
        <Style>Desert</Style>
        <Style>Chasms</Style>
        <Style>Mountains</Style>
        <Style>Rugged</Style>
        <Rules>262145</Rules>

 

Large stamp:

<Frequency>2</Frequency>
        <Style>Generic</Style>
        <Style>Fertile</Style>
        <Style>Swamps</Style>
        <Style>Forests</Style>
        <Style>Desert</Style>
        <Style>Chasms</Style>
        <Style>Mountains</Style>
        <Style>Rugged</Style>
        <Rules>524289</Rules>

 

<Frequency> determines how often the Stamp will appear. 0 means never (used for Wildlands and Spell stamps that are placed through other means). 4 is very high. Keep in mind there are 121 Stamps in the game so it will take a while before you see your own.

<Style> determines for what map types the Stamp will appear in. When the player creates a Random map in-game he can choose a Map Type as well. Note that these Styles are not equal to the Map Type, they are subcategories. You can find more info about the specifics in CoreMaps.xml. A balanced Tiny map, for example, will select Generic stamps, but a Tiny Swamp map will choose Stamps with Styles Swamps and Rugged. The reason I included all the Styles in the above quotes is simply so the Stamps can appear in every Map Type.

<Rules> - this is what I have no idea how to generate properly when saving from inside the Cartographer. The Rules quoted above are copied from the vanilla stamps, and I don't know exactly what they do, but I do know that those rules will result in the Stamps appearing in-game in Random maps.

 

 

 

Questions?

 

Locked Post 24 Replies +5
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 5:49:19 AM from Elemental Forums Elemental Forums

very interesting! thanx for the writeup

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 6:24:00 AM from Elemental Forums Elemental Forums

Hmmm)

Awesome info here, lemme make some trys. I'm trying to make my 12x8 + map sizes dreams come true.

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 7:29:48 AM from Elemental Forums Elemental Forums

Good information there, Heaven!  Thanks!

I can say with certainty that each sector is 16x16 tiles, not 18x18. 

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 7:42:04 AM from Elemental Forums Elemental Forums

What makes you convinced? And why then is a huge stamp 51 tiles across?

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 9:05:57 AM from Elemental Forums Elemental Forums

Hm, stamps are different than I thought, sad

Sincerely
~ Kongdej

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 11:47:15 AM from Elemental Forums Elemental Forums


Make up a unique name for your stamp, then ignore all the other settings because I literally have no friggin idea what they do.

 

lol

 

Would be nice if we can figure this out.

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 11:49:43 AM from Elemental Forums Elemental Forums

This answered many questions I had. Thank you.

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 6:53:40 PM from Elemental Forums Elemental Forums

Quoting Heavenfall,
What makes you convinced? And why then is a huge stamp 51 tiles across?

If you place your cursor in the upper right corner and read the (X, Y) of a vanilla small map, the coordinates will be (79, 63).  Add one to each coordinate (because the tiles are numbered with zero base) making them (80,64) and then divide each by 16, you get (5, 4) the exact sector size of the map. 

Only the Devs can answer for certain why the stamps are the size they are, but I would guess Huge stamps are 51 across to provide overlap during the generation.  That way they can be a little less persnickity about how they lay them down.

Reason for Karma (Optional)
Successfully updated karma reason!
October 29, 2012 7:03:43 PM from Elemental Forums Elemental Forums

Good thinking, will update.

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 3:55:27 AM from Elemental Forums Elemental Forums

I am pretty sure stamps are not placed by grid alone but also by the specific terrain of the underlying tile

These elements of TerrainTypes.xml

 

<MinTilesPerSplat>0</MinTilesPerSplat>

<MaxTilesPerSplat>0</MaxTilesPerSplat>

 <MinBrushRadius>3</MinBrushRadius>

<MaxBrushRadius>6</MaxBrushRadius>

 

I believe have to do with marking a tile with terrain during the map generation process

 

Thats why you have things like

"Center Tile on underlying terrain" as an option or "Match Multiple Terrains"

 

So if the generation creates a tilemap like

(Imagine these letters which represent a terraintype (here I am just using Land, Forest and Mountain) are in the tilemap grid, 1 letter per tile)

LLLLLL

LLLMMM

FFFLLL

 

If it place a stamp that has Forest and Land the stamp will have to go over the an F and an L in the map if I marked "match multiple terrains". If it somehow chooses the last L of the last row and I chose "place on land" and "center tile on terrain" it will put (as best it can) the center of the stamp on that specific L tile. But also from looking at tons and tons of maps generated it also has something to do with the larger 16x16 grids cause centering stamps puts your stamps into nice neat rows and columns.

 

Also if you look in TerrainTypes.xml you will see some of the terraintypes have

<SuperCategory>Coastal</SuperCategory>

 

So I think that means if you check "Place on Land" and "Check SuperCatergory for terrain" it will treat forest on stamps as matching L (Land tiles) because Land is the forest terraintypes Supercategory. Again just a guess the super category matching could be the other way around or completly different.

 

So for instance from a few tests that were not always succesful if I want to avoid a hovering river mouth tile and have it on the edge of a stamp I could check "Place on Beach", "Place on edge", "Check Terrain Super Category". So no that stamp should go onto any terraintype wih a Coastal SuperCategory (Beach or Cliff) it should put the edge of the stamp pn that tile (so it would hopefully stick out more into the ocean based on its random rotation. Again this is all pure guesswork.

 

Please take everything I have said with a huge grain of salt it is all guesswork by me and we REALLY need a dev to come in and tell us how this all works.

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 4:04:44 AM from Elemental Forums Elemental Forums

Honestly as far as I know all those tags were abandoned early in the beta. If you start a game without any stamps available you'll get a map with an ocean only. If anything they might be used to pad out areas around  stamps with odd sizes.

Dev clarification would be nice.

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 4:12:09 AM from Elemental Forums Elemental Forums

Quoting Heavenfall,
Honestly as far as I know all those tags were abandoned early in the beta. If you start a game without any stamps available you'll get a map with an ocean only. If anything they might be used to pad out areas around  stamps with odd sizes.

Dev clarification would be nice.

 

I am actually pretty darn sure my guesswork is 90% wrong but with a huge grain of truth about the mystery of the generation algorithm. Like I know your right about how with 0 seeds you don't get any map at all but I think there is still and underlying data structure - a tilemap (matrix/multi-dimensional array/table/coordinate plane/choose your name here for rows and columns of squares) that is getting created and is used by the generation algorithm when placing stamps, again just a guess.

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 7:28:32 AM from Elemental Forums Elemental Forums

There's a lot of abandoned stuff in the XML. Is your theory backed up with examples of why it would work like that? The guesses you make are just confusing me right now. I'm unsure if you have actually tested your ideas about avoiding placing certain tiles in the middle etc, or if you're just throwing in random theories. If you haven't tested any of that, I'm sorry but why confuse the subject with elaborate guesses?

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 7:29:27 AM from Elemental Forums Elemental Forums

Quoting Heavenfall,
Dev clarification would be nice.

It would for certain, I will thank you again for taking your huge amount of time posting this.

Sincerely
~ Kongdej

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 7:36:16 AM from Elemental Forums Elemental Forums

Quoting LNQ,
There's a lot of abandoned stuff in the XML. Is your theory backed up with examples of why it would work like that? The guesses you make are just confusing me right now. I'm unsure if you have actually tested your ideas about avoiding placing certain tiles in the middle etc, or if you're just throwing in random theories. If you haven't tested any of that, I'm sorry but why confuse the subject with elaborate guesses?

All that I posted is from testing, no guessing. If I am unsure about something, I say so.

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 10:45:16 AM from Elemental Forums Elemental Forums

so can we simply get rid of bad stamps without issues ( as simple as deleting a file ) or would it require modding?

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 11:30:13 AM from Elemental Forums Elemental Forums

Yeah, just send them straight to the trash can.

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 2:20:17 PM from Elemental Forums Elemental Forums

sweet, thanx. I'm a say goodbye to those mentioned in the OP

 

any other ones bad enough to warrant The Axe?

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 2:47:25 PM from Elemental Forums Elemental Forums

There are some overpowered ones as well, one of the huge stamps has a single starting position with 5-6 settlable locations next to forest and rivers (with no competing starting position). But I think it's not good to delete too many stamps, especially huge ones.

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 4:18:05 PM from Elemental Forums Elemental Forums


I thought I was pretty clear it was mostly guessing but I have done too much testing in cartographer to be honest and I am still not totally sure about things work, what I listed was guesswork based on how the map generator acts and well as how the XML is laid out, the only person who truly knows how this works is the guy who wrote the map generation function/algorithm.

 

As far as not posting that just doesn't make any sense without documentation or developers posts were all in the wild here trying to figure this stuff out. If you have a thoery or testing about how it works post it some of us are spending many many hours trying to figure it out at present and could use any help/advice/testing/etc that anyone willing to brave cartographer and the xml is willing to put in.

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 4:44:05 PM from Elemental Forums Elemental Forums

I posted this in one of the map mod threads but it should be here as well as these are the main problems with Cartographer and map modding/scripting at the moment.

 

1) having to constantly reload the game when using cartographer to reload assets (stamps and other files when you change them outside the editor)


2) the selection wand not really working and having to click 100's times to get a stamp ready to save, or give up and select tiles manually.


3) No full understanding of the save options, nor the way splatting and brush sizing really works with terraintypes.xml and map generation. Also lack of options when saving a stamp, also why can't I choose "Place on swamp" or "Place on Desert".

*Note Heaven is right in that these elements are depricated but still in the XML, I also see all of the Stamp save options refering to individual tiles so I think it might still be used in the map generation process not to create any non-stamp random terrain but to place the stamps on the specific tiles.


4) Options are all saved as a single XML element "Rules" which I haven't been able to decypher, which prevents manual editing which means you always have to go into cartographer and resave a stamp. This is a massive problem trying to figure out what the save options for stamps actually mean as you can't just go in and edit the xml and load up cartographer to see what different rules (stamp save options) do.

 

5) River floating problems which have been described but not addressed by the developers it appears you best bet is to put the river "CliiffEnd" tile near the center of a stamp in well formed cliff and suuply at least a small lake of water tiles around the river "CliffEnd" before you save so it doesn't get its underlying terrain overwritten from being on an edge.

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 30, 2012 4:59:02 PM from Elemental Forums Elemental Forums

Quoting crimsongekko,
so can we simply get rid of bad stamps without issues ( as simple as deleting a file ) or would it require modding?

 

Your best option is to copy the files to the mod directory and change the frequency to 0 that turns the stamp off. This is actually one of the few nice things I have found. Frequency of say 4 means a map could have that stamp repeated 4 times, 1 will make it unique, 0 means it will never be used. This is useful for creating "template" stamps so if while your in cartographer you want to create a stamp you will only use for designing other stamps you can just by selecting "No Inclusion" for Frequency when saving the stamp or setting the value manually to 0 in the xml.  

Reason for Karma (Optional)
Successfully updated karma reason!
October 31, 2012 5:46:31 AM from Elemental Forums Elemental Forums

This is the correct map sizes in sectors if you allow for the compass rose sector.  In the Map Editor, you can place terrain under the compass rose.  Elementerra does not allow for the compass rose and those maps work fine.

Tiny Map: (Width 4) * (Height 3) = 12 - 1 = 11 Sectors.
Small Map: (Width 5) * (Height 4) = 20 - 1 = 19 Sectors
Medium Map: (Width 6) * (Height 5) = 30 -1 = 29 Sectors
Large Map: (Width 7) * (Height 6) -1 = 42 -1 = 41 Sectors

Reason for Karma (Optional)
Successfully updated karma reason!
October 31, 2012 6:01:11 AM from Elemental Forums Elemental Forums

That is indeed the total amount of sectors, but NOT the total used when placing random stamps. For the purposes of placing stamps, the game removes half a sector from each side of the map (turns it into an "ocean wall"), reducing width and height by 1 for all sizes.

I added this bit to the OP so people aren't confused:

Edit: Note that maps are technically larger as per http://forums.elementalgame.com/435333/get;3264664. But the above list is the relevant list of sectors for the purposes of random stamp placement.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108433  walnut3   Server Load Time: 00:00:00.0000625   Page Render Time: