Logo Platform
logo amplifiers simplified

How to mod spawn preferences?

Reply
Copied to clipboard!
10 years ago
Nov 14, 2014, 9:01:08 PM
Hi guys,



I need some help trying to mod the spawn preferences for certain races. For example, I want a higher chance for Drakken to spawn in a temperate region with certain anomalies and map elevation. Or the Neocrophages spawning in swamp hexes with anomalies like mycordia. Or Ardent mages spawning next to wizard stone anomaly in a tundra region. Or Dust Lord spawning next to a Golden Tree anomaly. I tried experimenting with the worldgeneration.xml files but it doesn't seem to do anything (tested new games and I don't see a difference).



Thanks,

Jon
0Send private message
10 years ago
Nov 15, 2014, 4:06:02 AM
Saw this somewhere...



Bear in mind the following is theory, and I haven't tried it.



I don't know about elevation and temperature, but based on terrain types alone you should be able to change the spawn preferences...



In WorldGeneratorSettings.xml, you have this:

[code]









4

4

2

6

6

1

3

4

4

4

3

4

3

3

3

1

1

6

3

6

1

4

4

6

7

8

5

5

7

4

2

2

7

4

4

5

7

-35

2

2

0

0

0

0

0

5

8

7

8

5

11

8

9

6

8

11

8

6

8

6

9

8

11

9

11

6

8

9

11

11

11

9

9

9

8

11

11

6

8

9

6

8

0

7

5

7





14

21

15

21

21

15

21

21

21

15

14







5

5

3





0

4

1

7

3

0

7

6

6

6

4

2

8

2

0



1

2

1

9

11

5

7

2

6

3



-40







0

7

7

7

8

5

9

10

8

11

8

9

8

11

8

11

8

8

9

8

9

11

8

7

9

7

5

8

8

5

8

7

9

11

8

7

7

9

2

9

10

7





[/code]



The way that I believe it works is:

1) Generate world and regions.

2) For each faction, look at each region

3) For each region, add up the spawn preference values to get a "region value"

4) Spawn the faction in the region with the highest region value



Spawn preference values can be negative or very positive. So for example, for the Necrophages, you want a very high chance of spawning in a region with Anomaly30 (Mychordia: 2 food, 6 science, 10 approval), but a low chance of spawning in a region with Anomaly43 (Golden Tree: 2 industry, 8 dust, 20 approval):

[code]



100

-50



[/code]



The names of all of the different tile types, including anomalies, can be found in these files:

EF_Localization_Locales.xml

EF_Localization_Assets_Locales.xml



The "index" is found in these files:

GuiElements[Affinities].xml

GuiElements[Anomalies].xml

GuiElements[Terrains].xml



The FIDS values for anomalies and other terrain can be found here:

SimulationDescriptors[Anomaly].xml

SimulationDescriptors[TerrainType].xml



To test whether it's working, you could bump the values up to something stupidly high, like positive 500 for a preferred anomaly.

If it doesn't work, there's the possibility that spawn preferences are either still hard-coded or aren't actually being used.



Side-note: It's curious that broken lords (a dust-dependent faction) have a VERY NEGATIVE weighting to Golden Tree - a very good dust anomaly. I checked the other values, to see whether our understanding was reversed and in fact lower weightings were preferred, but for the broken lords, food anomalies all have lower weighting and dust anomalies all have higher weighting. So higher is preferred.
0Send private message
10 years ago
Nov 15, 2014, 4:13:19 AM
In WorldGeneratorSettings.xml there's also this to consider:

[code]









...

















...







...









































































































































...





[/code]



So it appears there's a minimum as well.



Also, if Golden Tree only appears once on the map, then I guess it makes sense that no one should spawn with it. But then, that anomaly should be equally negative-valued for every single faction, not just the broken lords.



EDIT: I've created a spreadsheet of all of the default FIDS values for different tiles and their spawn preference values:

el tile values.xlsx



Results are inconclusive. Sometimes it seems to work, sometimes it doesn't. I've been putting absurdly high weights like 1000 - but there's the possibility that other factors are at play, or it simply is hardcoded.



EDIT: After checking out mindthirst's mod, we should be able to test this under more controlled conditions...

Nope. Doesn't seem to work. I always spawn in the exact same spot, irrespective of those values. Sorry I wasn't any help.
el tile values.xlsx
0Send private message
0Send private message
10 years ago
Nov 15, 2014, 7:59:04 PM
Generally, in order for a change to even be parsed by the mod loader in the game, that part of the mod has to be referenced in the special mod description xml file. Indeed, I modified the number of minor villages in the player spawn regions, with no effect in game to make sure. However, referencing the WorldGeneratorSettings file as a database plugin crashes the loader. Appearently, if you look at the top of the file, it's not technially a database. Similar to the registry files, it uses a unique name at the top level of the file. I attempted the following in the mod file just to hope it would work, but this name didn't work:

