Swamp as Default Terrain

I know it's possible to get Death Terrain, Grassland Terrain, Desert Terrain, and Arctic Terrain simply by changing the EnvironmentTerrainType values to 1 through 4, but how about Swamp Terrain? Is it possible to set SwampTerrain as a default terrain?

21,144 views 27 replies
Reply #1 Top

Did you try what happens if you set the value higher than 4?

Reply #2 Top

Yup, it's all generic terrain insofar as I can tell. I've started several games up testing values as high as 8 now, all genetic nothingness.

 

EDIT: I'm going to start a game with a lot of factions and set each one at one terrain value higher than the last, see if that works.

 

Edit: Rocky barren terrain was a mistake, it doesn't seem to be a terrain type I just got situated in a rocky barren area during a play test.

Reply #3 Top

CoreEnviroments.xml has the info but that type of terrain appears as commented.

+1 Loading…
Reply #4 Top

What about defining the terrain yourself with some tags. I dont know how to do this off hand, but I imagine looking over the terrain types might give you some clues. Perhaps copying one of the formulas and then assigning a generic terrain number to it along with the desired terrain type. Maybe that willl define it as swamp terrain and you can use that as a reference xml file.

I have been wondering about how we define things ourselves, but we need more info on the tags already used by the game engine. A list would be nice. =) ah well, I think i will wait till they fix the game them pester them about such things.

Reply #5 Top

^ Thanks, i'm having no luck with this, I can't figure out how to tell a faction to use swamp environment as it's default environment. Honestly I can't even figure out what's designating Death Terrain as 1, Grassland as 2, Desert as 3, and Arctic as 4. I've looked in several files trying to find this, to no avail.

Reply #6 Top

Quoting w34sl3, reply 4
What about defining the terrain yourself with some tags. I dont know how to do this off hand, but I imagine looking over the terrain types might give you some clues. Perhaps copying one of the formulas and then assigning a generic terrain number to it along with the desired terrain type. Maybe that willl define it as swamp terrain and you can use that as a reference xml file.

I have been wondering about how we define things ourselves, but we need more info on the tags already used by the game engine. A list would be nice. ah well, I think i will wait till they fix the game them pester them about such things.

 

The thing is I don't know how to make that work as a default terrain type within a factions zone of influence. I'm trying to get it to gradually change to swamp the way it gradually changes to Death or Grassland (or Desert or Arctic if modded) but I can't figure it out.

I tried assigning the Swamp terrain internal name, it doesn't seem to work. If I could figure out how Grassland is designated TerrainType 2, maybe I could figure out a way to designate Swamp terraintype 22 or something ;)

Reply #7 Top

I don't know how to script this sort of thing in this game, altering the numbers for EnvironmentTerrainType can't seem to find swamps, and adding anything besides a number results in just barren default landscape. Unless someone else can figure this out or I just randomly stumble on it, it's looking pretty hopeless.


I could throw Yithril in the desert, they border the desert... Tarth suits grassland good enough I guess.

Reply #8 Top

From what I can tell, Swamp isn't an Environment type, it's a Terrain type. Basically, you Barren Swamps, Grassland Swamps, Fallen Swamps, etc.

Uncommenting the Swamp environment type in CoreEnvironments causes all kinds of crazy Graphical glitches and has crashed every game I've played as soon as I hit End Turn. Adding a swamp Environment definition into every entry in TerrainType seems to help fix most of this, but still crashes the game. It also seems to end up making the Terrain type window register everything as 'Wastelands', when normally that only happens with Unexplored terrain. Kinda weird, but... *shrugs*

Reply #9 Top

I think swamp is bugged/disabled as an environment type.

 

Reply #10 Top

Quoting thehandofzarquon, reply 8
From what I can tell, Swamp isn't an Environment type, it's a Terrain type. Basically, you Barren Swamps, Grassland Swamps, Fallen Swamps, etc.

Uncommenting the Swamp environment type in CoreEnvironments causes all kinds of crazy Graphical glitches and has crashed every game I've played as soon as I hit End Turn. Adding a swamp Environment definition into every entry in TerrainType seems to help fix most of this, but still crashes the game. It also seems to end up making the Terrain type window register everything as 'Wastelands', when normally that only happens with Unexplored terrain. Kinda weird, but... *shrugs*

 

Hmmmm I guess there's just no way to make grassland swamp a default environment, since it's in the same category as Mountains and Forests. It kind of sucks but it looks like there are only 6 Environment types we can use

1: Death (Fallen) Terrain

2: Grassland (Kingdom) Terrain

3: Desert Terrain

4: Winter Terrain

And of course regular barren terrain.

 

Does anyone have any idea what gives the terrains their number designations?

