Supply-Abstracted Healing

Tekamthi

Emperor
Joined
Aug 12, 2016
Messages
1,750
From recent discussion (see this post and ensuing discussion), an interesting idea emerged re: representing some very-abstract supply line concepts via modifying unit healing ability. I've wrung these ideas through the what-is-possible-in-database filter, and have something semi-playable here:

database
  • All normal, default healing is restricted for land units
    • 0 in enemy, 5 in neutral & friendly
      • accomplished via promo to all affected units: -5 in enemy, -5 in neutral, -10 in friendly
    • Recon excluded
    • existing "extra" healing functionality left untouched (medic promotions, healing policies/beliefs etc); may be adjusted if this is developed further
  • There are 2 promos that re-enable healing:
    • food supply
    • materiel supply
  • each promo is temporary duration (10 turns)
  • each temp promo does 5 hp per turn healing for plot and adjacent (functionally identical to medic promo healing bonus, but w/ a timer)
  • temporary healing promos are gained from moving unit through a plot with an improvement
    • food supply promo gained from farms/pastures/village/towns etc
    • materiel supply from manufactory/mines/lumbermills/et
  • land military units AND some civilians (workers, settlers, caravans) can gain the healing promos.
    • ie send a force on foreign attack, it will have full healing enabled for 10 turns after it leaves your territory - to continue healing after 10 turns away, at least some units will have to tag up in owned improved plots to restart 10 turn timer OR workers will have to be sent to the front line, carrying these same promos.
    • all healing promos are adjacency-based so units without any supply promos can still receive full healing if nearby -- can just send workers with them applied if nothing else
  • forts and citadels provide additional healing bonus per turn
    • 5 hp to unit in tile and adjacent -- unit must be in tile, ability lost when moving out of fort/cita
LUA
  • add various supply promos to eligible units via move through city plot
    • city must have food routes enabled to add food promo
    • ... & production routes for materiel promo
  • pillaging improvements that confer supply promos, also confers relevant supply promo to the pillager
  • standing still in relevant plot re-adds the relevant promo
  • add promo from meat resource plots
  • trade units distribute the promos as they move

This is NOT intended to be a fully-fleshed out mod at this stage, and I am unsure if I will develop it further, but the logic should hold-up in general play; its more of a mostly-database proof-of-concept aimed at exploring solutions to recent/current discussion about too many units and over-supply in late game. Feel free to modify; please post any significant functionality updates back into this thread

edit:

updated description to reflect current functionality.

Spoiler :

v5: re-added promo support for unmoved units
added promo from meat plots
added promo from passing trade unit

note that I removed the following from v1 as unnecessarily complex:
  • 3rd worker-only supply promo
    • unnecessary and too complex for AI
  • re-add promos to unmoved units in eligible plots
    • w/ promised update to VP code this shouldn't be as necessary, not worth the system resources
  • gaining supply by attacking unit w/ active supply
    • pillaging is sufficient
 

Attachments

  • Supply-Abstracted Healing (v 6).civ5mod
    4.4 KB · Views: 31
Last edited:
From recent discussion (see this post and ensuing discussion), an interesting idea emerged re: representing some very-abstract supply line concepts via modifying unit healing ability. I've wrung these ideas through the what-is-possible-in-database filter, and have something semi-playable here:
  • All normal, default healing is disabled for land units
    • ie. -5 in enemy, -10 in neutral, -15 in friendly
    • Recon excluded
    • existing "extra" healing functionality left untouched (medic promotions, healing policies/beliefs etc); may be adjusted if this is developed further
  • There are 3 promos that re-enable healing:
    • food supply
    • resource supply
    • materiel supply
  • each promo is temporary duration (10 turns)
  • each temp promo does 5 hp per turn healing for plot and adjacent (functionally identical to medic promo healing bonus, but w/ a timer)
  • temporary healing promos are gained from moving unit through a plot with an improvement
    • food supply promo gained from farms/pastures/etc
    • resource supply from mines/lumbermills/etc
    • materiel supply from village/towns/manufactory
  • land military units AND some civilians (workers, settlers, caravans) can gain the healing promos.
    • ie send a force on foreign attack, it will have healing enabled for 10 turns after it leaves your territory - to continue healing after 10 turns away, at least some units will have to tag up in owned improved plots to restart 10 turn timer OR workers will have to be sent to the front line, carrying these same promos.
    • all healing promos are adjacency-based so units without any supply promos can still receive full healing if nearby -- can just send workers with them applied if nothing else
  • forts and citadels provide additional healing bonus per turn
