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 Go to next message
Flugente

 
Messages:3509
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.
http://i.imgur.com/vTFMmu6.png?1
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

Captain

Re: New Feature: militia volunteer pool[message #339596 is a reply to message #339595] Sun, 22 February 2015 21:29 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Very cool. This is flat-out realistically great! With all the new militia mods I can see that I'm going to have re-do my entire tweaking of militia. Since all of your militia changes are so good, I won't mind a bit!

Report message to a moderator

Sergeant Major
Re: New Feature: militia volunteer pool[message #340073 is a reply to message #339596] Sun, 15 March 2015 23:14 Go to previous messageGo to next message
navaroe is currently offline navaroe

 
Messages:78
Registered:August 2012
Seems like a very good idea to me. Especially with that farm bonus which might make one camp less happy Thanks!

I 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).

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #340075 is a reply to message #340073] Mon, 16 March 2015 03:57 Go to previous messageGo to next message
Vince7403 is currently offline Vince7403

 
Messages:145
Registered:February 2012
This sounds like it will be amazing once the fine details are worked out. It finally encourages developing your militia well on a game-logic level, and also provides further rationale for the PMC guards if your volunteer count is too low.

Report message to a moderator

Sergeant
Re: New Feature: militia volunteer pool[message #340089 is a reply to message #340073] Mon, 16 March 2015 22:20 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
navaroe wrote on Sun, 15 March 2015 21:14
I 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

Captain

Re: New Feature: militia volunteer pool[message #340115 is a reply to message #340089] Tue, 17 March 2015 20:31 Go to previous messageGo to next message
navaroe is currently offline navaroe

 
Messages:78
Registered:August 2012
Spot on. The bonus was too small to be noticed.

I just tested it with higher value, bonus from farm works like a charm. Thanks!

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #340143 is a reply to message #340115] Thu, 19 March 2015 19:08 Go to previous messageGo to next message
navaroe is currently offline 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

[Updated on: Thu, 19 March 2015 19:09]

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #340144 is a reply to message #340143] Thu, 19 March 2015 19:12 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Good thinking! I like that idea a lot!

Report message to a moderator

Sergeant Major
Re: New Feature: militia volunteer pool[message #340478 is a reply to message #340144] Tue, 07 April 2015 08:59 Go to previous messageGo to next message
Pedro1 is currently offline Pedro1
Messages:1
Registered:April 2015
Getting missing data/property in the INI

Report message to a moderator

Civilian
Re: New Feature: militia volunteer pool[message #340488 is a reply to message #340478] Tue, 07 April 2015 20:00 Go to previous messageGo to next message
Meitsi

 
Messages:17
Registered:June 2009
Location: Finland
Don't use INI editor, use notepad instead.

Report message to a moderator

Private
Re: New Feature: militia volunteer pool[message #340910 is a reply to message #340488] Thu, 07 May 2015 23:32 Go to previous messageGo to next message
navaroe is currently offline navaroe

 
Messages:78
Registered:August 2012
This feature works for me greatly. I was just wondering, if I won't eventually be having too many volunteers. So I have this feature idea for you to consider.

What if after each battle certain percent of you volunteers quit? Like 1% for each milita casualty, may be a bit less. May be for every casualty over certain number, like 10. That way, if you let you militia bleed in some huge battle, most of them will realize freedom is overrated anyway and it will force you to make sure you keep those farms in your hands, so that you rebuild quickly.

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #340916 is a reply to message #340910] Fri, 08 May 2015 17:10 Go to previous messageGo to next message
navaroe is currently offline navaroe

 
Messages:78
Registered:August 2012
One more thing - training blue militia from green militia also lower volunteers pool. Is that intended?
Works for me right now, you really have to take farms into consideration, when planning...

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #340940 is a reply to message #340916] Sun, 10 May 2015 13:54 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Hmm. Are you sure about that? That shouldn't happen - perhaps you were training both green and blue militia, and the volunteer count was lowered only for the green ones?


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

Captain

Re: New Feature: militia volunteer pool[message #340948 is a reply to message #340940] Sun, 10 May 2015 19:48 Go to previous messageGo to next message
navaroe is currently offline navaroe

 
Messages:78
Registered:August 2012
Aha - my bad. I was pretty sure about that, but now after one more check it's working as supposed. Sorry.

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #340949 is a reply to message #340948] Sun, 10 May 2015 21:13 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
No problem cheeky


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

Captain

Re: New Feature: militia volunteer pool[message #341279 is a reply to message #340949] Sun, 31 May 2015 18:18 Go to previous messageGo to next message
Flugente

 
Messages:3509
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

Captain

Re: New Feature: militia volunteer pool[message #341336 is a reply to message #341279] Thu, 04 June 2015 00:03 Go to previous messageGo to next message
Flugente

 
Messages:3509
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

Captain

Re: New Feature: militia volunteer pool[message #350394 is a reply to message #341336] Tue, 25 July 2017 23:45 Go to previous messageGo to next message
Flugente

 
Messages:3509
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 happy

[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

Captain

Re: New Feature: militia volunteer pool[message #350805 is a reply to message #350394] Thu, 31 August 2017 01:59 Go to previous messageGo to next message
oneperson is currently offline oneperson

 
Messages:7
Registered:August 2017
where the farm sector???

Report message to a moderator

Private
Re: New Feature: militia volunteer pool[message #350806 is a reply to message #350394] Thu, 31 August 2017 02:03 Go to previous messageGo to next message
oneperson is currently offline oneperson

 
Messages:7
Registered:August 2017
where the farm

Report message to a moderator

Private
Re: New Feature: militia volunteer pool[message #350812 is a reply to message #350806] Fri, 01 September 2017 02:09 Go to previous messageGo to next message
GiantBasher is currently offline GiantBasher

 
Messages:41
Registered:July 2017
oneperson wrote on Wed, 30 August 2017 18:03
where the farm


One example would be M4: Farmland. I guess another example would be B12: Farm, Road. I would look for sectors with "Farm" or "Farmland" in the description.

Report message to a moderator

Corporal
Re: New Feature: militia volunteer pool[message #350816 is a reply to message #339595] Fri, 01 September 2017 16:02 Go to previous messageGo to next message
oneperson is currently offline oneperson

 
Messages:7
Registered:August 2017
Thanks everyone for help!

Report message to a moderator

Private
Re: New Feature: militia volunteer pool[message #357079 is a reply to message #339595] Thu, 28 March 2019 17:37 Go to previous messageGo to next message
Kitty

 
Messages:438
Registered:October 2017
Location: Germany
That's a cool feature. I try to update AR and this will be just perfect for the game-style there. During my attempt to make the new features working, this is one out of thousand questions that popped up:

Is the definition of a sector being a farm hardcoded or does the game take the information from sectornames.xml? Like, when I do mapediting a sector to a farm and rename it in sectornames to farm, will volunteers happen or only in vanilla map farm sectors?




How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: New Feature: militia volunteer pool[message #357086 is a reply to message #357079] Fri, 29 March 2019 00:31 Go to previous messageGo to next message
Flugente

 
Messages:3509
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

Captain

Re: New Feature: militia volunteer pool[message #357090 is a reply to message #357086] Fri, 29 March 2019 02:21 Go to previous message
Kitty

 
Messages:438
Registered:October 2017
Location: Germany
Thanks a lot! I sure asked a lot of questions concerning my attempt to update AR being the bloody amateur I am. I hope not being too anoying. I swear, I allways try to find things out myself first, as far as possible for me. After several fruitless attempts I'm full of myself cause I just managed to get a working action item ingame without asking :-) (one step closer making AR-SAMs working, yeah).

And now I'm able to see how volunteers will affect AR, that's just great! I allready wondered what this <Here> affects, since it doesn't affect movement costs. So this is one of the "some ingame machanics".

Again, thanks.



How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Previous Topic: New feature: new drug system
Next Topic: New feature: combat jeeps
Goto Forum:
  


Current Time: Tue Apr 16 08:11:27 GMT+3 2024

Total time taken to generate the page: 0.01717 seconds