[MODCOMP] Improvement Decay Component

Northern

Chieftain
Joined
Jan 7, 2023
Messages
1
I realize I might be a few years late for most folks, but here's a small mod component (BTS) for having improvements decay if unworked. Definitely not a great stand alone mod, but hoping to incorporate it into something larger that I've started working on.

I may add some functionality to allow certain actions to generate new improvements (eg: kill an animal and a skeleton will sit there for a few turns to mark your presence or clean out a goodie hut and leave a remnant/ruins for several more turns), though this is probably easier via python (new methods are exposed to python - though I have not tested these).

Background / Purpose
(Certain) Improvements not in use, eg, abandoned farms or villages outside razed cities, should likely not remain on the map forever if they continue to be unworked.

Description of Mechanics
Will cause improvements to decay over time if they remain unworked. Working the tile reverses any decay that has occurred (over time).

Amount of time needed for decay to occur is specified by new XML tag for improvements: <iDecayTime> where iDecayTime is measured in turns (normalized for game length).

When an improvement hits the iDecayTime threshold it is removed. If <ImprovementPillage> is defined for improvement, then the improvement will be replaced with the improvement specified with this tag.

Progress to upgrades erodes faster than it accumulates (4x) if a tile is unworked.

An improvement can't have progress towards both decay and upgrade at a given moment (if decaying, upgrade progress is removed before decay progress begins and vice versa).

AI will consider the potential for decay – not tested for optimal weighting or if it affects behavior.

Decay is unaffected by civic improvement upgrade rate effects or similar.

Hovering over tiles will provide information on turns until decay. Civilopedia also shows decay information.

XML
New XML attribute for terrain improvements:
  • iDecayTime
If feature does not decay, set to -1

New XML entries for GameTextInfos
  • TXT_KEY_IMPROVEMENT_DECAYS
  • TXT_KEY_PLOT_IMP_DECAY
C++
Changes marked with comment with phrase: TERRAIN-IMPROVEMENT-DECAY

Changes to 15 files

Python
No changes to python, however, all improvement upgrade functions have been cloned to provide the same functionality for improvement decay. These functions are renamed by replacing the word upgrade with decay.
 

Attachments

  • yImprovementDecay.7z
    2 MB · Views: 16
Last edited:
I also like this idea. I have been absent from the Civ IV modding scene for a few years now and am rebuilding my mod from scratch so new ideas are very welcome to me.

Thanks
 
Top Bottom