This is NOT intended to be a fully-fleshed out mod at this stage, and I am unsure if I will develop it further (I will likely make a basic lua helper for it, to smooth out some of the database limitations), but the logic should hold-up in general play; its more of a database-only proof-of-concept with potential to be developed into something greater. Feel free to modify; please post any significant functionality updates back into this thread
To note, Windows Defender blocked the .civ5mod you uploaded as a result of a threat detection:

Trojan:Script/Wacatac.B!ml

Threat Level: Severe.

I don't have time to look into it to determine if it is a false-positive as I have to go out for someones birthday lunch, playing cheauffeur :coffee:
 
ty for heads-up -- just downloaded got same warning! i will re-upload shortly, I'm looking at the file i uploaded right now, its just a single SQL file in the mod, plus the usual wrappers??? Could it be a CF issue?

edit: I'm not sure what the deal was there??? everything looked fine on my side, but I nuked my copy just to be safe and re-built a new one from modbuddy directly, immediately uploaded -- file in OP should be fine now, unless its a CF issue. I am sorry to anyone that got the early copy with potential issue -- please run scan on your system just to be safe.
 
Last edited:
Sorry I didn't get back to you earlier, was very late getting home last night & had work today.

Your second upload does the same yet Malwarebytes and VirusTotal.com are not flagging it.

I would say it is Windows Defender flagging it for some odd reason.

Edit: Apparently this mornings version for Windows Defender wasn't up to scratch, after force-updating via the Windows Security app (Windows Update didn't provide a newer version) the file no longer gets flagged...

WD Snippet.PNG


Joys of being an Aussie where everything else in the world technologically trickles down after some time...
 
Last edited:
Hey thanks for letting us know -- I've redownloaded and also got the same warning from Windows defender again, so it's not just you. This file came straight out of my modbuddy...

I did full scan on my end overnight (using Microsoft tool) right after uploading, zero results. The file I uploaded never triggered any warning, just the download file. Bizarre. Make of this what you will, but I think it's fine.

I just allowed it this time, scanned the file directly with a few tools, and re-examined it's contents: it's still just the text-based SQL file and .info, I don't understand how any attack could even be embedded in such files.

I'll leave it up under assumption it's just some bizarre false positive from defender. If anyone else gets it flagged from anything other than defender, please report back, but again it's just a couple text files, no Lua even... What could it possibly do??

Unrelated, I was having a coffee at the Starbucks next to home depot a few days ago -- phone defaulted on to home depot network, which worked fine EXCEPT when I tried to browse CF site. Looks like they've blocked us lol. Starbucks worked fine mind you.
 
Last edited:
Are the MD5 of the file you downloaded and the one you made identical?

But really, they're all text files (even the .civ5mod) and you can look at them all in text editors to verify...
 
Are the MD5 of the file you downloaded and the one you made identical?
Yup. I am not expert on all things IT security, but my lay-knowledge all suggest false positive. Weird that it would trigger at all off this tiny file of SQL commands.

I deleted the exception I had allowed for this file, and today defender is not complaining about it...

edit: attached a basic lua helper to OP, should smooth out gameplay with basic desired features for this concept
 
Last edited:
I've made a few GitHub feature requests to support this mod concept -- the Lua helper stuff could be done in database if certain things worked slightly differently, and in ways that are probably more intuitive to modders and players (the improvements can assign location-based promotions just fine, but they won't reset promotion timers, as one big example)

Anyway played through marathon ancient with this mod, and then again with the Lua helper uploaded to OP yesterday. With both enabled, there is certainly some depth added to the early combat -- not the combat itself necessarily but the preparations and infrastructure required to support it: getting improvements and granaries built is a must to support even military campaigns against barbarians. The choice between sending recon off to explore vs staying home to fight is heavier. Capturing workers is a bigger deal.

