Elemental Modding: Maps, Continents, Environments and Terrain

Having spent the weekend modding up Elemental I was able to find some weaknesses in our data driven system that I think we need to address sooner rather than later. 

This technical blog will discuss how worlds are made using the Elemental engine.

Maps

Map data in XML (e.g. mapsizes.xml) defines:

  • Name of the map type (e.g. “Really big”)
  • Map size in tiles (100,25)
  • A default amount of land vs. water ratio (that can be adjusted by the user) as a % (e.g. 75% water).

Map Style

Map Styles (e.g. mapstyles.xml) determine how land is prepared for the map and includes:

  • Name of the style (e.g. “islands”)
  • Seed range (e.g. 5 to 7) to determine the number of seeds to start from
  • Number of continents range (e.g. 5 to 7) to determine the number of total continents there should be at the end.

Environments

The environments (e.g. coreenvirnments.xml) controls where different types of terrain will ultimately be placed.

Examples would include arctic, temperate, tropical.

Environments would include where in the map they can exist (i.e. between 20% from the top to 40% from the top for temperate).

Terrain

Terrain is where things start to get very interesting and complicated.  Mountains, Swamps, Desert, Grasslands, Plains, Hills, and lots of different iterations of these would be types of terrain.

One would imagine inside of a coreterrains.xml things examples like:

Arctic_Hills which includes these controls:

  • What environment(s) it can be placed in
  • Its defensive value
  • Its movement value (1.0 for normal, 0.5 for 50% movement penalty, etc.)
  • Its Influence Type (e.g. “neutral”, “good”, “evil”, “smurfy”, whatever)
  • Its cloth map icon
  • Its 3D tile image (taken from tile editor)
  • Its rarity value (0 to 100%) – what % of the tiles are going to be seeded with this.
  • Its growth rate for N, S, E, W, NE, SE, SW, NW (i.e. growth.se 33.0  which would mean there’s a 33% chance that the tile to the SE of this seed will also be given this terrain type).
  • Its classification (forest, mountain, etc.) if there is something notable about this tile you can classify it (normally you wouldn’t need to do this but forests can be logged and you might want to have 20 different types of forests that all can be logged).

When two terrains compete for the same tile, the rarity value determines which one “wins” the tile.

Now, the reason all this is important is because we (Stardock developers and you guys) as a team are going to want many many months of monkeying around with this data.  We want people to be able to come up with not just “forests” in the generic sense but redwood forests, pine forests, deciduous forests, etc.  We don’t just want “plains” but a zillion different types of plains. 

On the cloth map, it’ll look pretty much the same.  But when we get to the 3D engine, this will matter because, over time, as people submit their own tile creations from the included editors, the worlds will continually get richer and richer and better and more interesting.

For example, in the beta you have right now, there are no hills.  As a modder, I should be able to add hills.  Hills are obvious.  I’m sure there are people reading this who have traveled and seen some great stuff that could be put into the game.

So that’s what’s been assigned out to get into by Beta 1D.

48,438 views 19 replies
Reply #1 Top

Forgive me but I don't see how these attributes will produce correctly placed tiles around a river. For that matter what will produce a mountain range composed of several types of tiles? Probably things will be further refined as code is written.

Reply #2 Top

The way of map creation is moddable as well, I hope. Not that i don't like it but there are very good map creation modders for Civ IV out there who completely override the standard placement of tiles and resources with fantastic results.

The expandable terran type thing sounds pretty promising and will hopefully add quite much to the mood of the world you're playing in.

edit: did I read this right that a tile can be either mountain OR forest but not both?

Reply #3 Top

Hopefully there's a way to plug arbitrary python code into the map generation process so the more intensive mods have a more flexible system to fall back on if the xml approach is too limited.

Reply #4 Top

This sounds freaking great! :smitten: :beer:

 

75% water map. Ya now I remember boats and navys are secondary right for development... maybe later on say in an expansion they get some love... or someone will go crazy and mod it in... :grin:

