AI Diplomacy Empire/Player

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

We might have to change the approach. Too many shared codes for index values, maybe even some default bugs, plus too many code mirrors with similar delay values (most 10/0xA sometimes 5 or other).

The index values are not your above switch cases but special AI file locations:

[AIAgent+34h] = addr.-> AgtDp diplomatics

[AgtDp+1E0h +2*index] = last turn number to compare for this diplomatic index case

---

The min interval delay for AI demands is a sought-after 'fix'. :up: I guess thunderchero will set this to 25-30 in his mods? (0x188CEE default 0x12 / 18 dec)

Plus we can change the AI demand calculation (use the income of the target empire as base) for a better player experience.

Albeit, for strategic/balance reasons the default might be better, since this infuences AI bidding-wars for allies?
NAME: AI Demand Calculation based on the Income of the Target Empire
DESC: Vanilla default calculation is based on the income of the own i.e. demanding empire.
AUTHOR: Spocks-cuddly-tribble
URL: viewtopic.php?p=24148#p24148

>> 0x00011787 66 8b 56 08 8d 04 d5 00 00 00 00
<< 0x00011787 8a 94 24 8c 04 00 00 6b c2 08 90

#00412387     8A9424 8C040000    MOV DL,BYTE PTR SS:[ESP+48C]
#0041238E     6BC2 08            IMUL EAX,EDX,8
#00412391     90                 NOP

Plus absurd/excessive AI offers fix: 0x12568 (8B 94 24 BC 04) -> 90 90 BA 40 00 (most mods have this)
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2404
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: AI Diplomacy Empire/Player

Post by Tethys »

Just to clarify.

Receiving a demand from any empire will calculate the demand amount based on my own empire's income, correct?
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7965
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: AI Diplomacy Empire/Player

Post by thunderchero »

Tethys wrote: Wed Sep 27, 2023 2:30 pm Just to clarify.

Receiving a demand from any empire will calculate the demand amount based on my own empire's income, correct?
your mod has "absurd/excessive AI offers fix: 0x12568 (8B 94 24 BC 04) -> 90 90 BA 28 00 (most mods have this)"
so it should be limited to 40,000?
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

Tethys wrote: Wed Sep 27, 2023 2:30 pmJust to clarify. Receiving a demand from any empire will calculate the demand amount based on my own empire's income, correct?
Yes, so it's more endurable in vanilla low tech games if you play a poor empire. Might even improve AI vs AI balance - still to be tested.

You noticing the ferengi being 'demanding bastards' might have something to do with military power.
They have more war ships due to better economy in vanilla low tech games.

thunderchero wrote: Wed Sep 27, 2023 2:41 pmyour mod has "absurd/excessive AI offers fix: 0x12568 (8B 94 24 BC 04) -> 90 90 BA 28 00 (most mods have this)"
so it should be limited to 40,000?
Two different things. Offer vs Demand :wink: (demand is always size/multiplier 40 by default)
The size value [default 40-160 for AI, IIRC] is a multiplier for the base calculation:
Spocks-cuddly-tribble wrote: Sun Nov 21, 2010 1:41 pmThe default calculation for AI gifts, offers & demands is always the same:

( [size value * 0.25] ^2 ) * [Income * 0.05]

But due to different code locations, it can be modded independently of each other.


-> Result of the calculation is always a maximum value! - (also for gifts to minors)

Unlike players the AI isn't forced to minimum amounts (i.e. can skip/lower if insufficient credits, sympathy... random?)
(size 40) calculates 5 times current income, (size 80) = 20 times, ASO...

With above patch AI demands will be 5 times your current income. :idea: (by default Ferengi AI asks for more due the their own high income)

---
Tethys wrote: Tue Sep 26, 2023 6:11 pmminor races can only declare war on one empire per turn. Nausicaan affiliates wanted to fight both Klingons and Romulans but could not declare war on both, so it was Klingons first, Romulans next.
Even the AI empire code has cases where certain actions take precedence over others and not all are executed. But it's still not well analysed.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2404
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: AI Diplomacy Empire/Player

Post by Tethys »

About the minor races.. I think it might be possibly to save on processing. I don't remember seeing AI majors declaring more than one war on a minor at a time either. But not sure if thats because of the games mechanics/turn delay features (slim chance AI meets 2 minors on the same turn with the same attitude, personality type, etc) so the mechanics governing each are probably slightly different.

On Topic: I am proceeding with my last tests of the final 3 values associated with the table covered on the previous page of this topic

Test 10
V: Ninth value 03, others 0A
R: Unobservable

Test 11
V: Eleventh value 03, others 0A
R: Unobservable
V: FD, 0A
R: Unobservable

Test 12
V: Final value 03, others 0A
R: Unobservable
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