Once you accept this mod's functions as player (not being able to heal as freely is slightly jarring to the long-time VP player for the first few turns, then you get used to it), it does serve to encourage a supply-line of sorts, I pretty much always had a worker on the front line of any combat, and had to rotate them in and out every few turns -- this was generally easier than sending a unit back and forth when supply numbers were low. That said maybe it's too limiting early on? Before workers and improvements come online all you can do for the most part is get 5hp heal in city...

Some additional observations to possibly address via further theorycrafting/modding:
- AI does sort of adjust to the healing regime but clearly doesn't know how to organize workers to rotate to the front, the way human does. It does okay with combat units, but just okay. This was expected, but mod could benefit from additional mechanisms that favor AI playstyle
- 10 turn timer feels much shorter than it sounds
- though healing can be scarce at times, organized player can bring more healing to enemy territory than previous, much more... Need to evaluate this further

edit:

github references:
repair charges: https://github.com/LoneGazebo/Community-Patch-DLL/issues/10733
improvement turn timers: https://github.com/LoneGazebo/Community-Patch-DLL/issues/10743
building-based location promotions: https://github.com/LoneGazebo/Community-Patch-DLL/issues/10746
plague promotion functionality: https://github.com/LoneGazebo/Community-Patch-DLL/issues/10747
 
Last edited:
simplified the original implementation for better AI-friendliness and general balance. lua & database all bundled in one mod file now: see new version attached to OP -- description of mod function updated as well.

This is where i will park my efforts on this concept -- if some of the github feature requests are ever implemented, I may return to move some current lua stuff over to database, but thats it. Even with the implementation scaled back, without full AI support, probably not much more that can be done to make this fully playable.

That said, I've played through multiple eras now with it, it doesn't break anything, gives human an added layer of strategic consideration. For any other enjoyers of this idea out there, functionality should improve slightly with one of the next versions of VP; see https://github.com/LoneGazebo/Community-Patch-DLL/issues/10743
 
one last revision... to workaround the bug w/ improvement promos introduced in 4.6

edit: i have three ideas to develop this further, all requiring frequent lua use however... maybe one day.
  • trade units distribute the supply promos as they move -- ie if unit is on a trade route and caravan passes through that plot, they get any supply promo they're eligible for
  • moving through plot with undeveloped food resource gives food supply promo, to fill in options for this early on
  • this one is further afield -- there is a mod that makes early barbarians as dinosaurs and wild animals; the dinos are too much but the wild animals could be re-deployed as barbarian "civilians", their capture confers food supply promo
 
Last edited:
there were some bugs in last version -- plus i took out too much after v1.

Added a few things back, and a few new -- all lua:
- unit can regain/refresh promo by standing still, once again
- added missing (oops) check for pillaged improvement in various functions
- moving through undeveloped land animal resource plot gives food supply
- trade units (caravan, cargo ship) will distribute promo as they move

I may still catch a bug or two yet.. i need to double check the pillaging is adding the promo correctly and the trade unit distribution bit as well. Its getting a little lua-heavy, but needed more ways for AI to pick these up by accident -- I think it won't be too bad but only play-testing will say for sure
 
Last edited:
Now that all the basics are in place and working as ~intended, we can perhaps reflect on more extravagant features. Training the AI to somehow recognize these supply promos directly, and how to acquire them, is out of the question, can't be done. What we can do is make things more "accidentally" accessible to AI while preserving the core, abstract supply line concept:

1. as mentioned above, some kind of huntable barbarian that gave food supply promo in the early game, wild animals etc. AI knows how to hunt barbarians...
2. instead of the current workers as supply carriers, or in addition, could have a dedicated civilian supply unit with GG AI. These would be temporary units, self-deleting after they expire, and auto generating from various map features; with the GG AI , we should see them moving to combat front as desired, and with them expiring and auto spawning, AI should naturally create the same kind of supply line behavior as human will.

I think 2. above is the more promising... Any other ideas?
 
Top Bottom