Better Recon Mod snippets

Status
Not open for further replies.

Tekamthi

Emperor
Joined
Aug 12, 2016
Messages
1,938
edit: see #7 below for first installment of this mod

I don't have a ton of playtime in the June version, but I've made it to mid-game in my single match thus far, and from what I've seen, the AI's poor use of recon from late-early game through to early-late game has persisted for a long time. I've come to just accept that these are low priority units early-on and particularly not suited to the AI's play-style in civ 5, as I think everyone has.

I've been modding some changes to various aspects I find deficient (yet unpublished), and I wonder for the first time what the community's take on the AI's handling of these units is. Should they be just low-priority, quasi disposable units through so much of the game? (If yes, should they be removed from the vassal gift list until zeps?)

From what I've observed, the rare time an AI gets a level'd up pathfinder or scout back home to support combat within its regional sphere of influence, it actually uses them reasonably effectively (if maybe in suicide fashion) to get through rough terrain and behind military lines to ambush trade routes or pillage important tiles etc. AI also tends to benefit from having greater vision in a general sense, but it rarely uses recon to park on hills just to keep watch the way human does (or at least I do). And it rarely if ever builds these units for obvious reasons -- when it does have them they're almost exclusively sent off to tour around the world until trapped or killed, and inexperienced recon are always the lesser-value choice available for combat purposes in the AI's hands.

Disregarding the modding experiments to the units themselves and any merits of these, I wonder if the way 'recon experience' functions might be worth another look. Theorycrafting a little here, the AI would benefit from having access to high XP recon throughout the game, whereas human advantage in preserving units already provides for this most of the time on our side... maybe tweak the 'recon experience' feature to be a pool per-civ, granted at least partially to each new (pre-zep?) recon built, so that there's a point to build these units throughout the game, and greater value on exploring the map with recon units rather than via military, diplo and tech reveals

to be specific, say all pre-zep recon built are granted the following: 0.5*(civ's total accumulated recon xp) / 1 + (civ's total number of existing recon units)... thoughts?
 
Last edited:
I don't have a ton of playtime in the June version, but I've made it to mid-game in my single match thus far, and from what I've seen, the AI's poor use of recon from late-early game through to early-late game has persisted for a long time. I've come to just accept that these are low priority units early-on and particularly not suited to the AI's play-style in civ 5, as I think everyone has.

I've been modding some changes to various aspects I find deficient (yet unpublished), and I wonder for the first time what the community's take on the AI's handling of these units is. Should they be just low-priority, quasi disposable units through so much of the game? (If yes, can they be removed from the vassal gift list until zeps?)

From what I've observed, the rare time an AI gets a level'd up pathfinder or scout back home to support combat within its regional sphere of influence, it actually uses them reasonably effectively (if maybe in suicide fashion) to get through rough terrain and behind military lines to ambush trade routes or pillage important tiles etc. AI also tends to benefit from having greater vision in a general sense, but it rarely uses recon to park on hills just to keep watch the way human does (or at least I do). And it rarely if ever builds these units for obvious reasons -- when it does have them they're almost exclusively sent off to tour around the world until trapped or killed, and inexperienced recon are almost worthless for combat in the AI's hands.

Disregarding the modding experiments to the units themselves and any merits of these, I wonder if the way 'recon experience' functions might be worth another look. Theorycrafting a little here, the AI would benefit from having access to high XP recon throughout the game, whereas human advantage in preserving units already provides for this most of the time on our side... maybe tweak the 'recon experience' feature to be a pool per-civ, granted at least partially to each new (pre-zep?) recon built, so that there's a point to build these units throughout the game, and greater value on exploring the map with recon units rather than via military, diplo and tech reveals

I suggest you bring up these concerns on Github, Dr. ilteroi handles homeland/tactical AI for units. :)
 
i may take a stab at modmodding it if i'm the only one interested, though i suspect i'd have to rely on unit.setxy and possibly create great inefficiencies... would be nice to have it handled in .dll where the recon xp stuff already takes place, if there were any appetite for such a fix from the community. Maybe status quo is good enough for most though, we'll see
 
I'm afraid it won't change much, so it may be not worth the hustle, because it's not trivial to do.
 
Maybe it could work if every new recon unit gets an extra amount of XP proportional to map reveal %. Paratrooper+ will need a CS nerf probably though.
 