I think this is to stretch out the different diplomatic actions over more time instead of escalating too many things in a short peroid.

Even in the easy case of demands, the interval delay appears to be shared for all empires.
So once an AI empire sent a demand to anyone all others get spared for the same interval. :???:

This means a patch with custom values for AI empires cannot work due to missing data in AI files. :dwn:

---

So reconsider the priorities given a limited time frame (life, family, friends and business matter more).

Better approach could be a borg special feature disabling any diplomacy except war declarations.

- skip AI diplomacy code for borg and write code to always declare war after first contact (might be some work/tricky)
- remove all other dip options from the borg UI, even option to accept proposals

Another special feature for borg could be the invasion code:

- change pop to borg race ID after invasion/assimilation (except minor races since breaks the special buildings?)
- if other empires successful invade a borg pop system wipe all pop instead of a system takeover


Or just stop here and look if you can edit patches like this to work with your new star/anomaly IDs: viewtopic.php?p=57639#p57639

I think new space station types are not that interesting.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2404
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: AI Diplomacy Empire/Player

Post by Tethys »

Spocks-cuddly-tribble wrote: Thu Sep 28, 2023 11:37 am I think this is to stretch out the different diplomatic actions over more time instead of escalating too many things in a short peroid.

Even in the easy case of demands, the interval delay appears to be shared for all empires.
So once an AI empire sent a demand to anyone all others get spared for the same interval. :???:

This means a patch with custom values for AI empires cannot work due to missing data in AI files. :dwn:

---

So reconsider the priorities given a limited time frame (life, family, friends and business matter more).

Better approach could be a borg special feature disabling any diplomacy except war declarations.

- skip AI diplomacy code for borg and write code to always declare war after first contact (might be some work/tricky)
- remove all other dip options from the borg UI, even option to accept proposals

Another special feature for borg could be the invasion code:

- change pop to borg race ID after invasion/assimilation (except minor races since breaks the special buildings?)
- if other empires successful invade a borg pop system wipe all pop instead of a system takeover


Or just stop here and look if you can edit patches like this to work with your new star/anomaly IDs: viewtopic.php?p=57639#p57639

I think new space station types are not that interesting.
I concur with the former, but disagree with the latter. New ship types can be challenging due to combat mnu and related intricacies. It can be pretty interesting. About a week ago I noticed that the nebular effects (+bonus to Defense) on ship types DOES NOT carry over to stations. This means if a station is built inside the nebula, not only does it lose its shields, it also loses its ability to target other ships, while enemy ships do not receive that same targeting "penalty" or rather; the station never received the bonus, so the enemy ships can still target it normally (weapons accuracy unaffected against stations built inside nebula).
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

Yes, but adding new ship types and groups in tactical combat isn't going to fly that easy. Expect months of work.

For the nebula I guess you refer to one of your patches and you missed the special/intricate data structures and code cases for stations and monster in tactical combat.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2404
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: AI Diplomacy Empire/Player

Post by Tethys »

Spocks-cuddly-tribble wrote: Thu Sep 28, 2023 12:10 pm Yes, but adding new ship types and groups in tactical combat isn't going to fly that easy. Expect months of work.

For the nebula I guess you refer to one of your patches and you missed the special/intricate data structures and code cases for stations and monster in tactical combat.
You're likely right on both counts. But I would have to test vanilla to be sure on the latter. Something to revisit soon, probably easier to move that stuff into reloc table. Adding some new planet types might be a more realistic and achievable goal for me, and its something BotF needed. I am afraid adding effects to the new stellars might be too much work wrt to stack. Something else for me to revisit.

I think a simple, elegant solution for Borg is best. While I would like to keep Affiliation open for them (Species 8472) I just don't think it's possible without a lot of extra work. One can place a race check cmp 02 and to skip all diplomacy, as you said, and just using the war check for 02 Ferengi modified for immediate war declaration. Further thoughts: If the primary value can be found (2.0 perhaps?), some math may be able to alleviate the Borg appetite for demands and diplomacy. Something like fmul 1.0e-1 = 2.0 -> 0.2 as for the base variable for math for the 02 race id. So it won't break diplomacy completely for Borg but will make them 10x 5x less diplomatic ;) fmul their war check by 1.0e+2 and they should declare war sooner/more often.

I go now to put into perspective the necessary changes and whether or not I should prepare my mental for potential chaos...

Update: Its chaos. I'd be better spending time working in new planets or fixing the nebular bug for stations and monsters than trying to figure out where to effectively place a check for 02 race ID inside all these subs. It looks like there's a bunch of locations to mess with too. Perhaps a later time, shifting gears.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
Post Reply

Return to “General Modding Information/Questions”