[CODE]



WorldGenerator/WorldGeneratorSettings.xml

[/CODE]



It's possible there is some similar name. The other thing that might be worth trying is loading it as a database plugin anyways and reference >EVERY< extra data type in it. Does anyone know if simply not including all data types in the file causes the mod loader to fail, even if the unlisted datatypes are unused?



EDIT: I tried not listing a used datatype in different (functioning) mod, and it didn't crash, it just didn't load that datatype.



EDIT2: I've experimented with a variety of settings in the mod file. Loading any database without listing a datatype will crash the loader. Loading the WorldGeneratorSettings file with either POIAlgorithmParameters or Algorithm cause the loader to crash. I tried loading it as a registry, which didn't crash the loader, but had no effect in-game (registries use a different format, for example, registries don't use quotation marks around a number for an entry). I've failed so far to get any kind of change for world generator settings data to work in-game.



Since the top level variables can be altered successfully (such as ), I did try create a new variable of that kind, called , and then reference it in the other data, in this case theMinSitesPerSpawnRegion and MaxSitesPerSpawnRegion parameters like so:

[CODE]

[/CODE]

This did not have any effect on the game. I'm currently unsure of which parts of the data system make use of the $ mechanic to get a value of a variable. I've seen it done in the registry (I may have seen it elsewhere too, I don't remember).



I'm done experimenting on that for now, but may try more later. Hopefully someone can figure out whether this is possible, or if there's some kind of work around if it it isn't supported yet. Cause I would definitely like this to be possible for the mod I'm working on.



EDIT3: I tried modifying the values in the file in the original public folder, rather than using the new mod loader, and that does affect the game correctly. The issue seams to be that the mod loader specifically only loads things referenced in the special mod info xml file, and there either is not currently, it there is not released info on telling the mod loader to include the world generator settings file.



If anybody knows how to tell the mod loader to do this, or if it is not currently able to, that would be greatly appreciated at this point, as it is not covered in the tutorial or the modding reference file.
0Send private message
10 years ago
Nov 16, 2014, 3:26:47 AM
mindthirst wrote:


EDIT3: I tried modifying the values in the file in the original public folder, rather than using the new mod loader, and that does affect the game correctly. The issue seams to be that the mod loader specifically only loads things referenced in the special mod info xml file, and there either is not currently, it there is not released info on telling the mod loader to include the world generator settings file.



If anybody knows how to tell the mod loader to do this, or if it is not currently able to, that would be greatly appreciated at this point, as it is not covered in the tutorial or the modding reference file.


Hmm... I see. So the issue is not that the parameters don't affect the game correctly, but that the mod doesn't load correctly. Not sure if this would work (because I'm not sure how it works), but there's this:

Pikou wrote:
As usual, thanks a lot for your feedback!

We will keep this in mind for further possible improvement.



About "Replacing Entire Files" I'm sorry I did not make that clear in the modding tutorial pdf but this is already possible.

There is a line at the very beginning of the reference file:





By default it is on "Conversion" Type because it is easier to manage for beginners.

But you can chose a "Standalone" Type which will replace the in-game file and not merge. Just be very careful to have all the required info in those file you replace.



I just made an update of the modding tutorial file but I will surely add this last info in the next one.



Cheers!




As you'd expect, simply changing the Type to Standalone doesn't work. It loads practically instantly, but crashes upon hitting new game. There's more that needs to be done. I'm curious whether you would need to duplicate every other file, or if it's just a matter of messing with the modding reference file.



EDIT: If mods only affect how the game (i.e. EndlessLegend.exe) on runtime interprets the XML files (i.e. implement changes, otherwise use defaults), then the world generator (i.e. Amplitude.WorldGenerator.exe) won't be affected. The world generator probably gets data from the game and the WorldGeneratorSettings.xml located in the same folder as the world generator executable. WorldGeneratorOptionDefinitions.xml just tells the game what options to present to the player, but the actual values chosen by the player are passed by the game to the world generator.

The world generator itself doesn't do the interpretation on runtime.

So our only bet is to somehow use a data table (WorldGeneratorOptionDefinitions.xml) to affect the desired "key" values before they are passed to the world generator. The only problem is that the "Key" is "SpawnPreferences", but within that there is "Faction" (which has a Name), and within that are the values for each terrain type (e.g. Anomaly43).

Would the following (nested KeyValuePairs) work? I'm not sure of the correct syntax, or if it's even valid.

[code]



Advanced







500









[/code]
0Send private message
?

Click here to login

Reply
Comment