Reply #5 Top

Brad, thanks for all this info, and particularly for your enthusiasm that the modding features be done right and done right sooner than later.  It's very easy to let that stuff slip to the end of the development cycle where your programmers look at you with those puppy dog eyes while explaining that they really can't make that fundamental change without adding 2-3 months to the release timeline (and they're generally right, at that point).

One thing we'll need to make very sure of is that the python code can "hook into" all the important events in a turn,  So the c++ calls the python "PreStartOfTurn", "PreUpkeep", "PostUpkeep", "PreUnitMove", "PostUnitMove", same for "UnitAbilityUse", "UnitDamaged", "UnitDeath", etc, etc (a list of everything I can think of would be huge, and not even exhaustive).  Then there's making sure that those python functions have read/write access to all applicable game state, and for things like PreUnitMove be able to return an error saying "Don't allow this move, show player xyz error message".

Anyway, I won't write the book right now, but if and when you're ready for us to get seriously into making sure the modding features will have what they need, let us know :)

Reply #6 Top

My mind is practically blazing with ideas for terrain types. I can't wait to get started building. I'm hoping a lot of what I have in mind will become "cannon" once you get around to the evaluation process once people start submitting their own things.

Will the evaluation of user submitted work start during beta as well when that system is being tested or will that actually wait for launch?

Either way Excellent post, Brad. This makes me very happy. :thumbsup:

Reply #7 Top

Quoting Hawawaa, reply 4
This sounds freaking great!

 

75% water map. Ya now I remember boats and navys are secondary right for development... maybe later on say in an expansion they get some love... or someone will go crazy and mod it in...

Naval warfare? Hell yeah! [Note: The AI in Civ4 sucked in invading other continents. Not that it matters, since Brad's Elemental AI will kick the Civ4 AI out of the water. :P]

Reply #8 Top

The map needs a ton of work!

I'm not looking for a job right now but I have an online portfolio that is a pretty good example of what you can do with maps and modding Civ4. http://members.socket.net/~ricardo/ XML tags aren't enough, we need to be able to place any old thing on the map, any way we want, in any order we want, via python. In Civ4, different mods need completely different maps.

Here are some things I would like to see:

Rivers need to merge! I haven't seen any merging of rivers in any screenshot! You can't build a drainage network without merging rivers.

I would like to see lakes that can be inserted into the river system.

We need multiple maps! A single map was a huge limitation in Civ4, and lead to the proposal of many ugly workarounds that killed many mods! Civ2 got it right, MoM got it right, AoW:SM got it right! There are pathfinding considerations that need to be addressed here, so some forethought will be needed.

+2 Loading…
Reply #9 Top

Cephalo: Contact us.  We are hiring.

Reply #10 Top

Frogster: If you submitted your resume way back when you first announced openings and never heard anything back, should you just assume Stardock isn't interested?

Reply #11 Top

Quoting Hawawaa, reply 4
75% water map. Ya now I remember boats and navys are secondary right for development... maybe later on say in an expansion they get some love... or someone will go crazy and mod it in...

I'm quite sure that Frogboy mentioned something about "land based tbs" in one of his threads some time ago. It'd be a pity if the seas/oceans of Elemental cannot get more interesting in an expansion pack or something.

Quoting Frogboy, reply 9
Cephalo: Contact us.  We are hiring.

Like... wow. The day that the CEO of a company says something like that to me...:omg:

Reply #12 Top

The "user added content" aspect of this game doesn't get a lot of attention, but when you guys bring it up, you bring it up in ways that really get me excited for Elemental's future!

I love the idea of user-added terrain types that incorporate both terrain properties as well as new graphical appearances. I also hope this is applicable to water tiles as well (just plain rivers and ocean aren't near enough variety for water types!).

Reply #13 Top

Quoting cephalo, reply 8
The map needs a ton of work!

cephalo - go for the joooob! ;)

Reply #14 Top

Quoting cephalo, reply 8
The map needs a ton of work!

I'm not looking for a job right now but I have an online portfolio that is a pretty good example of what you can do with maps and modding Civ4. http://members.socket.net/~ricardo/ XML tags aren't enough, we need to be able to place any old thing on the map, any way we want, in any order we want, via python. In Civ4, different mods need completely different maps.

Here are some things I would like to see:

Rivers need to merge! I haven't seen any merging of rivers in any screenshot! You can't build a drainage network without merging rivers.

I would like to see lakes that can be inserted into the river system.

We need multiple maps! A single map was a huge limitation in Civ4, and lead to the proposal of many ugly workarounds that killed many mods! Civ2 got it right, MoM got it right, AoW:SM got it right! There are pathfinding considerations that need to be addressed here, so some forethought will be needed.

 

The 2 level map in MoM was quite fun. Was wondering if we would have that in Elemental.

Go for the job cephalo!

Reply #15 Top

Yes, you should definitely go for the job Cephalo! Your work on the Civ IV map generator is amazing, I would love to see some of that talent make it's way into Elemental :P

Reply #16 Top

Quoting Nathan, reply 14



Quoting cephalo,
reply 8
The map needs a ton of work!

I'm not looking for a job right now but I have an online portfolio that is a pretty good example of what you can do with maps and modding Civ4. http://members.socket.net/~ricardo/ XML tags aren't enough, we need to be able to place any old thing on the map, any way we want, in any order we want, via python. In Civ4, different mods need completely different maps.

Here are some things I would like to see:

Rivers need to merge! I haven't seen any merging of rivers in any screenshot! You can't build a drainage network without merging rivers.

I would like to see lakes that can be inserted into the river system.

We need multiple maps! A single map was a huge limitation in Civ4, and lead to the proposal of many ugly workarounds that killed many mods! Civ2 got it right, MoM got it right, AoW:SM got it right! There are pathfinding considerations that need to be addressed here, so some forethought will be needed.


 

The 2 level map in MoM was quite fun. Was wondering if we would have that in Elemental.

Go for the job cephalo!

Hm.....this is a good question. I always liked the multi level maps in AoW 2. too. :)