I'm interested in seeing the AI use their "Recon guerrilla warfare" more often throughout the game. I think it's a good thing to test in a Beta release if they haven't already.

I suggest you bring up these concerns on Github, Dr. ilteroi handles homeland/tactical AI for units. :)
Yeah, if you want it to be implemented into the .dll it's better to open up a post on Github too since I don't think ilteroi frequents the forum.
 
okay sounds like there are a few that might at least test something along these lines... I think we can try this out to some extent without bothering the project's core devs at all. With further thought and ideas from community here, i won't need unit.setxy after all to re-create a similar effect in lua without touching recon experience itself.

Maybe it could work if every new recon unit gets an extra amount of XP proportional to map reveal %. Paratrooper+ will need a CS nerf probably though.

this jogged my memory to one of my past attempts to address this in modbuddy, long ago set aside: I had tried to use the event system and other VP gameplay triggers (since AI won't build them directly) to grant new recon units with xp based on # of tiles revealed. The lua itself worked well without noticeable hit on turn times. The problem this led to in my testing was, as human, I was eventually preserving 3 or 4 high level recon units at a time, especially as the later eras with paratroopers etc approached, and sometimes had even more of these high level units til end game, whereas the existing VP paradigm is built to tolerate maybe 1 or 2 per civ. It wasn't so OP as to be game-breaking but I definitely felt like I had something the AI didn't. AI used recon more often as a result, but never had more than one high level recon at a time, and still expended them in suicide attacks before too long. Here we're thinking of applying it to all recon, not just these special event recon I had created back then, but I think the result would be the same. However, this implementation could be refined further to mitigate the bonus xp effect as more recon units are added to a civ's active roster, here's what I propose:

we'll use a "pool" or "bucket" of tracked game data (I'll get to this below) to grant bonus xp to all new pre-zep recon units (if the vassal gifts get this too then they won't be so disappointing). When a new recon unit is created, the civ's existing units will be checked, and the total XP of every active recon unit will be summed (ie if you have 2 scouts with 500 XP each, the total active recon XP would be 1000). When the total of active recon unit XP < the recon bucket value, the new unit will be granted bonus XP from the bucket. To encourage smart play, there must still be a penalty for losing these units, so the bonus xp will be a fraction of (recon bucket value) - (total active recon unit XP), probably 50% to start though this number should maybe be fine-tuned to get this right.

Following so far? My thought with the above mechanism is that, if you lose your free initial recon unit, you'll be able to nonetheless recapture most of the lost experience by building 1-3 new units, but recreating the single high level unit will not be immediately possible, and each additional recon beyond the first will receive a substantially diminished bonus, preventing a large army of hero-like units by late-game.

The basis of the recon "bucket" will be an important design aspect. Unfortunately, tracking "recon experience" directly will not be efficient. Instead, we could use the idea suggested by @azum4roll of counting revealed tiles. We'll call this version (A) of the recon bucket. This option works well as it intuitively ties this recon bonus to the map, and thus functions similarly to the recon experience through which these recon units might otherwise earn their XP. However it does not encourage the use of recon units to explore, as tiles revealed via any means will contribute to the recon bucket -- as an extreme example, you could never explore nor xp at all with your initial recon unit, then build a new one later on with +++++xp. This seems thematically jarring imo. Option (B), and maybe the direction I'm leaning at the moment, is to base the recon bucket on the maximum total active recon XP ever achieved. ie similar to counting the instantaneous total accumulated XP on all a civ's recon units as described above, the all-time maximum value achieved in this count will be tracked, and used as the bucket for bonus recon XP. This option maybe does a better job at tracking XP that was actually earned by recon units, though it also mixes in their combat and other experience to the map reveals.

I prefer option (B) primarily due to its thematic representation of a sort of "explorer's tradition" within each civ, requiring active use of recon units rather than just any form of map reveals. On the other hand, it may be more vulnerable to abuse, as ultimately i expect a human will be able to game this system to create a bigger recon bucket than typical AI if desired. I'm not sure if such a strategy would pay off in a meaningful way, but the potential is there whereas it is not in option (A).

For those interested here, any thoughts on preference for option A or B in the paragraph above? Or any other thoughts on other aspects of the structure I've outlined? I'll let this discussion set for another 24-48 hours then build a mod based on the results. I expect we'll have a prototype by friday/saturday, shouldn't take long once I have a clear direction in mind.

EDIT 1: none of this will encourage the AI to build these units, so I'm thinking of granting a free recon unit at each era start, using the xp rules above to nonetheless ensure only a small number of high-xp recon active at any one time

EDIT 2: attached a mod that works as described as 'option A' in this post, except it counts only revealed land tiles (rather than all revealed tiles) and grants 66% of unallocated XP pool to new recon units (rather than 50%). Tested working throughout ancient era, need feedback on full game. Should be relatively conflict-free with other mods.
 

Attachments

Last edited:
AIs do build recon units currently; they just die too easily with few promotions. Since AIs get a discount to promotions and extra XP on new units, a XP bonus based on map reveal % could get new recon units to level 5-6, enough for them to take most of the survival/trailblazer promotions.

Problem is, do we want them to spam such units?
 
agreed; that's what I've attempted to address in my theorycrafting above, by comparing the total recon xp collected amongst active recon units to the bonus xp pool (ie the revealed tiles)... AI will be able to rebuild a high xp recon once they've lost them all, but if they built 3 or 4 of them at once, only 2 or so would be granted a significant recon bonus... if they lost all 3 or 4, or just the highest xp instance, they'd be able to rebuild another high xp recon or two.

At higher difficulties this still means AI might spam out a high xp replacement much faster than human can, though this is generally tolerated for all units

anyway i'll nix the free recon on era advance since AI has been observed building these in recent versions, but will otherwise put some lua together to test further how this might work, and whether it yields any benefit to the human/AI play-style disparities
 
I have recon units with rival terriroty enabled because I feel like they ought to have that by default. Do you think that changes how the AI uses them?

Although, the subs are special, non-recon persay.
Code:
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_BANDEIRANTES';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_EXPLORER';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_NUCLEAR_SUBMARINE';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_SCOUT';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_SHOSHONE_PATHFINDER';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_SUBMARINE';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_ZEPPELIN';
 
I have recon units with rival terriroty enabled because I feel like they ought to have that by default. Do you think that changes how the AI uses them?

Although, the subs are special, non-recon persay.
Code:
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_BANDEIRANTES';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_EXPLORER';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_NUCLEAR_SUBMARINE';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_SCOUT';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_SHOSHONE_PATHFINDER';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_SUBMARINE';
UPDATE Units SET RivalTerritory = '1' WHERE Type = 'UNIT_ZEPPELIN';

I've read mention of this idea the broader civ 5 community once or twice over the years, and indeed attempted it myself, with an eye for gameplay results. I think the AI uses it just fine; I observed many frequent visits through rival territory by the AI with these units, but it did lead to some issues perhaps (discussing recon only here, subs are more suited to this change imo):

1) Human's memory for what (s)he saw in enemy territory is generally accepted as markedly superior to AI's, and thus a trip through rival territory confers a material advantage to human. This is really minor "issue" overall, and very subjective to the human.. ie a human must make intentional plays to create the advantage here, and some/many will not adjust their tactics to full effect on this

