Modding administrative and economic parts

Moderator: Pocus

Post Reply
kronenblatt
General - Carrier
General - Carrier
Posts: 4778
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Modding administrative and economic parts

Post by kronenblatt »

If I were to mod administration and economy in FoGE, nationally as well as regions and provinces, in order to make regions and provinces less profitable and useful, the farther from the capital they are: which files would be the natural ones to look in and amend? And which variables?
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
Pocus
Ageod
Ageod
Posts: 7704
Joined: Tue Oct 02, 2012 3:05 pm

Re: Modding administrative and economic parts

Post by Pocus »

As there are only a few examples of editing the scripts, I'll provide a detailed explanation. Anyway, to edit the scripts in the long run, you'll need to have some experience in programming (and that won't be possible for me to guide by hand every modding requests dealing with scripting changes). What I can do though is replying to people not finding a function or not knowing where to find something.

In Data\Scripts\Faction.bsf

At line 3042:
// 2 - Number of structures in each region (no discount)
result += ADMIN_BURDEN_STRUCCOEFFh * Pow(Region_Structures_Count(regionID), ADMIN_BURDEN_STRUCPOWERh, 100)

This is the part which depends of the content of the region. You'll want to alter that depending of the distance to the nearest capital of the faction (this gives benefits from having multiple capitals, which is good)

So first store the current value calculated for the region in a new variable, say:
regionalVal = ADMIN_BURDEN_STRUCCOEFFh * Pow(Region_Structures_Count(regionID), ADMIN_BURDEN_STRUCPOWERh, 100);

then call the function returning the nearest capital. This will return the capital ID and the distance to this capital, stored in gResult. See the explanations at line 10.900:

// NEAREST CAPITAL ID
// Returns the regionID
// in <gResult> returns the distance, in map coordinates (70.000 is Rome-Tarente)
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FUNCTION Faction_Politic_NearestCapitalID(factionID, regionID)

--
You thus call this faction and store the capital ID. gResult has been updated too. for example capitalID = Faction_Politic_NearestCapitalID(factionID, regionID);

Then you might decide that a distance of 250.000 map coordinates is your coefficient 1. More will be costlier, less will be cheaper.

Code: Select all

if (capitalID > 0)
{
  gResult = Max(62500, gResult) // coeff will not be below 25% 
}
else
{
  gResult  = 750000 // not having a capital is equivalent to triple distance everywhere
}
regionalVal = DivideAndRound(regionalVal * gResult, 250000)
And then you add this modified regional value to the current tally, so:

result += regionalVal;

Hope this helps.
AGEOD Team - Makers of Kingdoms, Empires, ACW2, WON, EAW, PON, AJE, RUS, ROP, WIA.
kronenblatt
General - Carrier
General - Carrier
Posts: 4778
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Modding administrative and economic parts

Post by kronenblatt »

Excellent: thanks! I'll start off with that and take it from there. I'm no programmer, but I've been doing some programming both professionally and for fun, in e.g. Basic, VBA and MatLab, and have also been modding the Paradox Paradox games EU3 and EU4 extensively. So step by step... :)
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
Pocus
Ageod
Ageod
Posts: 7704
Joined: Tue Oct 02, 2012 3:05 pm

Re: Modding administrative and economic parts

Post by Pocus »

Ah very good! I think you have the necessary skills to script in the Archon language then, it is rather accessible, most of the time.

Keep me posted, if you are stuck I can always try to help.
AGEOD Team - Makers of Kingdoms, Empires, ACW2, WON, EAW, PON, AJE, RUS, ROP, WIA.
kronenblatt
General - Carrier
General - Carrier
Posts: 4778
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Modding administrative and economic parts

Post by kronenblatt »

Pocus wrote: Sat Jun 06, 2020 5:59 am Ah very good! I think you have the necessary skills to script in the Archon language then, it is rather accessible, most of the time.

Keep me posted, if you are stuck I can always try to help.
Thanks: appreciated! I have one map-related question actually (so not on scripting): what is the dimension or size of the map, expressed as map coordinates? And what would thus be the maximum possible distance, from lower right corner to upper left corner of the map (the hypotenuse, I reckon)? (Also in order to relate to the 70 distance between Roma and Tarentum.)

EDIT: It seems that map size used is 1024 x 1024, correct? And that the axis difference between Roma and Tarentum is 60(x) and 35(y), making the hypotenuse and hence distance around 70?
EDIT2: At the same the distances for gResult are in thousands, it seems: such as 70.000 (is that 70 or 70000?), 62500, 250000. Could you please clarify? Thanks!
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
Pocus
Ageod
Ageod
Posts: 7704
Joined: Tue Oct 02, 2012 3:05 pm

Re: Modding administrative and economic parts

Post by Pocus »

I never dug too much into that, but I would say the map coordinates are in 1/1000 of pixels. So it's 70k and not 70.
AGEOD Team - Makers of Kingdoms, Empires, ACW2, WON, EAW, PON, AJE, RUS, ROP, WIA.
kronenblatt
General - Carrier
General - Carrier
Posts: 4778
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Modding administrative and economic parts

Post by kronenblatt »

Pocus wrote: Sun Jun 07, 2020 8:46 am I never dug too much into that, but I would say the map coordinates are in 1/1000 of pixels. So it's 70k and not 70.
Ok, thanks: then I know.

Which map file is used for the coordinates and thus for the calculations of distances?

(There are several map files: some 8192 x 8192 and some 1024 x 1024.)
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
Pocus
Ageod
Ageod
Posts: 7704
Joined: Tue Oct 02, 2012 3:05 pm

Re: Modding administrative and economic parts

Post by Pocus »

The distances are probably not in pixels really, but in 'map coordinates', and the system is based on a 1024x1024 map. The values are expressed in 1/1000 of map coo to avoid displaying or using float numbers.
AGEOD Team - Makers of Kingdoms, Empires, ACW2, WON, EAW, PON, AJE, RUS, ROP, WIA.
kronenblatt
General - Carrier
General - Carrier
Posts: 4778
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Modding administrative and economic parts

Post by kronenblatt »

Pocus wrote: Mon Jun 08, 2020 7:40 am The distances are probably not in pixels really, but in 'map coordinates', and the system is based on a 1024x1024 map. The values are expressed in 1/1000 of map coo to avoid displaying or using float numbers.
Super : then I know. Thanks!
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
Post Reply

Return to “MOD”