Diplomacy Hacks with Lua!

Viregel

, The Rt. Hon.
Joined
Jun 10, 2013
Messages
1,944
Location
Kingdom of the Britons
For the past few days, I've been considering a Casus Belli system, and I've seen most of the code I need to make it work. Almost all anyway - I lack any knowledge of how to alter Diplomacy in Lua (if it's possible at all). The plan is this:

- Detects if a Casus Belli condition is true (Troops near borders, for example)
- Lessens warmonger penalty if you declare war on the civ(s) you have a Casus Belli against (this part isn't totally needed, but nice to have)
- Negates diplo penalty when capturing a city from the civ; if that's not possible, then perhaps a bonus based on the penalty?

It's a bit vague, but I hope you follow. Thanks for any help - I haven't started coding it yet, so please say if there's anything I should keep in mind!
 
Is this based on my concept? If yes, I am proud :D

I hope it is possible to trigger 'calculate warmonger penalty' via lua, casus belli system doesn't require AI 'understanding' it so this part of DLL is avoided.
 
My Casus Belli system

Spoiler :

If your civilisation has Casus Belli, warmongering penalties are cut:

Forced Conversion
Foreign civilisation was converting your cities with their missionaries or prophets.
-33% warmongering penalty against them for 16 turns since last conversion.

Shameless Espionage
Foreign civilisation was caught when spying your nation.
-33% warmongering penalty against them for 16 turns since an incident.

Diplomatic Insult
FC has denounced you.
-33% WPAT for 16 turns since denouncement.

Honor Demands That
You have at least three policies in Honor Policy Tree.
-33% WPAT permanently.

Aggressive Settling
FC has settled 5 tiles from one of your cities.
-50% WPAT till they have a city in the range of 5 close to your city.

Colonial Disputes
FC has colonies 10 tiles from one of your colony.
-50% WPAT till they have colony in the range of 10 close to your colony.

Opposing Ideologies
FC has a different Ideology than you.
-66% WPAT as long as they have different Ideology.

Liberation War
FC has at least one of your former cities.
-66% WPAT till they have at least one of them.

Ally War
FC attacks/is attacked by the civilisation you have DoF with.
-66% WPAT till the end of war.

Crusade
FC is regarded as bloodthirsty warmonger [Embargo or at least 3 capitals conquered]
-66% WPAT till they have embargo/these capitals.

- When you gain Casus Belli the notification shows up with info: who, what, how long.
- You can check your Casus Belli in diplomacy screen.
- When you are about to declare a war or capture a city the game checks if you have a Casus Belli and cuts warmongering penalty accordingly.
- Casus Belli bonuses DON’T STACK, you can never have more than -66% bonus. When attacking city the highest possible Casus Belli bonus is chosen.




So... Maybe we should set a prize for a man who can do some wonders with lua? :D

Personally I count on Last Sword as his lua skills are beyond impossibility - I am awaiting on a day when he turns Civilization 5 in first person shooter with use of just xml and lua modding :D

As I said - casus belli system does not require AI understanding it so the most difficult part of Civ5 modding* is avoided.
*-right?
Casus Belli System doesn't require also any diplomatic interaction. Simply

if condition is met
penalty is decreased by X when capturing a city
<some cute interface when you can see available casus belli for all civs or something like reputation meter when you can check each civ>

AI doesn't have to understand casus belli as in original Civ5 it already goes to war for similar reasons - you settled to close, you converted my city, you have taken my cities, you did nothing but I am Alexander and I am idiot etc.
 
Honestly, I think you went too far - your version just makes the whole warmongering penalty system pointless. We need a fine balance.

My opinion is that causus belli should be a sort of protection against a "tyrannical" civ, and make it slightly harder for civs to steamroll over other civs. Your version seems to do the opposite, as in make it even easier for someone looking for a domination victory to find excuses to go to war with everyone without people caring much about it.


My version:

A Casus Belli ignores warmongering penalty completely for the case in which it was applied. They vary between absolute, moderate and minor, absolute allowing you to wipe them out of the game, moderate only allowing you to go to war with them, and minor not allowing you to take any cities.

Some Casus Belli may "wear out", and should you continue the war, the warmongering penalty will apply.

Cases where it counts:

Someone attacked you without casus belli.
- Absolute casus belli for 30 turns

Someone attacked you without casus belli, and with open borders agreed upon.
- Absolute casus belli for 50 turns

Someone settled right next to your city (like really close).
- Moderate casus belli until that city is no longer under his/her control

Someone is triple your score.
- Moderate casus belli for as long as this remains true

Someone has employed a nuke.
- Absolute casus belli until non-nuclear ploriferation is enacted

Someone stole a technology from you.
- Moderate casus belli for 20 turns

Someone converted your holy city with a great prophet.
- Minor casus belli for 10 turns

Someone converted your tiles with a great general.
- Minor casus belli for 30 turns


Not sure if more are needed, but I feel those are the more reasonable ones.
 
but that's such little time left for razing all their cities and salting their lands :c
Less razing, more salting! ;) More seriously, a casus belli system like that means that with a moderate casus belli, going around and pillaging becomes a more interesting strategy (since taking cities is still penalising).

It would be the equivalent of a border skirmish, not every war has to redraw the map on a large scale, that didn't happen in history either, many wars left country with much of their original borders.

I like Wodhann's list, though I'd add Great General citadels changing your borders to the list as a moderate casus belli, it's pretty much a landgrab...
 
I like Wodhann's list, though I'd add Great General citadels changing your borders to the list as a moderate casus belli, it's pretty much a landgrab...
Added to my list.

About moderate casus belli, it actually includes city capture. Maybe there should be minor casus belli - one that only allows for only the military skirmish and no siege. I'll add that to the list too, actually.
 
not in Lua, that would require a custom DLL.
 
But hey, we're planning to hack the DLL to implement lots of changes anyway, right? I wouldn't think you could handle a whole set of colonization rules with just lua...
 
But hey, we're planning to hack the DLL to implement lots of changes anyway, right? I wouldn't think you could handle a whole set of colonization rules with just lua...

What wild ideas do you have for colonisation that it might require a DLL?
 
My Casus Belli system

AI doesn't have to understand casus belli as in original Civ5 it already goes to war for similar reasons - you settled to close, you converted my city, you have taken my cities, you did nothing but I am Alexander and I am idiot etc.

On whole I liked your system. Makes much more sense than a lot of the AI craziness you'll sometimes see.

CIV2 at least had a sort of a "justifiable war" mechanic, but it was pretty limited-condition. They had to do certain kinds of espionage missions or refuse to leave your territory, as I recall. But as I remember that mechanic was only there as a balance against the "Senate" refusing to allow you to declare war if you were a Republic or Democracy.

I just wish for a way a player (human or AI) could declare aims, as it were, and by declaring those aims would be able to go to war with less penalties. Or if not with less penalties, then at least have the AI understand that violating my aims could result in a war with me, and if I as a human player violate thier aims, I risk a war with them.

Something like:

  1. This continent is mine, don't settle here
  2. This city-state is my ally, don't bully it
  3. Steal a tech from me again and it will be war. Not may be war, not could be war, will be war.
  4. Attack my friend so-and-so, and you risk war with me. (this one really bugs me. so often, when I'm the most powerful player, and I am friendly with CivX, the weakest Civ in the game will attack CivX for no good reason that I can see)

It probably cannot be done, but I can wish.
 
Ninakoru wrote to me he is not going to mod this game anymore.

To sum up I think if both expansions would like to have improved AI/Diplomacy there is simply no other option than Epic Cooperative AI Project when many epic modders discuss about AI changes and then put all of it the in the single DLL - improved diplomacy, improved warfare AI, AI understanding new rules etc. There is simply no other way.

Oh, obviously it would be difficult but this is why not a single modder managed to improve general game AI. I believe if many people would sit and cooperate we could achieve it.
 
What wild ideas do you have for colonisation that it might require a DLL?
I'm just assuming that a new expansion pack will probably include some features that will require more than just lua... :dunno:
 
I'm just assuming that a new expansion pack will probably include some features that will require more than just lua... :dunno:

I should probably put in something really minor that didn't need to be there at all that requires a custom DLL to annoy everyone. :lol:

Anyway, people who know how to into DLL are invited to the party. By that, I mean get some diplomacy stuff to work, then implement whatever system. Specifics we can worry about later. Just one last point; surely you could add a liberation bonus on a captured city provided that a condition is true (in this case, Casus Belli)? I wouldn't know how to do it myself, but would anyone be able to confirm/deny this?
 
Ninakoru wrote to me he is not going to mod this game anymore.
Did you ask him to make his source code available? Would be a waste if people who want to improve on his efforts have to start from scratch.

By the way, I'm 100% supportive of a massive AI project. What are people waiting for?
 
To really mod the AI (and its warmonger code) you would need to get into the dll.

But you can modifiy diplo relationships with the three existing GameEvents (GetScenarioDiploModifier1, 2 and 3). You could sort of "hack it" to cancel out existing warmonger hate with a compensating plus bonus. But the UI mouse-over would show the original warmonger hate and your positive compensation as two different diplo modifiers. Or if you really want to do some UI Lua hackery you could probably even change that.

Forced war and peace is also possible with Lua.
 
Top Bottom