2) neutral territory can be gamed in combat, leaving AI at disadvantage. Clever human can find a 3rd party civ to launch recon attacks from, then flee back into this territory with little fear of being pursued, as only enemy recon can do the same but the AI does not necessarily realize this. Situationally, this can confer a strong advantage to human, and I think will be obvious to most players

3) it flattens the effect of exploration: with pathfinders essentially being able to move anywhere, the map will be entirely uncovered by every civ quite early in the game, and it curtails some of the sense of 'wonder' and 'unknown' to the world that otherwise might persist longer, or require diplo as well to work around

For the moment, I'm gonna get some lua up that addresses the availability of XP for recon as I've described above as a starting point, but maybe this can become a 'recon fix mod snippet' thread for those that are interested in experimenting and/or just changing the function of these units to their tastes. @ryanmusante do you have this code already packaged in a ready-to-go mod? Wanna paste it in here?

I have some lua code that adjusts this rival territory idea further using the CAN_MOVE_INTO dll feature, so that recon can move into some rival tiles if certain conditions are met... iirc the last i left this (ie the best result I found) was to allow recon to enter rival water tiles only, as well as tiles being traversed by an owned trade route (ie you could use trade routes as 'roads' for recon through rival lands, but not just roam freely on all rival tiles). If there's interest in this idea, we can look at packaging it up as another recon mod add-on next....
 