Reply #17 Top

I hope the dungeons will be implemented in a way that you can use them for multiple maps if you want to.

Reply #18 Top

Cephalo, I downloaded your PerfectWorld but I don't know how to make Civ4 use it.  Can you link me to some good instructions about how to use it in game? 

Thanks.

Reply #19 Top

#
# A default amount of land vs. water ratio (that can be adjusted by the user) as a % (e.g. 75% water).

How can we get a random value?

  • Seed range (e.g. 5 to 7) to determine the number of seeds to start from
  • Number of continents range (e.g. 5 to 7) to determine the number of total continents there should be at the end.

Same. How do you get random? Is it possible to have somethign different as a driving factor? What are the seeds about and why would the end user care about that weird thing?

As others said, there are maps done for Civ IV which were totally redone. I don't think you can do a much better work than what Firaxis did in opening their map generation. Both the C++ and python codes are available so doing something similar should be straightforward.

Regarding terrain types, I would like to have a terrain generation that generates mountain ranges placed intelligently (tectonics...). Civ IV provided three features for a plot: a terrain (flat/hill/mountain/ocean), rivers, features (forest/flood plains/...) and a climate (don't remember the name, but snow/plains/prairie/desert).

This allowed for a lot of flexibility, ad you could add jungle on desert if you wanted to without having to redo graphics. The system you propose looks like it's harder to extend, as if I want a snow plains and snow hills, I'd have to create two textures even if I could do with a single one? Placement of trees on 3d terrain may be done better if it's done separately for every tile. I mean saying I can have 'dedicuous forest prairie', 'dedicuous forest plains', 'pine forest praire', 'pine forest plains', "pine forest tundra' is fine if I do this in xml, it sucks if I have to create 5 3d assets when it could be the combination of 2 forest assets with preexisting flat land assets.