Jan 29, 2006
Boston, MA, USA
MongooseSDK 3.3

Beyond the Sword 3.1.9 + Better BTS AI 0.78 (minus AIAutoPlay and ChangePlayer)

This is the SDK code from my full mod (which is not publically available at the moment). I am providing it mainly for modders, though it can be used as a standalone mod if you add <iBombardLimit> values to all siege units and <iInterceptLethality> values to all air units (and turn Python errors off, heh).

If you use anything from here you NEED to give me credit. ... Seriously. Don't try my patience again.


Old Thread:
(had to start a new one as I didn't have extra top posts reserved)


FloodPlainsFix (UPDATED) (CvCity.cpp)

If a city is built on a flood plain, the tile will remain a flood plain rather than becoming a desert. This removes the penalty for building on such rivers instead of near them (effectively -1 food), and preserves the tile if the city on it is ever razed and replaced with a new city nearby (which would otherwise be stuck with a desert in its working radius). This component also covers the mushroom feature in my mod, since the types have to be hardcoded unless I ever add an XML tag.

CastleBypassFix (CvPlayer.cpp)

Allows buildings to still be constructed after they go obsolete if they provide a defense bonus and thus still serve a purpose. This only affects Castles currently, and restores their old behavior before they got a bonus trade route that forced a tech expiration. Don't worry, they still do nothing but provide more physical defense if you build them in this manner (ie everything about them that should obsolete still does).

GreatPersonFix (NEW) (CvCity.cpp, CvCity.h, CyCity.cpp, CyCity.h, CyCityInterface1.cpp, CvGameTextMgr.cpp)

Applies floating point precision to great people points, preventing truncation errors (which could result in a great person taking several turns longer to finish than he should) and allowing overflow points to be calculated correctly when starting a new great person. (Note: the progress bar in the city view will display gibberish without the code in my file which I'm not providing here, but the bar's mouseover popup will be fine since that's handled by the SDK.)

Fixes a significant bug with the application of the Parthenon/Pacifist/etc effect which frequently led to incorrect results.

BarbarianPassiveTechFix (NEW) (CvTeam.cpp)

Fixes a minor bug where the barbs were counting themselves (and any other barbarian players for that matter) in the list of other civs for determining passive tech accumulation rate, making it slightly slower than whatever value the XML global indicates. Also adds an enforced minimum of one research per turn if any other civs have the tech, which is probably not necessary but was missing nonetheless.

AITargetCityValueFix (NEW) (CvPlayerAI.cpp, CvCity.cpp, CvCity.h)

Fixes the AI's calculation of the value of potential target cities: obsolete world wonders are no longer considered under any circumstances (before they were given full weight if at least one active world wonder was present, and ignored otherwise), and multi-holy-cities now count extra as appropriate (before they were valued the same as single-holy-cities). Also greatly increases the weight values for these things, which were set negligibly small.

MPRandomFix (NEW) (CvGame.cpp)

Currently has no effect. If I ever figure out how to restore locked random seeds to network multiplayer games, however, this will allow the New Random Seed option to function in such games.


TransportUpgradeFix (CvUnit.cpp)

Kicks carried units to the nearest valid tile if you upgrade a transport into something with different cargo capability (less capacity, no capacity, or carries different types of units now).

CargoLoadFix (NEW) (CvUnit.cpp)

Fixes an annoying but harmless vanilla bug where the Load button still appears for a unit already being carried by a transport (though hitting it does nothing).

Prevents land units with the ability to enter water, generally helicopters, from automatically becoming cargo when entering a tile occupied by a friendly transport; these units must now be loaded manually (which saves a lot of annoyance, believe me).


SurfaceCombatFix (UPDATED) (CvUnit.cpp, CvUnit.h, CvUnitAI.cpp, CvGameCoreUtils.cpp, CvGameCoreUtils.h, CvGameTextMgr.cpp)

Applies floating point precision to the damage calculation portion of the main combat engine (doesn't affect collateral or air strikes), and the corresponding odds generator. The difference is small and doesn't usually change fight outcomes, but for an example take a 2-vs-1 fight such as a promotionless warrior attacking a wolf: in vanilla the odds are 99.1%, and with this fix they are 98.0% (a more accurate and correct number).

Makes a small code improvement to an internal odds calculator only used by AI players to determine courses of action. The fix involves an integer division not being postponed til all multiplications in the same line are done as SDK code usually does, and may or may not have a very small effect on gameplay (it's hard to test).

Makes a change that could be considered a mod and not a fix, but I threw it in here anyway since it affects surface combat and is hard, imo, to object to: if two defending units have exactly the same defense strength for a fight (and either both are Great-General'd or neither are), it will now pick the lower-experience one instead of the higher-experience one to take the fight. This has two advantages: since promotions get further apart the higher you go it helps get more promotions faster; and if the defender loses the fight, the player loses a lower-experience unit which is always preferrable.

Displays combat odds of 0.0% and 100.0% at their actual values rather than capping their display at 0.1% and 99.9%. I don't care if it's misleading b/c it's still technically possible to win a 0% or lose a 100%; giving the player more information is never a bad thing.

CargoInterceptFix (UPDATED) (CvUnit.cpp)

Formerly known as the InterceptDomainBlockingFix. I discovered that what I thought was broken -- ranged land units like SAM Batteries not being able to intercept adjacent water tiles and ranged water units like Missile Cruisers not being able to intercept adjacent land tiles -- was working fine all along (way to let me know this guys, you only had 3 years to notice lol). However there is a different bug with the exact same code, which this now fixes: units being carried as cargo could still perform intercepts if the unit transporting them was in a city or a neutral or friendly fort, and units with <bCanMoveAllTerrain> set (generally helicopters) that were being carried as cargo could still perform intercepts anywhere.

PromotionRefundFix (NEW) (CvUnit.cpp)

When a unit upgrades, any promotions it had (even free ones) which are invalid on the new unit type are removed and refunded, not just removed. For each promotion refunded the player may immediately choose a replacement from the new unit's valid list. This is to prevent being punished for choosing things like Woodsman, Guerilla, Hunter, etc. early on; to prevent unique units which give obsoleting free promotions from being inferior to those that give permanent ones; and to properly handle cases where upgrade lines cross type boundaries (Recon->Helicopter for example, where a large number of promotions become invalid).


FortifyOnWaterMod (CvUnit.cpp)

Allows ships to fortify. Not particularly realistic but still a good gameplay improvement imo. Currently hardcoded to use 40% of the land fortify strength, so that ocean defense goes from 0% to 10% and coast defense from 10% to 20% as fortify is built up.

WeakerMarchEffectMod (NEW) (CvUnit.cpp, CvUnit.h)

If a unit uses its March promotion to heal, ie it has moved or taken some other action, the amount healed is cut in half. Normal (idle) heal rates are unaffected, whether March is present or not.

ExperienceNeededMod (UPDATED) (CvUnit.cpp)

Stops the experience gap between promotion levels from continuing to grow larger past a certain point, making further levels unreasonably and impractically expensive. That point is currently set arbitrarily, by me, to be 145 exp and beyond, where the gap reaches a fixed 25 exp. I had had it set much lower in the past but changed my mind; this way it's still useful once in a while at least, and remains a steady comfort just knowing it's there. Also no longer checks with the Python function that can override this if it exists.


CollateralDamageMod (CvUnit.cpp)

Applies any extra collateral damage (from promotions) to the base strength ratio calculation along with the unit's normal collateral percent, instead of using it to modify the value at the end of the damage calculation where it is significantly less potent. Protection from the Drill promotions (and Morale promotion in my mod) no longer reduces the actual damage done but instead reduces the maximum damage that can be done. Strength ratio and collateral percent no longer affect this limit; you must use promotions, which provides much-needed balance to the Drill series vs the Combat series.

FlankingDamageMod (NEW) (CvUnit.cpp)

Extends collateral immunity to also count as flanking immunity. Protection from the Drill promotions (and Morale promotion in my mod) now reduces the maximum flanking damage that can be done as well.

WithdrawalMod (UPDATED) (CvUnit.cpp, CvGameTextMgr.cpp)

I didn't feel like adding another new XML tag so I added functionality to the vanilla <iWithdrawalProb> one instead. It now allows negative values, which have the effect of increasing the withdrawal chances of units that attack the unit. I currently use this with the Ironclad, which provides some survivability for people who still have wooden warships. It also makes ironclad vs ironclad battles more likely to end in withdrawal as happened historically.

Allows land units currently on water tiles (generally helicopters) to have their normal withdrawal chance, rather than being unable to withdraw.


AirCombatMod (UPDATED) (CvUnit.cpp, CvUnitAI.cpp)

My attempt to implement an air superiority mission that fakes the AI players into using it *intelligently* without requiring modding of the AI itself. There is no new mission; rather it changes the way air strike missions work. This replaces the BetterAI air combat changes. All units, both land and air, are limited to one intercept per turn. Air units without any air interception capability still try to avoid being intercepted when performing missions; they roll against the enemy's intercept chance as well as with their own stealth/evasion chance (if any). If intercepted anyway, however, some non-intercepting air units (like the WW2 Bomber) have a "Returns Fire" stat that can allow them to damage or destroy the interceptor (if it's an air unit) with relatively low odds.

Air units *with* interception chances, however, seek out air combat if possible when performing any mission other than the passive city circling. If a surface unit attempts to intercept their mission they try to avoid it as above, but if it is an air unit that takes the defense then the two fighters attempt to meet for a battle. The chance of this happening is the higher of their two interception stats. If this fails then the aggressor successfully performs his mission, however if a battle occurs each fighter's odds of victory are determined by a combination of both interception stats and both evasion stats (if any). The loser will either be damaged or destroyed, which is handled below.

Allows air units to intercept after moving, as with surface units.

Causes the interception chances of surface units to be lower when wounded, as with air units.

Causes air units that perform recon missions to be vulnerable to intercepts.

Causes air units that perform air strike missions, are involved in intercepts, and survive to use up a movement point (as with all other offensive missions).

Modifies how much value the AI associates with Intercept and Evasion bonuses on promotions for use with the unit and promotion stats in my mod.

AirLethalityMod (UPDATED) (CvUnit.cpp, CvUnit.h, CvUnitAI.cpp, CvInfos.cpp, CvInfos.h, CyInfoInterface1.cpp, CvGameTextMgr.cpp)

Separates damage, and thus lethality, from interception probability. In vanilla the damage done by an intercept is based on the interception chance (actually the square of the chance), which really sucks. Now you can specify the two independently in XML, which allows for things like WW2 fighters, battleships, and flak cannons doing a lot less damage than missile-based units while still having a relatively high intercept chance, as well as for finer tweaking of air combat stats in general. The additional stat is displayed in the unit mouseover, of course.

The relevant tag is called <iInterceptionLethality>, just below <iInterceptionProbability>. Here are some example values and their effects. Values below -99 and above 100 are invalid.
-99: Intercepts do a random amount of damage between 1% and 99% of the target's max health, and can be fatal if and only if the target did not start at full health.
-50: Same as above, in range 1% to 50%.
0: Intercepts never do any damage, but still force incoming aircraft to turn back.
50: Intercepts have a 50% chance of being fatal outright; if this does not occur, a random amount of damage between 1% and 99% of the target's max health is dealt instead (which can still prove fatal as above).
100: Intercepts are always fatal.

Also adds support for giving air units a "-50% vs Air Units" type stat, which is taken to mean the unit has a 50% to die (explode) outright when intercepted, before the interceptor's lethality is even considered. (This is used with the Airship in my mod.)


SiegeMod (UPDATED) (CvCity.cpp, CvCity.h, CvCityAI.cpp, CvPlayer.cpp, CvPlayerAI.cpp, CvUnit.cpp, CvUnitAI.cpp, CvInfos.cpp, CvInfos.h, CvGameTextMgr.cpp, CvPlot.cpp, CvSelectionGroup.cpp, CyCity.cpp, CyCity.h, CyCityInterface1.cpp)

Changes bombardment to do a fixed, absolute amount of damage rather than a % of the city's max defense in damage. City healing of bombardment damage remains percent-based so that it doesn't take forever for 100-125% defense cities to heal back from zero.

Just for reference, in the XML of my full mod (not provided) I have cities set to heal 10% per turn, land siege ranging from 3% (Catapult) to 8% (Mechanized Artillery) bombard strength with two levels of Accuracy promotion (2% each) available to land units only, fighters ranging from 0-4%, bombers ranging from 6-10%, and ships ranging from 2-10%. These constitute *very* heavy nerfs from vanilla stats.

Manually removes the Palisade, which is a building I use from the Stone Age mod, if Walls are built in a city, as they are incompatible visually and simply obsoleting it is not sufficient.

Adds support for buildings that add to a city's culture defense instead of its physical defense. Examples in my mod include the Palisade (since it must be a precursor to Walls, and thus weaker, but any physical defense I could give it that is noticably lower than that of Walls would be largely useless when cities get these amounts from early culture level expansions anyway), and the NextWar Energy Shield from the end of the tech tree (where adding to physical defense would be pointless).

Removes various restrictions which caused the AI to consider 3/4 or 5/6 bombardment sufficient before proceeding to either attack, blockade, or move on. The AI will now fully bombard its targets.

Fixes some broken logic in BombardTarget() in CvUnit.cpp that will never normally run; it involves picking a bombard target if more than one exists within one tile of the bombarding unit, but since bombard targets pretty much have to be cities I'm not sure why this function even exists given the minimum tile distance required between cities that makes this scenario impossible. I guess they were just being thorough.

BombardLimitMod (UPDATED) (CvInfos.cpp, CvInfos.h, CvGameTextMgr.cpp, CvUnit.cpp)

Installs limitations on how far certain units can bombard defenses, which show up on unit mouseovers. Also adds separate tracking of physical and cultural defense damage and displays both, which fixes some problems and allows the bombard limits to work correctly in all cases. Uses the <iBombardLimit> tag just below <iBombardRate>.


UpgradeCostTraitMod (CvInfos.cpp, CvInfos.h, CvGameTextMgr.cpp, CvUnit.cpp)

Allows putting a unit upgrade cost modifier in traits like you already can with civics. (I currently use this with Financial.)

CivicUpkeepMod (NEW) (CvPlayer.cpp)

Removes 3 corrupting factors (involving the number of civic categories and which one you're in) from the calculation of civic upkeep costs. Costs are now uniform across the board; Medium Upkeep means Medium Upkeep, damnit. (Okay so maybe it's less cool this way, and less realistic, but it makes balancing the effects of the various civics a lot easier/better, and if you add new civic categories you can put them on the right end for visual separation without being stuck with bad prices now.)

LakeSizeMod (CvArea.cpp)

Makes the definition of a lake scale with map size. With an XML Globals value of 4 which is what I use, lakes will become inland seas when greater than 4 tiles in size on Duel, up through greater than 16 tiles in size on Huge.

GoodyHutMod (NEW) (CvPlayer.cpp)

Removes the "not before Turn 10" restriction on getting Experience Huts. Removes the "never with no cities, and not within 7 tiles with one city" restriction on getting Barbarian Huts. Removes the "not before Turn 20, and never in multiplayer" restriction on getting Offensive Unit Huts. Makes Tech Huts unable to provide techs which the player has already done any research in. (This last one is exploitable as it currently stands, I know, but for my purposes is well worth it.)

Allows player, though not barbarian, research to begin immediately on Turn 0 without having to found a city first. (This change has no significant effect but I like it anyway.)


AnimalMod (UPDATED) (CvGame.cpp, CvUnit.cpp, CvUnitAI.cpp)

Makes animals unlikely to leave their TerrainNative and/or FeatureNative tiles, unless attacking something. (Before these XML tags just specified where the animals would spawn and didn't attempt to restrict their movement.)

Prevents animals from instantly de-spawning everywhere when barbarians start. There will still be no new animals spawning after this point.

Allows animals to enter player borders, and tiles with resources or improvements when not attacking. They will still move entirely randomly unless locked on to a target, but if they happen to wander into an undefended city it will be captured or destroyed.

BarbarianMod (UPDATED) (CvGame.cpp, CvUnit.cpp, CvPlayer.cpp)

If starting a game in an era later than the first, the reduction in time before barbarian cities start appearing is changed from a "1 + Number of Eras Skipped" division to a 10%-per-Era subtraction. (If nothing is changing the total number of eras, a Future start would normally cause them to start at 14% of the base delay, versus 40% now.)

Removes the requirement of 1.5 cities per living player on average (unless One City Challenge) for barbarians to start.

Fixes a bug causing barbarians to start one turn later than they should. (If they were set to start on Turn 90, for example -- after Turns 0-89 ie 90 turns of peace -- they would not actually appear until Turn 91.)

Fixes a bug introduced with the AnimalMod, where the number of barbarians spawned each turn was unintentionally being reduced by the number of animals still alive.

Continues the grand tradition of barbarian naval assaults throughout an entire game, rather than letting them stop once players fully control all major coastlines. Barbs are restricted to spawning ships on coastlines as before until the barbarian player acquires Astronomy, at which point they attempt to spawn half of their ships in coastline and half in ocean (although if no valid coastline locations are available those will then become ocean spawns as well). Once the barbarian player acquires Assembly Line they spawn all of their ships in ocean. Ocean spawns are also modified to only allow ocean-capable ship types. (This won't work very well in mods that significantly change the tech tree, or at all in mods that use a completely different tech tree, of course, but it was a quick and effective solution for vanilla-esque setups. Note: I did not include the BetterAI reduction in barb ship spawn rate that scales with player navy sizes, as I believe the game is better without it.)

Adds support for the XML Production Cost value of -2, which specifies a unit the barbarian player can train, but no one else can. Also prevents the BarbarianCombatModifier and AIBarbarianCombatModifier XML effects (from the difficulty settings) from applying to such units, so that they cannot be killed more easily than intended. Designed for use with the Kraken in my mod.

PirateMod (NEW) (CvGame.cpp, CvPlayer.cpp)

Moved from Python to SDK for speed: Every barbarian ship that spawns, and has a cargo capacity, will have its mission changed to ASSAULT_SEA and will spawn a full load of carried land units (using the same rules as normal land barbs).

Moved from Python to SDK for speed: Checks all barb ship transports at the end of each turn and changes their mission back from ASSAULT to ATTACK if they're not carrying anything anymore. Prevents huge numbers of empty Galleys, Kogges, Galleons and Transports from piling up in barb cities and slowing the game down, as well as providing more (relatively weak) barb ships that attack players.


CityTileCommerceMod (CvPlot.cpp)

Makes city tile commerce additive rather than an enforced minimum. This is mainly so that players will not be penalized for building cities on rivers, but also lessens the hit for building on resources that give commerce naturally (without their improvement). Food and hammers are still treated as enforced minimums.

FeatureGrowthMod (NEW) (CvPlot.cpp)

Allows features to grow into tiles that already have improvements built, if they're allowed there. (I use this with Camps that can exist in forests in my mod, for example.) Also allows features with an improvement present to still generate spreads; before if you built a Forest Preserve in a forest, for example, that forest would no longer be able to cause new forests to grow in adjacent tiles.

EventTileDowngradeMod (NEW) (CvPlot.cpp, CvPlayer.cpp, CvCity.cpp)

Tile improvements that are hit by destruction events (like a Tornado) now behave as if they were pillaged instead; most are still destroyed, but Towns downgrade to Villages instead of being wiped out entirely, for example.

RailroadMod (NEW) (CvPlot.cpp, CvPlayerAI.cpp, CvGameTextMgr.cpp)

Supports upgrading the speed of railroads with techs. (This is used with Maglev in my mod.) Also modifies the AI to value all route-enhancing effects on techs equally, so that something like Maglev is given the same priority as Construction with its road speed increase even though the actual values are very different.

PillageOwnRoadsMod (CvUnit.cpp)

Allows you to pillage roads and railroads in your own territory. Serves no real purpose most of the time, but useful for those of us who like to have roads only inside city working radii from a vanity standpoint.

DemolishOwnCitiesMod (NEW) (CvUnit.cpp)

Allows you to blow up your own cities. *Solves the age-old desync problem in multiplayer!* Okay maybe not such a breakthrough nowadays, but I haven't seen anyone else do it yet. Basically it activates the Pillage command for your military units in your own cities, which is then used to trigger the demolition. Also saves the presence of National Wonders, Great Wonders, and Holy Cities, if any -- basically all the unreplaceable stuff -- in a temporary memory buffer; the next human player to place a new city will have these items instantly restored there. It is definitely abusable at the moment (in several ways heh), Corporation HQ's need to be added to the list of things saved, and if the power goes out or you have to reload a save or whatever the items will be lost, but for now it serves its purpose nicely, allowing you to move a city if scouting or vision of a new resource type change your mind about where to put it, or if you find a wonder in an enemy city that is in a terrible location for your empire.

CultureDecayMod (NEW) (CvGame.cpp)

Based on the old Python versions by other people, but moved into the SDK for significantly more speed (since this is a full sweep of all the map tiles and it occurs on every turnover).

ReligionMod (NEW) (CvPlayer.cpp, CvPlayer.h, CvPlayerAI.cpp, CvGame.cpp, CvTeam.cpp, CvUnit.cpp, CvUnitAI.cpp)

Adds the following restrictions: a player cannot found more than two religions, and a city cannot have more than four religions in it. If a player is the first to a third religion-founding tech, he will simply leave the religion for someone else to found and proceed as normal. A missionary cannot spread a religion to a full foreign city (ie no foreign inquisitions). If a missionary attempts to spread a 5th religion to one of his own cities, and doesn't randomly fail as he normally can, his religion will override/replace one of the existing ones at random (with all related buildings being immediately torn down), subject to one condition: if the player also owns the holy city for a religion that is present (or the target city itself is a holy city), that religion is immune to removal and one of the others will be chosen instead. If all 4 religions in the target city are protected, spreading in that city is not possible. (Having 4 protected religions is possible by conquering other players' holy cities; there is no cap on acquiring them this way.) No longer checks with the Python function that can override spread validities if it exists.

This mod replaces my previous one reducing gold income from shrines (by up to 50% based on world size), which were overpowered when a single player could get 4 to 7 of them just by having a high-tech-rate early game. It removes the mess of spreading that many religions to all of your cities to get all the shrine money, and reins in the runaway extra happiness (up to +14) from having lots of temples and being on Free Religion, which was very difficult to deal with from a balance standpoint.

Also fixes a bug where barbarian players could found religions. This was extremely unlikely in vanilla (though not technically impossible if the barbs had a lot of cities), but under my system if one or more players who had already founded their two religions early then also got the founding techs for later religions before someone else did, the barbs would start to research these techs passively at the normal rate and potentially get them fast enough.

Further, blocks the AI from performing domestic inquisitions (spreading a 5th religion to a full city) if they neither have the holy city for the new religion nor are using it as a state religion. I'm not actually sure if they would or not, but this guarantees they will not do anything stupid if they have the ability to make missionaries for 5 or more religions but only control 3 or fewer holy cities (as it would then be possible to swap out replaceable religions with other replaceable religions endlessly, wasting production time both on missionaries and on rebuilding purged religious buildings). This restriction does not apply to human players.

Changes the odds of success for a missionary spreading a religion to 100% for own/teammate cities and 80% for other cities, minus 10% per existing religion there. Under the above system the lowest domestic spread chance is thus 60% and the lowest foreign spread chance is 50%. (This is much simpler, and better, than before imo, where the odds would range from 100% to 40% domestic and 50% to 20% foreign depending on the number of existing religions there; constant missionary failure is annoying and unnecessary.)

GreatPersonMod (NEW) (CvPlayer.cpp, CvGameTextMgr.cpp)

A city's great person mouseover (and the Great Person Bar in my mod) now display the *final* odds breakdown of person types assuming things continue as they are currently, rather than the odds breakdown if the person were generated immediately (which is irrelevant). You can see what effect changing a specialist, for example, will have on the final person chances while there is still time for such decisions to matter.

Removes the doubling of threshold increases after every 10 great people (and every 10 great generals, separately).
Jan 29, 2006
Boston, MA, USA

TextColorMod (CvGameTextMgr.cpp)

Adds separate XML tags for Team Project, World Project, National Wonder and Great Wonder name colors. The XML file with the colors I'm using is included.

UnitStringMod (UPDATED) (CvGameTextMgr.cpp)

Significantly improves both versions of the unit mouseover text (there's one for Pedia/TechTree and one for actual units): things are listed in a more consistent order and text has been shortened to fit on one line in most cases. It is significantly more readable while maintaining the original format. Also adds new information that had been sorely missing to the player, such as collateral damage percent, number of targets, and limit, and air strike damage limit.

PromotionStringMod (NEW) (CvGameTextMgr.cpp)

Same as above, for promotions.

BuildingStringMod (NEW) (CvGameTextMgr.cpp)

Same as above, for buildings.

CityStringMod (UPDATED) (CvGameTextMgr.cpp)

Significantly improves the health and happiness mouseovers in city view: things are listed in a better, more sensible order; positive building health has been separated into two lines for buildings and wonders; positive building happiness has been collapsed into two lines for buildings and wonders, with the latter no longer repeating the same text; positive building happiness has had the leading word "Some" removed to avoid running onto a second line; the two "Total Happiness" lines match the format of everything else now; the Charismatic leader effect has been given a more sensible description than "OH YEAH!", with the city.getExtraHappiness() effect separated out and remaining on "OH YEAH!" in case it ever shows up (I don't think it's used currently but I'm not positive). The XML file with the necessary supporting text tags is included.


UnitNameMod (UPDATED) (CvUnit.cpp, CvPlayer.cpp, CvPlayer.h, CvString.h)

Removes the base type in parens after renaming a unit, and adds tracking to the save file format for how many of each type of unit a player has ever made or acquired. Names units "Warrior #1", "Warrior #2", etc. (The save file tracking is necessary so new units continue to be be assigned higher numbers rather than taking the spots of deceased lower-number ones.) Upgraded units also add their original name (which is preserved through multiple upgrades) to the end of their current name, in parens (unless they are Warlorded). "Archer #1" might become "Longbowman #4 (Archer #1)" and then "Musketman #2 (Archer #1)", for example.

NotificationMod (UPDATED) (CvPlot.cpp, CvCity.cpp, CvPlayer.cpp)

Creates new notifications for displaying in-game turnover messages when a player's tile improvements upgrade, when pirate transports unload raiders, and when there is Kraken-related carnage. This is in addition to my highly useful city growth turnover message that uses an existing notification. (The actual messages are generated in Python.)

MPMovieMod (NEW) (CvPlayer.cpp, CvTeam.cpp)

Allows era and wonder movies to play, and restores the full dialog and quote for acquiring a tech, in multiplayer games. I have no idea why these were ever disabled in the first place; I pretty much only play multiplayer and I missed having them.

StatisticsMod (UPDATED) (CvUnit.cpp, CvPlayer.cpp, CvPlayer.h, CvPlot.cpp, CyPlayer.cpp, CyPlayer.h, CyPlayerInterface1.cpp)

Creates various additional notifications for my version of the StatsMod. Now also uses the SDK to store all StatsMod data in the save file, since I wasn't really comfortable using Python utilities to do this and it's faster this way anyway.


12monkeys TeleportingIntoLakeFix (CvUnit.cpp, CvCity.cpp, CvCity.h, CvPlot.cpp, CvPlot.h)

If a naval unit is forced to teleport to the nearest valid tile, it doesn't wind up in a lake where it will usually be stuck.

RogerBacon CameraZoomFix (CvUnit.cpp)

Allows combat camera zoom, if enabled in the game options, to function when defending. Why the heck is this disabled in vanilla? It works fine.

Chalid SlowCulturalBordersMod (CvCity.cpp)

Love, love, love this one. Works best when you double the number of culture levels to match the number of city border sizes now available.

Blake/Iustus/JDog5000 BetterAI (too many files to list)

What more can one say? It doesn't get any more essential than this.

Moctezuma InfluenceDrivenWar (CvUnit.cpp, CvUnit.h)

I'm using a limited/minimal version of this, but it's still good.

EmperorFool EventPictureMod (CvDLLButtonPopup.cpp, CvInfos.cpp, CvInfos.h)

Adds picture popups to events. Terrific.


Mongoose FirstStrikeFix (CvUnit.cpp)

Included in Warlords 2.0.8. My biggest find ever! Mwa ha ha.

JLC/Pep PrivateerEntryFix (CvUnit.cpp)

Included in Beyond the Sword 3.19. Fixes a bug preventing privateer type units from moving directly from a city into unfriendly borders. Nice find guys.

12monkeys UUTrainingValidityFix (CvPlayer.cpp)

Included in vanilla at some point. Fixes an exploit whereby it's possible to acquire the unique units of civilizations other than your own.

RogerBacon FlyingMod (CvInfos.cpp, CvInfos.h, CvGameTextMgr.cpp, CvUnit.cpp, CvUnitAI.cpp, CvPlot.cpp, CvPlot.h, CyInfoInterface1.cpp)

Included in Beyond the Sword at some point.

Mongoose FlyingModExtension (CvGameTextMgr.cpp)

Now part of the Mongoose UnitStringMod. Allows for display of bIsFlying ability on unit mouseover. Made independently and around the same time as Mexico's version, apparently.

Mongoose MPCameraFix (CvUnit.cpp)

Removed due to being very glitchy in practice, frequently not resetting the camera to normal after a combat. I need to try using this again, as it may work in BtS.

Mongoose ShrineMod (CvCity.cpp)

Replaced by the Mongoose ReligionMod. Makes gold received from shrines scale with map size. It will now scale from 100% of normal on Duel, down to 50% of normal on Huge (at -10% per map level basically). This constitutes a much-needed nerf, as the total number of cities in the world tends to get very high on large maps.

Mongoose DamageDampeningRemovalMod (CvUnit.cpp)

Removed, due to me changing my mind about it being a good idea. Removes the damage dampening effect from Collateral and Air Strike combat. This effect weights the strength ratio of attacker and defender by the average of the two strengths, with the end result being that a tank and warrior are far closer in relative strength than they perhaps should be for the above combat modes.

The dampening remains in place for normal surface combat, as removing it has serious consequences (first strikes become too powerful on high strength units and too weak on low strength ones, and combat odds approach zero and 100 far more quickly with differences in strength between attacker and defender which is no fun at all).


TheLopez PiratesMod (CyUnit.cpp, CyUnit.h, CyUnitInterface1.cpp)

TegNavanis UnitStatisticsMod (CvUnit.cpp)


* See if it's possible to revert the random functions to their pre-Warlords behavior of actually locking the random seed in multiplayer like they're supposed to. Single player works fine but in MP games you can still reload to change the outcome of a fight, or anything else, as much as you want.
* Support for some invisible units (specifically sea mines) triggering combat when their tile is entered by a hostile non-detecting unit. Currently they behave like submarines and are simply pushed aside without fighting, so I have to use visible mines for now and rely on their cheapness to make them worth building.
* Try to automate the air recon mission so it keeps scouting the same tile each turn until told to stop.
Jan 29, 2006
Boston, MA, USA
Work on my full mod (which includes this) has continued for the last two years for private use, but with the new official patch and BetterAI versions, and with the mod really coming together finally, this seemed like a good time to post an update. :)


Aspiring Codesmith
Jan 16, 2009
Do you have everything marked out individually in the files? If I just wanted to use your unit upgrade mod and your animal mod would I be able to just run a search and then copy and paste into my own SDK? Or would I have to pick through and search out the differences?


Jun 22, 2007
Nice. What about adding Thomas Pi's idea: XML tags for "chance to see an invisible_XYZ unit" (not 0% or 100% like in vanilla).

* Try to automate the air recon mission so it keeps scouting the same tile each turn until told to stop.

already included in bbai 0.78.


Jun 22, 2007
Something is missing in the pirate mod code. Getting this error when compiling a new dll:

1>CvGame.cpp(6463) : error C2065: 'pUnit' : undeclared identifier
1>CvGame.cpp(6464) : error C2227: left of '->cargoSpaceAvailable' must point to class/struct/union
1>        type is ''unknown-type''
1>CvGame.cpp(6464) : error C3861: 'pUnit': identifier not found, even with argument-dependent lookup
1>CvGame.cpp(6466) : error C2227: left of '->AI_setUnitAIType' must point to class/struct/union
1>        type is ''unknown-type''
1>CvGame.cpp(6466) : error C3861: 'pUnit': identifier not found, even with argument-dependent lookup
1>CvGame.cpp(6467) : error C2227: left of '->cargoSpace' must point to class/struct/union
1>        type is ''unknown-type''
1>CvGame.cpp(6467) : error C3861: 'pUnit': identifier not found, even with argument-dependent lookup
1>CvGame.cpp(6556) : error C3861: 'pUnit': identifier not found, even with argument-dependent lookup

edit: nevermind.

void CvGame::createBarbarianUnits()
	// Mongoose AnimalMod BEGIN
	CvUnit* pUnit;
	// Mongoose AnimalMod END

seems to belong to PirateMod instead of AnimalMod.


The White Wizard
Jul 31, 2007
Austin, Texas
Holy cow. I never even noticed this gold mine of a modcomp. It has so many features that I never even thought of. Great, now this is on my todo list as well, for RoM. (Don't worry, I'll credit you.)


Great Engineer
Nov 17, 2005
Are any of these fixes submitted to the Unofficial Patch? :)


Sep 21, 2008

I'm going to use your work, LunarMongoose. With crediting as well ;)


Apr 16, 2006
Hi, I've tried to implement the UpgradeCostTraitMod but something isn't right. Now there is no cost at all for any trait to upgrade units.

The XML seems all to be there and functioning but any value inputted is only superficial. Its always 0 gold upgrade.

My DLL has exactly the same code as the original source (will check it again in the morning).

Aside from the SDK, I have only edited CIV4CivilizationsSchema.xml & CIV4TraitInfos.xml and added the necessary Text (from the unkeep modfier trait text).

Can anyone help?
Jan 29, 2006
Boston, MA, USA
Nice. What about adding Thomas Pi's idea: XML tags for "chance to see an invisible_XYZ unit" (not 0% or 100% like in vanilla).

Interesting idea. I'll think about it, but I kinda like it better the way it is, especially in my full mod where the detection game is a bit more robust and balanced.

already included in bbai 0.78.

Thanks for pointing that out.

seems to belong to PirateMod instead of AnimalMod.

Sort of. The block in question was originally used to remove pLoopUnit, which was used in the vanilla code at the bottom to despawn all animals when the Barb phase begins; hence the AnimalMod tag. I then hijacked it to declare pUnit instead, which I use in the big PirateMod block further down. So I could've been more precise and specific by mentioning the PirateMod too, and will update that here at some point.

Can anyone help?

I'm quite certain it works fine on my setup here. I don't have time yet to try to figure out what the problem is on your end, sorry heh.
Jan 29, 2006
Boston, MA, USA
Crossposted from the old (Warlords) thread:

I implemented this feature in PIG Mod but I have a problem with it. On many maps now, there can be fresh water lakes of size larger than 9. On Huge, I think it's more than 20 tiles even.

The problem is, things like lighthouses, harbours, galleys etc. all can usually only be built in coastal cities because they have a hardcoded requirement of iMinAreaSize of 10. (For some reason, a drydock is unique, requiring 20 instead.)

IMO, one shouldn't be able to build lighthouses (for example) on fresh water lakes because it's having your cake and eating it too.

The fix I propose is as follows.

I'm not all that familiar with this part of the code so if there's a better way to do this or if this will cause unforeseen problems maybe let me know?

It seems to be working as expected for me so far.

Damnit, stop finding things I need to fix. I'm trying to play and enjoy the game at the moment, not mod it. *mutters something about giant flaming llamas under his breath* ... Nice catch PoM! :p The LakeSizeMod is one of the first things I wrote - back in 2006 or thereabouts - and it was in the earliest versions of this release. I would've had a better chance of foreseeing the problem you point out had I been writing it more recently, but even so it's probably something that would've only come up in playtesting... Which it hasn't so far, so yeah, you win. ;)

I'm considering closing down public releases of the MongooseSDK b/c BetterAI is adopting some of it nowadays, and because I want to keep some of the more advanced modding exclusive to the full mod which I'm still planning to post at some point here, but we'll see.

Yeah, your code will work. I've added it to my internal version; I changed the comment format just a little and I don't like reassignment to local arguments (iMinWaterSize in this case) even though with primitive types it's fine, so I rewrote that slightly, but yeah. Thanks for finding this (and for the obvious credit). :)

p.s. -- My new Sandworm code isn't working either... grr. My copies of the two Dune miniseries just got here too, which I only ordered b/c of the Dune mod on here... I have to get this sandworm working! lol.


Drill IV Defender
Retired Moderator
Jan 15, 2006
One small thing. I have been noticing a problem in my recent game and I have a slight suspicion it's caused by the fix i implemented.
Boats can cross diagonal land bridges now. e.g.
graphically displays as connected by land, where W = water, L = land. My boats can cross that gap now. :confused:


Nov 25, 2003
Way off topic for this thread, but since PoM asked here ...

Spoiler :

The bug is from BBAI and in CvGameCoreUtils.cpp, function pathValid(). There's a block in the middle which checks exactly this, inside a DOMAIN_SEA if and with a firaxis comment:
// XXX might want to take this out...
before it.

That if block needs to be the first block in the function, in front of the pSelectionGroup->atPlot(pFromPlot) if statement.

I guess this answers the firaxis programmer's comment about whether to take this out!

Fixed in revision 532 of BBAI svn.
Top Bottom