Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New Feature: militia volunteer pool
New Feature: militia volunteer pool[message #339595]
|
Sun, 22 February 2015 20:47
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
While relatively small for a feature, I feel this is still worth a thread of its own...
Anyway, one problem with militia is that, once you have enough money and trainers, you can train infinite numbers of them. Of course, you might want to equip them, but I feel there is still room for improvement. Moa introduced ini-based upper thresholds for the maximum numbers of mobile militia one can have though.
In this feature, I add a different way to restrict the number of militia one can have. The goal is to force the player to not throw away his militia, but care for them - in this case because volunteers are limited. Hopefully, this is simple enough and easy enough to understand - my features have a habit of becoming confusingly detailed, which can be somewhat confusing.
Anyway, to train militia you now need volunteers - a new troop 'uses up' a volunteer. City sectors have an estimated number of civilians living there (since the introduction of disease, see SectorNames.xml ). If you control city sectors, and people are loyal there, you get more volunteers. More town sectors -> more loyal people -> more volunteers. Higher loyalty -> more loyal people -> more volunteers.
To add a strategic component ( and to reward the player if he doesn't turtle in in towns), any farm you control gives you a small percentage boni on estimated total loyal citizens. Thus in order to maximize your recruitment pool, you need to control both towns and farms.
Each time you liberate a town sector for the first time, you get a huge initial influx of volunteers. After that, the volunteer numbers are updated every hour.
In the lower left of the strategic map, you can see your current volunteer pool, and how many volunteers you get every hour.
The growth of volunteers can be set in JA2Options.ini:
[Militia Volunteer Pool Settings]
; If MILITIA_VOLUNTEER_POOL is TRUE, we have a limited volunteer pool. If we train militia, the pool is lowered, if we run out
; of volunteers we cannot train militia anymore.
; Each town sector has an assumed civilian population (see SectorNames.xml) and a loyalty value (the percentage displayed next
; to a town's name in the strategic map). population times loyalty equals loyal population.
; toggles this feature on and off
MILITIA_VOLUNTEER_POOL = FALSE
; Every hour we get loyal population times this factor volunteers for each town sector we control.
MILITIA_VOLUNTEER_POOL_GAINFACTOR_HOURLY = 0.001
; If we liberate a sector for the first time, we get loyal population times this factor volunteers instantly.
MILITIA_VOLUNTEER_POOL_GAINFACTOR_LIBERATION = 0.2
; Global loyal population size is increased by this factor for every farm sector we control.
; The reasoning is that controlling food supplies shows our commitment to the common people, and eases the food situation tremendously.
MILITIA_VOLUNTEER_POOL_MULTIPLIER_FARM = 0.05
So if, say, a city has a population of 500, and is 50% loyal, you receive 500 * 0.5 * 0.001 = 0.25 volunteers for it every hour. As I just coded this, I haven't tested whether these values are reasonable in a campaign - this needs testing by, say, you.
Note that militia hired from a PMC or recruited from prisoners does not use up volunteers. These might be valid options if, well, the population lacks the proper revolutionary spirits.
It would be possible to add extra volunteers for certain quests/sector liberations (rebels fully join your forces, prison liberated etc.), but I would like this non-hardcoded, so that any modder can use this for his altered campaign. Currently unsure about the best way to achieve that. Coded in r7880. You get extra volunteers for liberating Tixa and Alma, and for recruiting Miguel.
This feature is off by default.
This is fully savegame compatible. However, when switching to an exe with this, your volunteer will start at 0. Depending on your campaign, this might be an issue at first :-)
This has been added in r7746 and GameDir r2210.
Edit: As of r7886 & GameDir r2250, there is another way to get volunteers.
[Updated on: Sun, 15 May 2016 18:15]
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
|
|
Re: New Feature: militia volunteer pool[message #340089 is a reply to message #340073]
|
Mon, 16 March 2015 22:20
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
navaroe wrote on Sun, 15 March 2015 21:14I just wonder tough - when is farm controlled by me and when by the queen? When I enter a farmland sector, the number of hourly recruits doesn't change even on hour or beginning of a day. Even with sector, that was occupied by queen (but was explored previously). Basically whoever last entered a sector unopposed or won a battle there controls it, with all sectors initially belonging to the queen. As farms give a bonus to basic volunteer gain (+x%), but do not generate volunteers themselves, the effect might be very small in the beginning. Perhaps this might be the issue?
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
Re: New Feature: militia volunteer pool[message #340143 is a reply to message #340115]
|
Thu, 19 March 2015 19:08
|
|
navaroe |
|
Messages:78
Registered:August 2012 |
|
|
Because my current game is unplayable due to bug, I decided to start a new one and try "big bonus on farms, low base growth" aproach to this feature. This requires farms to be guarded. Here is content of GarrisonGroups.xml where all farms have garrison , type 25 - standard road block (except those already guarded otherwise).
Toggle Spoiler
<!--
This file defines garrisons in game.
Fields index:
Sector - it is where garrison will be sitting. Provide valid sector name.
Composition - it is composition index of garrison. Composition define quantity
and quality of enemy forces. Look into ArmyCompositions.xml for
more information.
NOTE: Maximum 100 garrisons can be used in game.
Changes require starting of a new game.
-->
<GARRISON_INFO>
<GARRISON>
<Sector>P3</Sector>
<Composition>0</Composition>
</GARRISON>
<GARRISON>
<Sector>O3</Sector>
<Composition>1</Composition>
</GARRISON>
<GARRISON>
<Sector>O4</Sector>
<Composition>1</Composition>
</GARRISON>
<GARRISON>
<Sector>N3</Sector>
<Composition>1</Composition>
</GARRISON>
<GARRISON>
<Sector>N4</Sector>
<Composition>2</Composition>
</GARRISON>
<GARRISON>
<Sector>N5</Sector>
<Composition>1</Composition>
</GARRISON>
<GARRISON>
<Sector>M3</Sector>
<Composition>3</Composition>
</GARRISON>
<GARRISON>
<Sector>M4</Sector>
<Composition>3</Composition>
</GARRISON>
<GARRISON>
<Sector>M5</Sector>
<Composition>3</Composition>
</GARRISON>
<GARRISON>
<Sector>N6</Sector>
<Composition>3</Composition>
</GARRISON>
<GARRISON>
<Sector>M2</Sector>
<Composition>4</Composition>
</GARRISON>
<GARRISON>
<Sector>L3</Sector>
<Composition>4</Composition>
</GARRISON>
<GARRISON>
<Sector>L4</Sector>
<Composition>4</Composition>
</GARRISON>
<GARRISON>
<Sector>L5</Sector>
<Composition>4</Composition>
</GARRISON>
<GARRISON>
<Sector>M6</Sector>
<Composition>4</Composition>
</GARRISON>
<GARRISON>
<Sector>N7</Sector>
<Composition>3</Composition>
</GARRISON>
<GARRISON>
<Sector>L2</Sector>
<Composition>5</Composition>
</GARRISON>
<GARRISON>
<Sector>K3</Sector>
<Composition>5</Composition>
</GARRISON>
<GARRISON>
<Sector>K5</Sector>
<Composition>5</Composition>
</GARRISON>
<GARRISON>
<Sector>L6</Sector>
<Composition>5</Composition>
</GARRISON>
<GARRISON>
<Sector>M7</Sector>
<Composition>5</Composition>
</GARRISON>
<GARRISON>
<Sector>N8</Sector>
<Composition>5</Composition>
</GARRISON>
<GARRISON>
<Sector>K4</Sector>
<Composition>6</Composition>
</GARRISON>
<GARRISON>
<Sector>G1</Sector>
<Composition>8</Composition>
</GARRISON>
<GARRISON>
<Sector>G2</Sector>
<Composition>7</Composition>
</GARRISON>
<GARRISON>
<Sector>H1</Sector>
<Composition>8</Composition>
</GARRISON>
<GARRISON>
<Sector>H2</Sector>
<Composition>7</Composition>
</GARRISON>
<GARRISON>
<Sector>H3</Sector>
<Composition>9</Composition>
</GARRISON>
<GARRISON>
<Sector>A9</Sector>
<Composition>10</Composition>
</GARRISON>
<GARRISON>
<Sector>L11</Sector>
<Composition>11</Composition>
</GARRISON>
<GARRISON>
<Sector>L12</Sector>
<Composition>11</Composition>
</GARRISON>
<GARRISON>
<Sector>J9</Sector>
<Composition>12</Composition>
</GARRISON>
<GARRISON>
<Sector>I8</Sector>
<Composition>13</Composition>
</GARRISON>
<GARRISON>
<Sector>H13</Sector>
<Composition>14</Composition>
</GARRISON>
<GARRISON>
<Sector>H14</Sector>
<Composition>14</Composition>
</GARRISON>
<GARRISON>
<Sector>I13</Sector>
<Composition>14</Composition>
</GARRISON>
<GARRISON>
<Sector>I14</Sector>
<Composition>15</Composition>
</GARRISON>
<GARRISON>
<Sector>F8</Sector>
<Composition>16</Composition>
</GARRISON>
<GARRISON>
<Sector>F9</Sector>
<Composition>16</Composition>
</GARRISON>
<GARRISON>
<Sector>G8</Sector>
<Composition>16</Composition>
</GARRISON>
<GARRISON>
<Sector>G9</Sector>
<Composition>16</Composition>
</GARRISON>
<GARRISON>
<Sector>H8</Sector>
<Composition>17</Composition>
</GARRISON>
<GARRISON>
<Sector>A2</Sector>
<Composition>18</Composition>
</GARRISON>
<GARRISON>
<Sector>B2</Sector>
<Composition>19</Composition>
</GARRISON>
<GARRISON>
<Sector>D2</Sector>
<Composition>20</Composition>
</GARRISON>
<GARRISON>
<Sector>B13</Sector>
<Composition>21</Composition>
</GARRISON>
<GARRISON>
<Sector>C13</Sector>
<Composition>22</Composition>
</GARRISON>
<GARRISON>
<Sector>D13</Sector>
<Composition>23</Composition>
</GARRISON>
<GARRISON>
<Sector>D15</Sector>
<Composition>24</Composition>
</GARRISON>
<GARRISON>
<Sector>G12</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>M10</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>G6</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>C9</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>K10</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>G7</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>G3</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>C5</Sector>
<Composition>26</Composition>
</GARRISON>
<GARRISON>
<Sector>A11</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>B12</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>B8</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>B6</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>B5</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>D6</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>E7</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>E8</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>E9</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>F10</Sector>
<Composition>25</Composition>
</GARRISON>
<GARRISON>
<Sector>J14</Sector>
<Composition>25</Composition>
</GARRISON>
</GARRISON_INFO>
[Updated on: Thu, 19 March 2015 19:09] Report message to a moderator
|
Corporal
|
|
|
|
|
|
|
|
|
|
|
Re: New Feature: militia volunteer pool[message #341279 is a reply to message #340949]
|
Sun, 31 May 2015 18:18
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
As of r7880 & GameDir r2246, there are 2 new functions in Scripts/strategicmap.lua:
- HandleSectorLiberation(...) is called whenever we liberate a sector, if fFirstTime is true, then this is the first time
- RecruitRPCAdditionalHandling(...) is called whenever we recruit a RPC
For now, this is used to give us extra volunteers if we liberate Tixa and Alma prison, or recruit Miguel, as this would be the point all remaining rebels join us. It would be cool if the 2 armed rebels in Omerta basement would join as full militia, but there are some issues with that (like the fact that militia are essentially forbidden undergound).
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
Re: New Feature: militia volunteer pool[message #341336 is a reply to message #341279]
|
Thu, 04 June 2015 00:03
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
As of r7886 & GameDir r2250, there is another way to get volunteers.
[Updated on: Thu, 04 June 2015 00:03]
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
Re: New Feature: militia volunteer pool[message #350394 is a reply to message #341336]
|
Tue, 25 July 2017 23:45
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
As of r8431 & GameDir r2379,
- recruiting any of the rebels gives you a small amount of volunteers, to show you the rebels are gradually joining your side.
- volunteers are now gained with a logarithmic rate, as otherwise the volunteer feature becomes pointless lategame. Previously you got to a point where you got so many volunteers that you'd have a hard time to even lower the pool. The formula is now
Volunteer gain per hour = ln(1 + loyal population * MILITIA_VOLUNTEER_POOL_GAINFACTOR_HOURLY)
instead of just Volunteer gain per hour = loyal population * MILITIA_VOLUNTEER_POOL_GAINFACTOR_HOURLY
with MILITIA_VOLUNTEER_POOL_GAINFACTOR_HOURLY now switched to 0.002 from 0.001 previously. This means that in the beginning, we will get volunteers a bit faster, while later on not as much. I'll leave to those interested to plot where the break even point is
[Updated on: Tue, 25 July 2017 23:46]
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: New Feature: militia volunteer pool[message #357086 is a reply to message #357079]
|
Fri, 29 March 2019 00:31
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
Uggs, there's probably a ton of threads I should answer :-(
Anyway, no. In this case, whether a sector has a farm is determined from Map/MovementCosts.xml. It's a farm if <Here> has the values FARMLAND or FARMLAND_ROAD.
One could then ask "Uh... why are those two xmls then, wouldn't one xml for all sector-related xml be easier to understand and maintain?", and one would right to ask that question.
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Sun Dec 01 22:05:37 GMT+2 2024
Total time taken to generate the page: 0.01715 seconds
|