Elemental Modding: Part 1 – The Basics

The first thing to understand about Elemental is that almost everything is put into the DATA directory of Elemental (in program files\stardock\elemental.

By contrast, things you mod should go into the documents\my games\elemental\units directory in general (eventually we’ll just put a general mods directory).

Inside the Data folder is the English directory. As its name implies, we switch this directory based on localization (so there will eventually be a German, French, Spanish, Italian, Polish, Russian, etc. directory).

If you change HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Stardock\Drengin.net\Elemental to have language be say German, I THINK you can actually create a sub-directory called German, copy everything from English into it and start making a German version but I haven’t tried this yet.

Basic Rules to Follow

Here are some basic rules to follow:

  1. The files are irrelevant. Don’t try add on to an existing file. Create a new file. My suggestion is to create files named like UserName_TypeOfFile (example: Frogboy_KlingonRace.xml)
  2. The directories matter. The game scans certain directories at certain times during loading. It goes by the XML keys inside the files and loads them as necessary. Units get loaded up at the launch of the game (something we need to fix because it causes the game to kind of hang).
  3. The XML keys are the (no pun intended) the key. For instance, there’s a file called CoreBoots.xml. The game could care less about that. What it does care is that at the top of the file it says <GameItemTypes>. That means the game will read these in as game items.
  4. Be aware that these XML files have to be read in by the game. If you find loading slow, it’s because it’s parsing megs of XML files as is. It’s a constant battle we’ve faced – wanting to give you fancy stuff without slowing down the loading of the game.

The Basic Objects

Near the top of any XML file you can find out what type of objects are going to be in that file. Elemental has only a handful to deal with:

  • GameItemTypes (things a unit may have on it)
  • UnitTypes (Types of units – a dragon, a bandit, an ogre, Procipinee)
  • MapTypes (Types of maps, currently tiny, small, medium, large, tactical). You can add your own of any size.
  • Spells (Spell Definitions – Fireball, Haste, etc.)
  • TerrainTypes (want more terrains? You can add plenty of additional terrains, this is also where you specify what tactical battle maps should come up. In beta 4, we only have 1 per terrain. yawn)
  • Campaigns (want to make your own RPG? This object type defines them)
  • ImprovementType(for adding city improvements)
  • Quests (defining quests)
  • TileDesigns (these are created by the tile editor) Nearly all our XML files in the game are these.
  • EffectBlueprints (these are credit with the effects editor)
  • GoodieHutTypes (these are the notable locations)
  • QuestLocations (these are where quests originate)
  • MultiplayerMaps (these are maps that will be used as seeds for single and multiplayer)
  • AbilityBonuses (this is where special abilities are added for units, in beta 4 we don’t really use this but in the release version we will)
  • RaceConfigs (this is where you define entirely new factions)
  • TechTrees (this is where we specify specific technology trees. In beta 4 we only have two, eventually each faction will get its own)
  • AIPersonalities (this is where we define AI personalities for use by the game, in beta 4 we only have 1. And until i’m happy with the AI, there will only be 1 made by me).

Over the coming weeks, we’ll go over this one by one. If someone wants to put this into a wiki and elsewhere, that would be great.

86,508 views 18 replies
Reply #1 Top

Over the coming weeks, we’ll go over this one by one. If someone wants to put this into a wiki and elsewhere, that would be great.

https://forums.elementalgame.com/390029 It's not quite the same as a wiki, but it is handy for finding guides and such about specific topics. It might be something you want to sticky.

Anyway, that aside, thank you for this, it is very helpful.

Reply #2 Top

Well, localization of the mods is a great idea. However some languages have big problems with fonts, because they have characters, that are not in english. Have you thought about it? Do you check code page of the sources? The common problem is windows-1250 and UTF-8 mishmash.

Reply #3 Top

I started translating the elemental.str to spanish* (a backup somewhere else due to lack of SVN). I can say that with the current UI, it feels better butchering the words or to go and redesign all the UI to make sure that it's readable in a language that in general takes more space for its words.

Still starting to dabble with the files so... where can I make that the merchant in the shop shows a different model for my custom faction? The XML files doesn't seem to have more than the definition of the guy (I already created the other model and had it "overwrite" the default) so I suppose it goes by the DXPack of that window? Considering how many things depend on the XML data of each faction, I was hoping that was another one.


* out of curiosity. I'm not sure it's worth the time

Reply #4 Top

Quoting Wintersong, reply 3
I started translating the elemental.str to spanish* (a backup somewhere else due to lack of SVN). I can say that with the current UI, it feels better butchering the words or to go and redesign all the UI to make sure that it's readable in a language that in general takes more space for its words.

Still starting to dabble with the files so... where can I make that the merchant in the shop shows a different model for my custom faction? The XML files doesn't seem to have more than the definition of the guy (I already created the other model and had it "overwrite" the default) so I suppose it goes by the DXPack of that window? Considering how many things depend on the XML data of each faction, I was hoping that was another one.


* out of curiosity. I'm not sure it's worth the time

I wouldn't worry too much about word-mash in the current UI. There will be a new UI in gold, and prolly flex improvements in 1.0.

Reply #5 Top

I thought , Elemental xml parser are hundling xml files as iso-8859-1 , under x:\Program Files\Stardock Games\Elemental\data\English xml files.

That xml files' encoding  definition should change iso-8859-1 to utf-8 , and also xml parser changed hundling xml as utf-8.

It will be much boost make localization MODs

 

Sorry my bad Eng ...

 

Reply #6 Top

Serious? We need to have XML knowledge? This is my first disapointment about Elemental. Why no visual tools or something?

Reply #7 Top

Quoting Filthgrinder, reply 6
Serious? We need to have XML knowledge? This is my first disapointment about Elemental. Why no visual tools or something?

It depends what you want to achieve. Map generation, Tile generation and a view others can be achieved internally. If you want to make more complex setups or generate more not out of the box, you can dig into XML :-)