Reply #11 Top

Quoting Valentine82, reply 10

Does anyone have any idea what gives the terrains their number designations?
I have always thought that it was the order in which those types of terrain appear in the CoreEnviroments.xml

Edit: starting by 0

Reply #12 Top

I had a look and could only find references to such numbering in the elemental.str file.

Reply #13 Top

Quoting Valentine82, reply 6

The thing is I don't know how to make that work as a default terrain type within a factions zone of influence. I'm trying to get it to gradually change to swamp the way it gradually changes to Death or Grassland (or Desert or Arctic if modded) but I can't figure it out.

I tried assigning the Swamp terrain internal name, it doesn't seem to work. If I could figure out how Grassland is designated TerrainType 2, maybe I could figure out a way to designate Swamp terraintype 22 or something

You need to re-define the new terrain type you want to use in a special XML all it's own, much like I have to do with all my custom skins because if I don't the DDS over-rides my skins on the basic models.

I'm sure what you want to do is doable. I think what you'll need to do is make a new "Swamp Terrain" MXL and make it useable as a terrain type by giving it it's own number. Should be possible but I'd need to look at it to make sure.

Reply #14 Top

But without even knowing how terrains get their numbers in the first place, and not being able to find any indication of it in any of the core files, I don't think that's doable. That requires code no one seems to have access too.

Reply #15 Top

Quoting Valentine82, reply 14
But without even knowing how terrains get their numbers in the first place, and not being able to find any indication of it in any of the core files, I don't think that's doable. That requires code no one seems to have access too.

You define the number. It's a "new" type, even though you're making it out of a type of land that exists already. As long as it's a number that's not being used, which it seems the higher ones aren't, you should be good to go. You just have to make that number reference the new ?copy of swamp" land type. It's hard to explain what I mean. It would probably be best if I just tried it myself this evening and see if I can get it to work for you.

Reply #16 Top

Problem is, there doesn't seem to be any where in the XML that defines say DeathEnvironment as a value of 1, GrassLandEnvironment as 2, and so forth.

 

Taken from elemental.str

 

[EnvironmentDisplayValue0] Barren
[EnvironmentDisplayValue1] Dead
[EnvironmentDisplayValue2] Grassland
[EnvironmentDisplayValue3] Swamp
[EnvironmentDisplayValue4] Desert
[EnvironmentDisplayValue5] Arctic

 

This is the only reference I can find.

And maybe because Swamp is commented out/bugged, it simply skips it, and thus value 3 = Desert, 4 = Arctic.

Reply #17 Top

Quoting Novaburst, reply 16
Problem is, there doesn't seem to be any where in the XML that defines say DeathEnvironment as a value of 1, GrassLandEnvironment as 2, and so forth.

 

Taken from elemental.str

 

[EnvironmentDisplayValue0] Barren
[EnvironmentDisplayValue1] Dead
[EnvironmentDisplayValue2] Grassland
[EnvironmentDisplayValue3] Swamp
[EnvironmentDisplayValue4] Desert
[EnvironmentDisplayValue5] Arctic

 

This is the only reference I can find.

And maybe because Swamp is commented out/bugged, it simply skips it, and thus value 3 = Desert, 4 = Arctic.

 

Oh hey thanks, that's in the Stardock Games\Elemental\data\English but I overlooked it because it wasn't an XML, this is interesting Swamp must be commented out for a reason if using it causes crashes. Maybe it's messing some necessary files/graphics related to Terrain Types.

Reply #18 Top

I've been bashing my head against this and this is what I've come up with so far.

TL:DR: It's not possible.

There are two layers to a tile in a map.

First is the terrain layer. It decides what the tile is, underneath it all. This can have the following values:

Land, Rugged Land, Desert, Hills, Swamp, City, Submerged, Mountain, Forest, Beach, Cliff

(there are also tactical tiles, but I won't talk about those for now)

The terrain layer is then modified by the environment layer, which is the second layer. The environment layer can have the following values:

0 Barren, 1 Dead (also known as fallen), 2 Grassland, 3 Desert, 4 Arctic

 

Terrain Types are defined in TerrainTypes.xml. A terraintype defines the core terrain, ie things like movement costs, who can walk on the tile, and so on. The terrain type also contains a sublist of each environment, where it is defined what each environment will look like, when applied to the terrain.

So, a desert terrain with the "dead" environment will look completely different from a Land or Rugged land tile with the environment Dead. A Rugged Land tile (to the right) with Arctic environment will look different than a Land tile (to the left) with arctic environment.

CoreEnvironments.xml contains only basic information about colour and decals (props, like the trees below).

So, in order to add a new type of environment, we need to first define it as an environment type as done in CoreEnvironments.xml. Then, we need to add this type of environment to each type of terrain (otherwise the game won't know how to react).

So far, in theory, all is well. Now is when we run into problems.

1) Environment types are in fact hardcoded. There's no way to add to the list of environment types. This is because of stupid programming design choices.

2) Environment types in TerrainTypes.xml are drawn only from the hardcoded list, and have no real connection with CoreEnvironments.xml. To clarify; the names of the environments are completely different in the files.They are referenced only indirectly through the hardcoded list. Thus, no matter what the tags contain, the order of the list is the most crucial piece of information - the game simply assumes that the first environment on the list is barren, and the second dead, and the third grassland. Since the list is hardcoded, there's no way to add a new environment to an existing terrain.

