Not open for further replies.


Already Looping
Dec 19, 2017
Hey all,

New beta version inbound. Few balance changes in this one, mostly bugfixing. I am also back from my long hiatus where I was dealing with rather intense personal issues - thank you for your patience, everyone. I intend to be active in hotfixing issues for the next while.

As for the VP Congress, expect an announcement on that sometime soon.

For now, a tremendous thanks to @axatin for finishing the espionage rework (and some bugfixing and other improvements besides that), to @KungCheops for a ton of work on improving Worker AI, and to @azum4roll for an impressive amount of cleanup work, including many of the changes in this release. Thanks also to @ilteroi, @Enginseer, @Vaderkos, and @L. Vern for a variety of other changes and fixes.

Without further ado...

- Added more support for customizing notification settings (axatin)
- Added units to map state logging for AI test games (L. Vern)
- Exposed AI policy scoring functions to LUA for easier debugging
- Performance improvements
- Code cleanup

- Added the remaining parts of the spy system rework (thank you for your patience, everyone)

  - Mission costs now scale with game speed as intended

  - Tourism modifier is now +20%
  - NP rate is unaffected by counter-espionage network and City Security
  - Now provide a wealth of information about the player being spied on
  - 200 NP or more: Reveals player's tech and policy/ideology tree, begins receiving intrigue
  - 500 NP or more: Reveals all military unit types and counts, +20% Gold from Trade Routes for both players
  - 800 NP or more: Reveals all trade deals and true approaches with all players
  - New UI added for all of this

  - Now awards 15 XP when uncovered (down from 25)
  - Unchanged: Target is planning a sneak attack, building up an army, plotting against another player
  - New: Target has bribed someone else to go to war
  - New: Target has agreed to a co-op war request with someone else (only against humans)
  - New: Target's military might has risen by 20% of the global average (only against humans)
  - New: Target has started construction on a Spaceship Part, Project or Wonder in any city (doesn't reveal city)
  - New: Target bought/sold votes from to/another player (details are not given, can be checked with 800 NP)
  - The new human-only intrigues are the human versions of the AI's 'plotting against another player' or 'building up an army' intrigues

Map Generation
- Changed most area checks to landmass checks
    Should fix most Terra-styled maps having all civs on one side of the biggest landmass leaving the other side empty
    Continents-styled maps will fall back to Archipelago-styled civ placement if landmasses are too small, or Terra-styled if there's only one big landmass
    Civs should never start isolated (alone on a landmass) in Continents/Terra-styled maps unless above fallback is triggered
    New Lua functions for modders:
    - Map.FindBiggestLandmassID(bWater), returns number (landmass ID)
    - Map.GetNumTilesOfLandmass(iLandmassID), returns number
    - plot:IsAdjacentToLandmass(iLandmassID), returns boolean
    - plot:GetLandmass(), returns number (landmass ID)
- Fixed Communitu_79a crash if "Override AssignStartingPlots" is set to "No"
- Fixed resource placement crash if the game attempts to place the resource of the highest ID (should be the cause of EMR "incompatibility")

  - Explore quest is no longer given before Astronomy is researched (even for Polynesia)
  - Will only ask to clear barbarian encampments on landmasses with at least one of your cities

Misc. Balance
- Puppets and automated cities can now build Workers / Work Boats

- AI pantheon selection completely rewritten
    AI selects pantheon beliefs based on terrain, existing and potential cities, policy choices, player traits and neighbors
    Selection of other beliefs is unchanged
- Adjusted AI expansion logic again, should be settling a lot more, including when at war
- 'Known visibility' code now uses a more performance-friendly but memory-intensive method
    Also fixed a lot of bugs with it

  Builder AI Rework
  - Top down rework of how automated and AI Workers are given their orders, and human controlled Workers are given recommendations
      Improvement planning has been split into two phases, which are run once per turn for each player
      Phase 1: Figure out the best improvement for each tile (scoring each improvement)
      Phase 2: Choose the closest Worker for each of the highest scoring improvements
      The first phase accounts for things like not building improvements that can't be built adjacent to each other, not building too many defense buildings in the same place, etc.
      It makes very limited use of "magic numbers" and instead evaluates builds based on yields/resources/defensive bonuses and more
      In the second phase, human controlled Workers will be given a recommended job but not moved
      In the second phase, Workers prioritize jobs in their immediate neighborhood, especially if they require less time to construct
  - Tons of bugfixes and improvements to road planning, including the following:
      Roads are built based on city connection bonuses, movement change from building the route, and village bonuses (prioritizing lower total move+build times)
      Fixed Roads being removed if 'Automated Workers Don't Replace Improvements' is enabled
      The Iroquois will no longer remove forests to build villages on forest routes
  - Construction time is an important factor, but not the only factor considered

Combat Bugfixes & Adjustments
- Melee attackers now take proportionally less damage when dealing the killing blow to a low HP unit/city
    Cities at 0 HP can no longer damage melee attackers
- ExtraNavalMovement now only grants movement to embarked units and not naval
    May break modmods that rely on this column
    Use MovesChange instead if the promotion is only given to naval units, or make a separate promotion for land/naval otherwise
    You're giving this promotion from a building? that's a weird use case... use lua or something?
- Fixed bonus vs fortified, wounded/non-wounded, units above/below half HP, and multiattack bonus being applied on ranged units when defending against ranged attacks
    For VP, this slightly nerfs Barrage, Accuracy, Firing Doctrine, Coup de Grace, Prize Rules, Infiltrators, Targeting, and Marksmanship (Bowman and Cossack)
- Fixed general stacking bonus not working (Companion Cavalry, Naresuan's Elephant)
- Fixed most plot-specific combat bonuses, fortify bonus, and near capital bonus not being applied on ranged units when attacking, or defending against ranged attacks
    For VP, this slightly buffs Altitude Training on ranged units, as well as all ranged units that can fortify
- Fixed open/rough ranged attack bonus working against cities
- Fixed Field's bonus against units in open terrain not working (used the wrong, melee-only column this whole time)
- Fixed combat strength penalty from being damaged not counting the first 1 HP lost (WOUNDED_DAMAGE_MULTIPLIER: 33 -> 34)
- Fixed bonus vs mounted not working against skirmishers in ranged combat (Longbowman)
- Fixed Hellenic League bonus not being applied on ranged units when attacking, or defending against ranged attacks
- Fixed trait bonus against more advanced units not being applied on ranged units when attacking, or defending against ranged attacks (unused)
- Fixed trait bonus against civs with more cities not being applied on ranged units when attacking, or defending against ranged attacks (unused)
- Fixed non-general/admiral friendly combat auras not being applied on ranged units when attacking, or defending against ranged attacks (unused)
- Fixed NearbyCityCombatMod column only being applied to ranged attacks instead of all combat (Patriotic War, Siege Volleys)
- Fixed ranged units benefiting from monopoly attack bonus instead of defense when defending against ranged
- Fixed ranged units benefiting from sapper bonus when defending against a city (Siege Tower)
- Fixed Hunnic UA not working on city strikes - it doesn't specify units only
- Removed any consideration of damage multiplier from damaged units - it doesn't work like that anymore

Combat Simulator (EnemyUnitPanel.lua)
- Completely rewritten, file ~60% smaller
- Combat strength, damage, modifiers, and targeted unit (in a stack) should now be completely consistent with game logic
- Removed support for "fire support" (ranged unit in range of a melee enemy attacker auto-fires before the attack; half-implemented vanilla unused function)
- Factored in "ranged support fire" (this is Impi and GDR's extra attack; confusing names I know) damage and resultant combat malus from it in both combat simulator and tactical AI
- Removed any consideration of damage multiplier from damaged units - it doesn't work like that anymore
- Note for modders:
    Overall, defensive combat modifiers should never be exclusive to melee units defending against melee attacks, despite what the old combat simulator suggests
    The code simply won't work, since melee units don't care whether they're hit by melee or ranged outside of the RangedDefenseMod column
    Ranged units defending against melee attacks also uses the same function to determine defensive strength

Other UI Changes
- Condensed notifications when war is declared or peace is made: Notifications are shown only for the major players, and the notifications contain a list of the vassals and CS allies involved
- It is now mentioned in the notification if a declaration of war is triggered by a Defensive Pact
- Added a notification when a foreign city is conquered
- Inquisitors now have a preview of the new number of followers after removing heresy in a city
- EUI: Notifications for cultural influence no longer stack (it wasn't possible to cycle through them as clicking on them leads to the tourism screen)
- Added a "Close" button to the popup to select a conquered city's fate
- Renamed Solar Farm to Solar Power Plant
- Renamed Wind Farm to Wind Power Plant
- Removed redundant "Only X allowed per player/per team/in the world" line in EUI building tooltip
- Tooltip of embassy tile no longer spoils its owner's identity if unmet
- Removed tech icons of Polder (Water) for non-Dutch players
- City banner now has an icon showing the Great Wall/Ostrog border effect
- Changed how experience gain is displayed
    Now shows the difference of rounded new/old values instead of rounded difference of new/old values
    Doesn't show if +0 XP
    Experience gain will seem to fluctuate in quick/epic speed (due to non-integer experience), but so is the displayed current exp
- The reason why you cannot delete a unit is now displayed in the UI
- War duration is now shown in the UI next to War Weariness
- When showing World Congress vote results, the max. number of entries listed is now 43 (was 16)
   Since contrary votes can be traded, the text can still be cut off, but should be less likely
- Units in the build queue can no longer be bought, as this was leading to bugs
- Many text fixes, including the following:
    "Military Supply from Population" and flat "Military Supply" now use different icons to better differentiate them
    Gun/Gunpowder units have been standardized to Gunpowder
    Armor/Armored units have been standardized to Armored
    City Defense/City Strength have been standardized to City Strength
    Every unique component (ability, unit, building, improvement/build) description, strategy, and recommendation text has been rewritten
    Some building descriptions have also been clarified/standardized
    Every promotion text has been rewritten
    - Some promotions that didn't have help text now have one
    - 99% of them have precise wordings that are agnostic to the unit type having the promotion
    - If you give Barrage to a melee unit, for example, the text is still correct
    - The only exceptions are plague-spreading promotions, which have different effects when given to melee/ranged units, and would be too wordy to precisely describe
    Renamed some promotions
    - "Ranged Combat Strength" is only used when the promotion column is actually exclusive to ranged attacks
    - "Combat Strength" is used otherwise
    - Added/removed "when attacking" and "when defending" where necessary
    - Medic -> Medic I
    - Penalty Attacking Cities (25) -> Minor City Attack Penalty (with help text)
    - Penalty Attacking Cities (33) -> City Attack Penalty (with help text)
    - Penalty Attacking Cities (75) -> Major City Attack Penalty (with help text)
    - Boarded (I)/(II) -> Boarded I/II
    Fixed Rhiannon's text (GPTI on resource does count)
    Fixed Great Musician concept/mission text (1 happiness per city instead of 2 in capital)
    Fixed Juggernaut quest reward description

Other Bugfixes
- Fixed a longstanding bug where AI deals were being renewed twice
- Fixed FoodKept UI bug
- Fixed bug where Assyria's Royal Library wasn't giving +0.50 Science/Citizen
- Fixed bug where Poland's Ducal Stable wasn't giving +15 XP to Mounted Melee Units
- Fixed bug where England's White Tower wasn't getting free Jewels
- Fixed spy cooldown not resetting when leaving the city
- Fixed Surveillance II not granting visibility to surrounding tiles
- Fixed Smithsonian giving free Museums globally instead of locally
- Fixed Rialto District giving 33% instead of 34% Gold from Population
- Fixed Pictish Warrior having cheaper cost
- Fixed Longhouse still providing Food per 2 Forest/Jungle
- Fixed a bug with the City-State road building quest
- Fixed some bugs with new war weariness calculation
- Fixed some bugs with Indian Great Prophets when used by the AI
- Fixed Public Works not increasing City Security
- Fixed a Community Patch LUA bug with the coup quest
- Fixed an issue with garrisons and flat damage reduction not being factored into unit-city combat
- Fixed God of War not awarding instant yields when a unit is killed via city bombardment
- Fixed City-States declaring war on vassalized major civs
- Fixed incorrect "cannot upgrade unit" message in the UI
- Fixed an issue with internally tracking number of turns at war or after a city capture
- Fixed Unhappiness from Occupation not being factored in correctly
- Fixed Great Altar and Hexxon Refineries Office adding a Production bonus to non-military units
- Fixed dummy technology issues
- Fixed a crash in Community Patch Only
- Fixed incorrect calculations for the Food bonus from Maritime City-States
- Fixed Mission granting 999.9 pressure instead of 1000 when built
- Fixed weird implementation of Team:SetHasTech() lua function
- Reduced number of Barbarians spawning during the CS horde quest (was unintentionally increased in a previous patch)
- Fixed influence decay not triggering an update of CS alliances, which could result in the ally having less influence than another player
- When WLTKD ends in a city and the newly demanded resource is already connected to the trade network, the next WLTKD is entered immediately and not one turn later
- Fixed some instant yield notifications appearing one turn too late (instant yields from adopting a policy, removing heresy, buying something with faith)
- Fixed duplicate notifications when an antiquity site is revealed
- Fixed duplicate buttons to repair a pillaged improvement
- And probably more bugs which aren't listed here


Online as of 6:48 AM CST. Not savegame compatible.

Version 4.5.1 has been released. Link above has been updated.

Road Logic Rework
- Make a more strict ordering of priorities when planning routes:
   1. Use features
   2. Use other planned routes
   3. Go through existing towns/villages
   4. Use existing roads or roads that are under construction
   5. Use lower tier existing roads
   6. Go through plots that can have villages
   7. Avoid going outside our borders

- Reuse of other planned routes now more aggressive.
- Reuse of existing roads now more aggressive.
- AI should now be much less willing to reroute their road network.
- Prefer towns over villages when planning routes.
- Made route planning with regards to unique improvements more sensible. Will no longer avoid going through plots where we can not build our unique improvement.
- Fixed Polynesia connection happiness trait not being accounted for when planning capital routes.
- When evaluating any road build, will now consider the total build time for the entire road. I.e., a road consisting of 10 plots will no longer be evaluated as if it takes 3 turns in total to build.
- Reduced value of building railroad when there is an existing road connection and vice versa.

Improvement Logic Rework
- Fixed incorrect adjacency calculations. Some calculations were done twice, some not done at all, some done the wrong way.
- Don't build resource creating improvements on existing resources.
- Removed flavor weights for improvements on resources. Flavors are now not used when planning improvements.
- Fixed strategic resource evaluation not working correctly.

- Fixed enemy unit panel not displaying properly for city attacks, melee units, embarked units
    Fixed miscellaneous bonus display being flipped on the enemy side
    Added back missing terrain defense and fortification bonuses (display issue only)
- Fixed automated exploration ending prematurely
- Fixed an issue with improved resources not being added due to a function mismatch
- Fixed an issue where the amount of Science required to research a tech wasn't being displayed
- Fixed Venetian puppets being unable to buy military units

- Removed redundant "run and hide" logic for workers.

Online as of 11:29 PM CST on February 27. Savegame compatible with 4.5 versions.
Last edited:
-Fixed Pictish warrior cost
Now i gotta replay the celts game where i had like 20 pictish warriors by turn 150 epic smh.
It was absurd
Hey all,

New beta version inbound. Few balance changes in this one, mostly bugfixing. I am also back from my long hiatus where I was dealing with rather intense personal issues - thank you for your patience, everyone. I intend to be active in hotfixing issues for the next while.

As for the VP Congress, expect an announcement on that sometime soon.

For now, a tremendous thanks to @axatin for finishing the espionage rework (and some bugfixing and other improvements besides that), to @KungCheops for a ton of work on improving Worker AI, and to @azum4roll for an impressive amount of cleanup work, including many of the changes in this release. Thanks also to @ilteroi, @Enginseer, @Vaderkos, and @L. Vern for a variety of other changes and fixes.

Without further ado...

Hey friend, first of all I just want to say I hope you and your loved ones are or will be doing okay. <3 If you need a random internet person to talk to, always willing to make time for people. :)

Appreciate all the work all of you have been doing, looks like a great new version!
Yes much more tense now, Pascal is really adventurous, also sweden erased germany looking scary.
Spoiler :


Much of the worker AI has kinda been redone from the ground up, so I'm not expecting everything to work perfectly from the start (even though I have spent a few months of pretty much full time work on it by now, time flies..)

Remember to post bugs or any strange behavior on GitHub and hopefully I'll be able to iron out any kinks that pop up. And please try to be patient and kind :)
Here's a slightly more thorough writeup of what is included in the worker AI rework (it was written about two weeks ago but should be pretty much up to date)

Spoiler Full changelog :

AI Logic Rework


### Worker planning

Change AI worker logic into more of a "top-down" framework.
The AI will start each turn by precomputing the value of each improvement on each plot. It will then try to assign the workers to assignments that are high value but not too far away.

Should have better performance than previous implementation and increases value of high priority plots that are not in the immediate neighborhood. This should also greatly increase coordination between workers.

Non-automated human workers and great people will get an assigned job together with the automated workers, which is shown as a recommendation when the unit is selected.

All workers will now reevaluate their current best job on each turn. Shouldn't cause any significant performance hit since the heavy computation is done on a "per-civ" basis rather than "per-worker".
May cause workers to act seemingly more erratically, but that is because there is a better improvement to build than the one that is currently being built.

Worker AI may now consider building improvements in plots that are visible to an enemy. Will still avoid plots that are considered dangerous.

Work boats and great generals are not included in the rework.

Value vs distance values may need to be tweaked.


### Improvement evaluation

Major cleanup of improvement evaluation logic.

Remove a lot of heuristics and random values being used to get the AI to build certain improvements.

Previously many evaluation values reached upwards of 100000+ and were then truncated to ~32000, meaning that the evaluations were essentially worthless.

AI will now evaluate each improvement according to its yield increases, resource connections, etc., based on some static and dynamic weights.

AI will now take into account the yield increases of adjacent tiles when calculating improvement yields.

AI ignores village/town road bonuses if the road in question is about to be removed.

AI should now correctly evaluate yield changes from created and removed resources/features.

AI will consider the following during the worker directive choosing phase (reevaluating other directives based on new information):
- Adjacency limits (don't plan to build e.g. two adjacent forts)
- Resource connections/creations (connecting a resource may decrease or increase the value of other instances of the same resource)
- Adjacency yield bonuses (e.g. creating a farm increases the value of adjacent farms)
- Defensive structures (e.g. building a fort will reduce the value of nearby forts/other defensive structures)
- Unimproved feature change/removal (vanilla Celts only, consider faith loss from building several improvements that affect forests near cities)

Repair directives are now evaluated in the same manner as regular build directives. Unhappiness from pillaged tiles currently not taken into account.

Rework evaluation of defensive structures. All defensive structures now treated the same way (previously only forts were considered).

AI takes yield surplus/deficits in any given city into account when evaluating the value of an improvement. Uses a balance between static yield values and city specific yield modifiers.

Generalize feature saving logic, any civ that has an unique improvement that requires a feature will now not build anything that removes those feature until the improvement technology is unlocked.

Civs with uniques that can only be built hill or coastal tiles now take that into consideration when planning other improvements and routes.

Defensive- and resource connection values may need to be tweaked.


### Route planning

AI will now plan it's routes in a slightly different order (instead of all at once):

1. Plan shortcut routes (shorter roads between cities, helps with movement and village bonuses).
2. Plan how to get connections from their capital to all of their cities using sea connections, existing shortcut routes, and features.
3. Plan strategic routes, which may be defensive or offensive.

Shortcut and strategic routes have been given hard distance limits (9 and 5 plots, respectively). Good performance gain in late game.

AI road reuse when planning road network has been made slightly more aggressive again.


### Route evaluation

Routes will now be evaluated based on gains from city connection bonuses, extra movement, villages, etc.

City connection routes are evaluated using yield gains from the potential connection, plus a bonus for potential unhappiness from being disconnected.

Shortcut routes are evaluated based on potential village/town yield increases combined with a computation for overall movement gain along the planned route.

Strategic routes are evaluated based on movement gains combined with strategic target plot value. Will not build strategic routes to plots with little or no strategic value.

All route evaluations are weighed against the maintenance costs of the routes.

Movement gain evaluation may need to be tweaked.


Various other tweaks and fixes:

Railroads may now be downgraded to roads.

Fix AI Iroquois and Songhai sometimes building routes far outside of safe territory.

Did another rework of route planning/evaluation after that was written but the end effect of it is not very visible. Should result in some slightly more optimized route planning, especially for Songhai/Iroquois when railroads are available.
Hey all,

New beta version inbound. Few balance changes in this one, mostly bugfixing. I am also back from my long hiatus where I was dealing with rather intense personal issues - thank you for your patience, everyone. I intend to be active in hotfixing issues for the next while.

Welcome back :) I hope everything worked out OK for you. Many thanks for your hard work!
Been playing for hundred of turns, everything feels really stable and polished. I like the new spy system, it is simple and non intrusive. New diplomats are fine, but I felt I was loosing a bit from not having a spy or a counter-spy (but loved the new UI and the way it gave info).
Thank you so much for your work :)
Liking the new patch thus far. I am trying out England and I do find the early spying that I can do in other civs very undertuned. I believe security values were deliberately made big in early era's in the old system, because high security still yielded high rewards, but with this system that doesn't seem to be necessary? It takes very long to rack up network points at least.

An early diplomat also does very little in my opinion, since tourism and relations are more important later. The influence steal of city states is then the best option, but also one of the more boring ones in my opinion. It would be nice to have more useful strategic variety in this aspect of England's UA.
It looks like the combat overview is not displayed when using city attack. Has anyone else encountered this bug too?
Minor bug, but when building a road, sometimes the tooltip suggests removing the road to connect a resource. Doesn't seem to affect the AI.

Screenshot 2024-02-22 100417.png
Are the diplomat network point perma? Like in case spy points?
Do diplomat and spy network point stack?

Two question, regarding above:
When i switch the diplomat into spy, will the city keep some network points or do i start from scratch?
When i remove diplomat and put it somwhere else for a while, will i get full network points when i swich back to same capitol as diplomat?
And related, let say diplomat is removed due to war, network points will be kept, when i reinstate diplomat after the war end?
Minor bug, but when building a road, sometimes the tooltip suggests removing the road to connect a resource. Doesn't seem to affect the AI.
I'm not sure if it's a bug or not but some of the suggestions do seem a bit odd. I have noticed that even when cities are connected it suggests that I build even more roads even tho they are not needed, once built it suggest that I remove them, and in some places it suggests road to nowhere. I guess they are there to facilitate movement but imo they are roads to nowhere that just cost money but doesn't add much. Perhaps it becomes a bit confused when I build "war roads", usually a large spiderweb of roads in more or less every tile to rapidly be able to move ranged horse units rapidly in and out. So I tend to sort of ignore it's suggestion. Can it easily be turned off?
The new AI will build "war roads" as I understand it, in addition to city connections.
...once built it suggest I remove them...
This bit sounds dodgy.
Not open for further replies.
Top Bottom