Personally, I can better work writing in different languages compared to my poor artist skills :-)

Reply #8 Top

Serious? We need to have XML knowledge? This is my first disapointment about Elemental. Why no visual tools or something?

There are a number of In game tools. You can create particle effects, buildings, Tiles, quests(when the tools are finished), and an assortment of other things.

the xml/python editing will be for the more extreme edits.  Like say adding the 'Flying fortress of Lum the mad'(i.e. a floating moving city) or other such.

+1 Loading…
Reply #9 Top

ah ok, thanks

Reply #10 Top

Ummm, it doesn't get much more human readable than XML (hence the long load times). They did us a huge favor by using XML vs. other languages that would take people a while to learn if they didn't know them already. I am sure there are those who are working at coding some visual tools for the XML though...however it is probably prudent to wait til gold for those since there things still in flux.

Reply #11 Top


If someone wants to put this into a wiki and elsewhere, that would be great.

 

Hello Frogboy,

My site is not yet ready but when it is I will have a full wiki on modding. I will add this information there.

 

http://www.ultimateelemental.com/

(it should be ready in 1-2 weeks depending on how much I'm playing/modding Elemental)

 

Also, I am hoping soon there will be a real mods folder, where you can have a separate folder for each mod you make... then we can truly start modding.

Reply #12 Top


By contrast, things you mod should go into the documents\my games\elemental\units directory in general (eventually we’ll just put a general mods directory)

Would love to see ..\My Games\Elemental\Mods\ or similar created, before things get too messy.  Having a custom version of CoreDifficultyLevels.xml in ..\Units offends my OCDness.


On a mildly related note, if one wanted to distribute a set of difficulty settings - or a great many other modifications to Core*.xml, there isn't a category in the mods upload/download UI in game that makes sense (i.e., these aren't maps, tiles or quests).

Reply #13 Top

What about something like \Elemental\Mods\ModName\?  Would this be easier to manage more complex mods that may consist of lots of xml files? For some of the more involved mods, when an update would be made available I would think it would be easier to instruct someone to delete a specific folder vs. specific files.

I don't know if the game currently scans through sub folders.

Reply #14 Top

Hello. I started translating the elemental.str to Russian, but the game don't react on my alterations. It's still English instead of my actions.

I tried to follow instructions:

The first thing to understand about Elemental is that almost everything is put into the DATA directory of Elemental (in program files\stardock\elemental.

By contrast, things you mod should go into the documents\my games\elemental\units directory in general (eventually we’ll just put a general mods directory).

Inside the Data folder is the English directory. As its name implies, we switch this directory based on localization (so there will eventually be a German, French, Spanish, Italian, Polish, Russian, etc. directory).

If you change HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Stardock\Drengin.net\Elemental to have language be say German, I THINK you can actually create a sub-directory called German, copy everything from English into it and start making a German version but I haven’t tried this yet.

I created new folder "Russian" in \Elemental\Data and copied all files from English to there. I changed language in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Stardock\Drengin.net\Elemental. I also switched On "Usemods" in the game, but language remained still English. And now I don't know what to try else.

Please, give me advice about this problem..

Reply #15 Top

I can't help you there but try posting this as a new thread in the mods section or in support if mods doesn't help.

 

Reply #16 Top

Over the coming weeks, we’ll go over this one by one.

Just curious as to if and when this is going to resume... 

Also, there seems to be a lot more object types than only those listed.  Dissecting and reverse engineering entails a lot of extensive (even if educated) guesswork.

Here are just a handful that I uncovered recently:

  • <ResourceTypes>
  • <RaceTypes> (different than RaceConfigs?)
  • <ImprovementTypes> (not ImprovementType as noted above)
  • <EnvironmentTypes>
  • <FlavorTextEntries>
  • <UnitSkinTextureDefs>
  • <UnitEyeTextureDefs>
  • <Techs> (different than TechTrees?)
  • <UnitGroupingTypes>

If it's not going to resume, can you let us know?  Thank you.

Reply #17 Top

Quoting vydger, reply 14
Hello. I started translating the elemental.str to Russian, but the game don't react on my alterations. It's still English instead of my actions.

I tried to follow instructions:

(...)

I created new folder "Russian" in \Elemental\Data and copied all files from English to there. I changed language in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Stardock\Drengin.net\Elemental. I also switched On "Usemods" in the game, but language remained still English. And now I don't know what to try else.

Please, give me advice about this problem..

There are two things to remember

1) Don't touch stuff inside []

2) Each time you alter elemental.str you need to remove file data.zip in Elemental\Data\<language> and recreate it by running elemental with a /CreateXMLBinary switch

If you adhere to these two conditions translating elemental.str works out of the box as described by Frogboy

Reply #18 Top

I started translating the elemental.str to Japanese It becomes as shown in the photograph though I am translating this game. How should I solve it?
I'm sorry English ..unskilled...