3) We can't add new terrain types either. It's a bit difficult to explain, but it appears that any new terrain type will simply overwrite the already existing one. For example, let's say we have Land, Rugged Land and New Land as terrain types. In New Land, I have opted to show Dead ground as swamp texture instead. However, this will retroactively affect Land as well. Rugged Land stays the same. I have no idea why.

Even -IF- we could add to the hardcoded list, it would just end up in the same way as spellbooknodes currently have. Ie two mods would not be compatible with each other.

 

 

 

 

 

Reply #19 Top

1) Environment types are in fact hardcoded. There's no way to add to the list of environment types. This is because of stupid programming design choices.

That's a really dumb thing to be "Hard Coded". Modifying this is something a Lot of modders would want to do when creating custom races and factions. I'd create a Race that likes the arctic and I would want their land spread to be an Arctic type. If I created a lizard race (Quendar) and in my lore they liked swamps, I would want them to spread out swamp lands. This is just common sense that people would want to mod in this stuff as it lends its-self to what's already in game.

Hopefully this is changed soon or we'll get access to the Python API's and hopefully we can change it then.

Reply #20 Top

Quoting Heavenfall, reply 18
3) We can't add new terrain types either. It's a bit difficult to explain, but it appears that any new terrain type will simply overwrite the already existing one. For example, let's say we have Land, Rugged Land and New Land as terrain types. In New Land, I have opted to show Dead ground as swamp texture instead. However, this will retroactively affect Land as well. Rugged Land stays the same. I have no idea why.
The odd part about this one is that it mainly appears to be a visual corruption. I added a new terrain type with a custom description and gamemodifier that gave defending units -5 health regeneration. (It was a fun experiment for the two turns before my Sov died). It didn't seem to override how any of the old terrains worked, just the way looked. In my case, all Land used the appearance I'd defined for "TestTerrainType," but there was a distinction between Land and TestTerrainType in both the tooltip window and the (very painful) effect.

I definitely wish we had more info on how this was supposed to work. I'm honestly not sure if it's really hard coded or just a bug instead.

Gnilbert

Reply #21 Top

I was able to find a work-around for 3)

Essentially, if all the types were re-defined in the mod, a new terrain type could be added on top of that.

This would lead to the terraintype properly being added to the mapfile

    <TerrainTypeInfo>18,Land2XXXXXX</TerrainTypeInfo>

The game will freeze if map is loaded without the addon. An artifact of the work-around is that all terrain types are listed twice in the map editor.

 

Edit: So, I guess that takes us one step closer to being able to cast spells that produce hostile terrain. Forget about the AI caring, though.

Thinking about it, maybe this combined with a decent world prop could make us be able to cast spells that produced castles and such. We could even add tactical maps to the terrain type. I'll see if I can cook a spell up, would be pretty neat.

Reply #22 Top

Quoting Raven, reply 19
Modifying this is something a Lot of modders would want to do when creating custom races and factions.
Not the casual modders that won't go beyond the Workshop.

I cannot wait to bypass the Kingdom/Empire filter in the Faction selection menu... between other things.

Reply #23 Top

No problem creating the new terraintype with a spell. The right tooltip displays it as "[environment] [terrain displayname]", so a tile within an arctic influence sphere with the displayname 'new land' becomes "Arctic New land".

Now all we need is to link that up to a pioneer type item.

Then specify a tactical battle that is appropriate.

Then we can build stuff on the world map outside cities for tactical combat and other effects on the unit defending.

Reply #24 Top

*head explodes*

Thanks for figuring this out, I spent hours looking through the different codes trying to make some kind of sense of it, tweaking stuff, looking in vain for tutorials. I ended up just giving up.

Reply #25 Top

Well, this won't do what you wanted in the start. I mean, I think you wanted swamps to spread inside your influence sphere. This won't do that.

 

Edit: This could probably have some fun use in tactical battles as well. Like creating tiles with modifiers on them. I don't know if the terrain-alter modifier works in tactical combats though.