
AI Uses Population and More - SETTLEMENT TRADING AND DLL FILE RELEASE
Hey all! I hope everyone has been doing well! We have been very busy the last 4 months!
A couple of months ago, I mentioned that we were experimenting with an external DLL for almost a year now, and we had now reached the point where an entirely new Lua function could be registered in ROME II. Not the first to do it, but first for us! At the time, it was a sensitive long-term project with no release date.
Well, the first function works.
Alongside version 1.0 of that DLL, our next major "AI Uses Population and More" update adds something we have been requested about, used by both the player and affects the AI too (our current logic system).
**TRADE REGIONS - BUY AND SELL SETTLEMENTS**
This is not dilemma spam or a simple transfer button. It is a full custom campaign panel built around the campaign map.
A new bronze-scales button opens Trade Regions. While the panel is open, click any visible settlement and it will show its owner, your relationship, population, travel distance, and an early indication of how expensive the owner is likely to be.
**Buying:** Send an emissary to the owner. The journey takes 2-7 turns based on real map distance, after which the faction returns an exact price. That price considers population, buildings, provincial importance, diplomatic relations, the seller's need for money, and how wealthy you appear to them. Accept the offer and the exact amount is paid, the settlement changes hands, and its existing population carries over.
**Selling:** Select one of your settlements and send an emissary to a potential buyer, or flag the settlement for sale and let nearby factions approach you. Up to two AI factions can compete with genuine bids for the same city. Accept one and the other emissary goes home.
You have two emissaries available at a time. Each must rest for 12 turns after completing a mission, and live missions and offers can be recalled or dismissed from the panel.
-- After buying OR selling, you CANNOT buy from the same faction again for at least 30 turns --
-- AFTER buying or selling to a faction, war is locked for 12 turns minimum! To seal the transfer of settlements peacefully --
---
**THE AI**
- AI factions can buy and sell settlements among themselves under the same core rules. These deals use actual calculated prices and are announced through "Settlements Change Hands" messages.
- The AI cannot simply buy random land across the world: the buyer must already hold territory nearby. Factions only list land when selling makes sense, and their personalities matter. Expansionist powers such as Rome are extremely reluctant to sell and demand a major premium, while merchant powers such as Carthage, Massalia, Athens, and the Ptolemies are generally more willing to negotiate.
- AI buyers also evaluate settlements that the player flags for sale. Their bids account for the city's value, distance, relations, rivalry, and their own finances.
---
**RULES AND LIMITS**
- Capitals are never sold, including yours.
- A faction can never sell its last settlement.
- War blocks all settlement trading.
- Every faction tracks up to two dynamic rivals: nearby powers of similar size, plus major historical rivalries such as Rome, Carthage, and Syracuse.
- Rivals can still trade land while at peace, but buying from one costs roughly 2.5x more and selling to one invites a serious lowball offer. The panel warns you first.
- Rich buyers are charged more because the seller knows what they can afford.
- Refused deals temporarily cool that settlement for everyone.
- Single-player only for the initial release.
Some balance values, especially how often AI factions list land, will continue to be tuned after release.
---
**OUR FIRST EXTERNAL DLL - VERSION 1.0** (DLL is available on our discord with more information)
ROME II's Lua API contains some frustrating holes. For example, Lua can force two factions to create a trade agreement, but the game provides no matching function to remove one later.
That meant our "Smart Economy" file could create and monitor dynamic trade, yet hostile factions could occasionally remain at war while still benefiting from an old forced agreement. YOU NEED THE DLL TO FIX THIS!
Our version 1.0 DLL adds the missing native Lua function:
"force_break_trade_agreement(faction_a, faction_b)"
Our Smart Economy file still makes every decision. The DLL only performs the missing action when requested: it cancels the real trade treaty without ending the war or altering unrelated diplomacy. The agreement disappears from diplomacy and its land or sea route is removed when the campaign map refreshes.
This is not a replacement for the campaign AI, nor does it suddenly unlock every internal engine action. What it does prove is that we now have a working bridge between Lua and carefully selected campaign functionality that CA never exposed. Version 1.0 solves trade breakage; future versions may let us close other long-standing gaps in diplomacy, economics, and campaign decision-making as we research them.
---
**ALSO INCLUDED THIS ROUND**
- Fixed AI imperium 5-6 economy bundles that were silently doing nothing.
- Coalition and cascade-peace fixes.
- Hellenistic coalition text fixes.
- A turn-end script error fix.
- Name-prefix and advisor-button fixes.
- Duplicate same-turn reply popups fixed.
- Broke AI factions can enact Emergency Austerity to reduce costs and survive attrition.
Everything shown remains subject to more testing and PLENTY of balance changes. A new campaign will be preferred.
As always, feedback is welcome! Especially on prices, emissary timing, AI selling frequency, and anything regarding this update!
Special thanks: Goobad for his breakthroughs on the UI panels, allowing us to reconstruct our own and as always: the DEI team!
Please visit our discord for more information. https://discord.gg/d7rVMQpM6k
- Destroyer + Michael + Juiss + Vader -