1) Human's memory for what (s)he saw in enemy territory is generally accepted as markedly superior to AI's, and thus a trip through rival territory confers a material advantage to human. This is really minor "issue" overall, and very subjective to the human.. ie a human must make intentional plays to create the advantage here, and some/many will not adjust their tactics to full effect on this
You are speaking of "memory" as in what we can retain and base our next move's decisions. Whereas the AI only retains what is within a certain number of hexes for a certain number of turns? I can't remember the specifics (no pun intended).
2) neutral territory can be gamed in combat, leaving AI at disadvantage. Clever human can find a 3rd party civ to launch recon attacks from, then flee back into this territory with little fear of being pursued, as only enemy recon can do the same but the AI does not necessarily realize this. Situationally, this can confer a strong advantage to human, and I think will be obvious to most players
This is along the lines of, "it isn't really an exploit but maybe it is kind of thing". It is a good point and maybe one of the main reasons people tend to side against this mod.
3) it flattens the effect of exploration: with pathfinders essentially being able to move anywhere, the map will be entirely uncovered by every civ quite early in the game, and it curtails some of the sense of 'wonder' and 'unknown' to the world that otherwise might persist longer, or require diplo as well to work around
Absolutely true here. This is the biggest reason why people would think it's game breaking to add-in. Why have map-sharing and open borders when you can just fly around freely with recons? Well, I think its a matter of-- the units themselves aren't capable of battle on their own even in greater numbers late game. I think they're underpowered and not as useful for their purpose when they are locked in and unable to cross paths due to in-game limitations.
For the moment, I'm gonna get some lua up that addresses the availability of XP for recon as I've described above as a starting point, but maybe this can become a 'recon fix mod snippet' thread for those that are interested in experimenting and/or just changing the function of these units to their tastes. @ryanmusante do you have this code already packaged in a ready-to-go mod? Wanna paste it in here?
@adan_eslavo is the credit to making it a popular mod again. I just picked and chose specific units rather than the entirety of the recon class. His code is as follows for "Free Recon Units" mod:

https://forums.civfanatics.com/threads/free-recon-units.636589/
Code:
-- added "Rival Territory" promotion to all recon units ecluding: Paratroopers and X-COM Squad.
INSERT INTO Unit_FreePromotions
            (UnitType,    PromotionType)
SELECT        Type,        'PROMOTION_RIVAL_TERRITORY'
FROM Units WHERE CombatClass = 'UNITCOMBAT_RECON' AND NOT (Class = 'UNITCLASS_XCOM_SQUAD' OR Class = 'UNITCLASS_PARATROOPER');

-- added "Rival Territory" promotion to Workboats
INSERT INTO Unit_FreePromotions
            (UnitType,    PromotionType)
SELECT        Type,        'PROMOTION_RIVAL_TERRITORY'
FROM Units WHERE Class = 'UNITCLASS_WORKBOAT';

-- now "Rival Territory" promotion is lost on upgrade
UPDATE UnitPromotions SET LostWithUpgrade = '1' WHERE Type = 'PROMOTION_RIVAL_TERRITORY';
 
Last edited:
just added a mod to post #7 in this thread, for those interested in recapturing recon XP via revealed tiles as discussed

@ryanmusante i am not sure of specifics to AI memory of map and positions etc., but I think its still generally accepted that human's ability to remember and deduce what's going on with rival units exceeds what the AI can do. Maybe others can elaborate on current state?

I think all the issues with the can-enter-rival mod for recon are not game-breaking, but maybe can be improved? The VP .dll could allow this flag to be refined further, for example only allowing recon to enter rival if DoF exists, or only on owned trade routes as I mentioned I've tried previously, or only if the tile has a road, etc. Any thoughts?

EDIT: since this discussion has been a little unfocused, I've broken out the 2 different mod ideas discussed towards the end of this thread into their own discussions. See https://forums.civfanatics.com/threads/perfidious-recon-units.662113/ and https://forums.civfanatics.com/threads/exploration-heritage.662115/
 
Last edited:
Status
Not open for further replies.
Back
Top Bottom