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
Tethys
Past Administrator
Past Administrator
Posts: 2404
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

AI Diplomacy Empire/Player

Post by Tethys »

I did not see this covered anywhere after a lengthy search of several subforums.

What I am attempting to find is perhaps a set of base values for each major race that determines their frequency of sending certain/any treaties/demands/statements to the player and other AI (if empire is seen as: peaceful, warlike, covert). In Trek, we have only seen the Borg form an alliance a total of once, and tbh it was kinda shady at best. In GALM I would like to reflect this. It seems to me the developers should have included something like this in my opinion, so I am rummaging through alot of the AI Diplo subroutines trying to find clues. So far all I have managed to locate are a few cases where the game will check if the empire is major or minor, and adjust itself for diplomacy depending which (such as AI_AIEmpDip_4119B0 AI_AIEmpDip_411B40). Nothing yet as far as base values for the Major Empires. I will keep looking, though.. I expect 4 byte floats, 0-100% (0.0-1.0) but who knows for sure?

I am now looking into AI_X_422B80 which seems to possibly deal with simple diplomatic statements regarding Aliens, via attitude or changes thereof.

If anyone has any relevant info, please come forth and provide :)
Last edited by Tethys on Sun Sep 24, 2023 7:42 pm, edited 2 times in total.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: AI Diplomacy Empire/Player

Post by Flocke »

Tethys wrote: Sun Sep 24, 2023 6:23 pm If anyone has any relevant info, please come forth and provide :)
No info on this, other than that this should be an easy task to implement via code extension. So when you are getting tired on the asm code, wait for code extensions. And if you can't wait, I might hand you an early base to start with. :razz:
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 »

AI_X_422B80 looks to do some comparison to 02 and further compares the 02 and 01 which could be Ferengi and Federation. The cmp 1 seems to call a subroutine which contains a jump switch 9 cases, which could be attitudes toward other powers. This could run in line with Federation being more diplomatic, and Ferengi with trading opportunities. Though, it could also be the number of treaty types (i don't know the number offhand) but I did see attitude types labeled elsewhere with a cmp 08 so logic kicked in here..

It has brought me full circle back to 403FF4 AI_AIAgent_MakeSimpleDipStatement which has 55 xref's to investigate :cry:

AI_AIDipEvl_432580

AI_AIEmpDip_4121E0

Code: Select all

004122CE 89 E0                   mov     eax, esp
004122D0 BB 01 00 00 00          mov     ebx, 1
004122D5 BF 08 00 00 00          mov     edi, 8
004122DA E8 A1 D2 04 00          call    Game_Diplo_Treaty_45F580 ; Call Procedure
004122DF 89 5C 24 28             mov     [esp+80h+var_58], ebx
004122E3 89 7C 24 30             mov     [esp+80h+var_50], edi
004122E7 30 F6                   xor     dh, dh          ; Logical Exclusive OR
004122E9 66 8B 46 08             mov     ax, [esi+8]
004122ED 8A 54 24 7C             mov     dl, [esp+80h+var_4]      ?
004122F1 66 89 44 24 34          mov     [esp+80h+var_4C], ax      ?
004122F6 66 89 54 24 36          mov     [esp+80h+var_4A], dx      ?
004122FB 89 5C 24 44             mov     [esp+80h+var_3C], ebx      ?
004122FF 89 4C 24 54             mov     [esp+80h+var_2C], ecx      ?
00412303 89 E2                   mov     edx, esp
00412305 89 F0                   mov     eax, esi
00412307 89 6C 24 5C             mov     [esp+80h+var_24], ebp
0041230B E8 F0 42 01 00          call    AI_AIPropose_426600 ; Call Procedure
00412310 E9 03 FF FF FF          jmp     loc_412218      ; Jump
Flocke wrote: Sun Sep 24, 2023 7:40 pm
Tethys wrote: Sun Sep 24, 2023 6:23 pm If anyone has any relevant info, please come forth and provide :)
No info on this, other than that this should be an easy task to implement via code extension. So when you are getting tired on the asm code, wait for code extensions. And if you can't wait, I might hand you an early base to start with. :razz:
It is a type of therapy for me, to keep my mind away from life's issues. I am much faster at disassembly now, especially since SCT has such magnificent labeling in place. Only few things need to be further identified for easy xref. I know he must have come across it because he has extensively fixed issues dealing with AI Diplomacy for ECM as I recall in a topic or 3 during searching.
Last edited by Tethys on Sun Sep 24, 2023 9:32 pm, edited 1 time in total.
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 »

AI code is very random, you can test this using the 'BotF Random Engine Fix': viewtopic.php?p=56905#p56905

Knowing about this you can abuse the 'random engine fix' to cheat via 'save scumming'.
Reloading and ending the same turn, you can skip many AI requests and/or get better treaty proposals/acceptance.

A save game bug with the TurnTimerQueue also lowers probability for random negative diplomacy shifts: viewtopic.php?p=60016#p60016

Minimum delay values for AI requests have yet to be found. Also the checks for too frequent player inquiries (triggers attitude loss and AI messages).


You are on the right track (sub_4144A0 ->...) Look for x-refs to 5A2918 gameInfo_40_Turn_Number

An exampel for min delay of 5 turns for an AI feature:
00430DFB           mov   ax, word ptr ds:gameInfo_40_Turn_Number
00430E01           sub   ax, [ecx+3Ch]
00430E05           cmp   ax, 5
00430E09           jbe   exit_set_1
00430E0F           cmp   dword ptr [ecx+38h], 0FFh
00430E16           jz    short loc_430E2F
00430E18           mov   bx, word ptr ds:gameInfo_40_Turn_Number
00430E1F           mov   ax, [ecx+40h]
00430E23           sub   eax, ebx
00430E25           cmp   ax, 5
After this you find 4 byte foat data fields for this feature for cases/empires (for random or other checks)

Using this pattern you might easier find the special features your are looking for. :wink:


I guess Flocke's upcoming advanced coding project involes easy handing of all known/analysed files :?:
So using the saved game file analysis you might be able to skip the AI files and AI code?

If so - and combined with easier C++ coding - you only need to check remaining conflict/inconcistency messups.
But you have to control all involved diplomacy, ordInfo and many other files.

Tethys wrote: Sun Sep 24, 2023 7:59 pmhe has extensively fixed issues dealing with AI Diplomacy for ECM as I recall in a topic or 3 during searching.
It's not that great, but the diplomacy doesn't feel that broken anymore.

- fixed many broken AI score / military / economic power checks -> so AI can read the right data
- AI colony development more sustainable (map exploration can be slower, but later the AI empires do better)
- weaker AI empires still keep colonizing towards other empire borders
-> fixes vanilla issue of AI not using colony ships, but also leads to more AI vs AI wars
-> easier for player to get treaties with the AI (with good military values and subdued colonisation behavior)
Last edited by Spocks-cuddly-tribble on Tue Sep 26, 2023 1:32 pm, edited 3 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: AI Diplomacy Empire/Player

Post by Flocke »

ASM analysis can be fun, and without question each new finding also helps to implement proper extensions.
Furthermore we are lacking experience to tell in what case which one is to be preferred.

To become a general coding base, there is still alot work needed on the framework part.
For now it is just another option to keep in mind, and to try when there is special need or where asm coding becomes messy.
Spocks-cuddly-tribble wrote: Sun Sep 24, 2023 8:46 pm I guess Flocke's upcoming advanced coding project involes easy handing of all known/analysed files :?:
So using the saved game file analysis you might be able to skip the AI files and AI code?

If so - and combined with easier C++ coding - you only need to check remaining conflict/inconcistency messups.
But you have to control all involved diplomacy, ordInfo and many other files.
That's the plan, and now you know what I analysed the ordInfo and result.lst files for. :lol:
The savegame analysis is very evolved by now. With current UE you can wipe whole empires if you like to. Dimplomacy is easy to handle there.

Nonetheless, having performed a small search in this awesome IDA library, I found "call_AI_Offer_calculation" (sub_413420), which looks promising. ;)
Furthermore I found:
friend_ally_offer.jpg
friend_ally_offer.jpg (46.93 KiB) Viewed 1728 times
I however guess both is used for processing received proposals.
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: Sun Sep 24, 2023 8:46 pm Reloading and ending the same turn, you can skip many AI requests and/or get better treaty proposals/acceptance.
I have noticed intel attacks also differ. One test save had an intel attack where I stole some credits. The credits were different most of the time, and sometime I destroyed credits instead on a different reload of the same save. Food for thought. Ty for the reply I will read in depth now.
Flocke wrote: Sun Sep 24, 2023 9:12 pm
Nonetheless, having performed a small search in this awesome IDA library, I found "call_AI_Offer_calculation" (sub_413420), which looks promising. ;)
Furthermore I found:
friend_ally_offer.jpg

I however guess both is used for processing received proposals.
I have investigated this subroutine already and there isn't much from what I recall (it was about 20-30 minutes behind current investigation locations) Quick glancing at my extensions to SCT's labels this handles some part of whether or not the AI will invade a given system.

Code: Select all

004135E2 E8 39 F2 01 00          call    AI_AIDipEvl_Invade_432820 ; Call Procedure
>
00432A17 E8 74 FD FF FF          call    AI_AIDipEvl_TaskInvadeSys_432790 ; Call Procedure
>
004327ED E8 9E C5 FE FF          call    AI_AIInvade_41ED90 ; Call Procedure
The screenshot you provided is far more interesting to me. These are basic labeled and I will investigate them on my end now. TY!
Edit: Could it be the developers had planned joint assaults on systems? Unless the previous labeling is completely wrong... hmm

I am still however using the SCT database from 2012, the one which works with IDA 5. The other databases require a higher version than I have installed.
Last edited by Tethys on Sun Sep 24, 2023 9:47 pm, edited 1 time in total.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
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 »

I have a morbid idea, in the meantime... I could change GALM's credit system (currently deuterium) into a kind of enlisted personnel/starship population system. So when the Borg go demanding credits, now instead will demand you send some people for assimilation :P

I am running a test. I overwrite the area with all the values with 00's

576ED4 | 0x0174cd4
length: A0

Code: Select all

00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 E8 3F 33 33 33 33 33 33 D3 3F 9A 99 99 99 99 99 B9 3F 9A 99 99 99 99 99 A9 3F FC A9 F1 D2 4D 62 60 3F 00 00 00 00 00 00 C0 3F 9A 99 99 99 99 99 89 3F 33 33 33 33 33 33 D3 3F 33 33 33 33 33 33 D3 3F 33 33 33 33 33 33 D3 3F 33 33 33 33 33 33 D3 3F 00 00 00 00 00 00 E0 3F 00 00 00 00 00 00 34 40 00 00 00 00 00 00 10 40 33 33 33 33 33 33 B3 3F 9A 99 99 99 99 99 89 3F 00 00 00 00 00 40 7F 40 FC A9 F1 D2 4D 62 60 3F 48 E1 7A 14 AE 47 F5 3F
can be copied and pasted in hxd to find the location in question :)

all 00's and going to test the effect on the diplomatic events. See you soon.

Test success. This area deals with the gift value relating to credits. It's either 19 or 20 values (2 might share an entry?) Territory gifting was unaffected. Borg sent an immediate demand and it was a blank demand. I did not proceed any further than testing if I could gift credits and territory. Territory yes, credits no. Quick testing more values real soon, as I go down the list :)

---

577050 | 0x0174e50
length: 40

Code: Select all

00 00 00 00 00 00 F4 3F 00 00 00 00 00 00 F4 3F 00 00 00 00 00 00 F4 3F 00 00 00 00 00 00 F4 3F 66 66 66 66 66 66 E6 3F 66 66 66 66 66 66 E6 3F 66 66 66 66 66 66 E6 3F 33 33 33 33 33 33 EB 3F
Test success. This area, more specifically the last four 8 byte floats, controls the minor races sending treaty proposals. Lower values seem to increase the proposal frequency. Higher values cause them to never send any proposal, regardless of attitude. Perhaps even majors (Borg signed a treaty with another power even though Enraged condition exists). Minors were sending me proposals for membership turn after first contact. Raiding and destroying their ships, they declared war but next turn asked for friendships. Sympathy related according to preexisting labeling.

These first four values are still not really known what they do, but it possibly is related to the amount of sympathy or attitude per turn, or for various conditions multiplied by ???. I am not particularly interested in it, but someone might be... all 4 values = 1.25

Code: Select all

00 00 00 00 00 00 F4 3F 00 00 00 00 00 00 F4 3F 00 00 00 00 00 00 F4 3F 00 00 00 00 00 00 F4 3F
---

:!:
577D04 | 0x0175b04
length: 98

Code: Select all

00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 40 00 00 00 00 00 00 F0 BF 00 00 00 00 00 00 00 40 00 00 00 00 00 00 F0 BF 00 00 00 00 00 00 00 40 00 00 00 00 00 00 08 40 00 00 00 00 00 00 E8 3F 33 33 33 33 33 33 F3 3F 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 40 33 33 33 33 33 33 F3 3F 1F 85 EB 51 B8 1E E5 3F 00 00 00 00 00 00 00 40 00 00 00 00 00 00 D0 3F 00 00 00 00 00 00 F0 BF 00 00 00 00 00 00 10 40 00 00 00 00 00 00 E0 3F
:!: Notable changes in this area :!:
Zeroing out this section had a big effect on what types of diplomacy was happening in the game. I noticed with vanilla values, the Roms and Borg declared war on me via warpact. With zeros this did not happen, but a few turns later the Roms offered me the war pact against the Borg. And when I did not accept, they declared war anyway a few turns later. Other than that, I've been getting nothing but demands here and there. Oh, well I guess there was a notable increase in war against minor races. I feel like this section is related to what I am searching for. These are likely multiplication/division values and not the actual original value I seek, as this seems to affect most of the diplomacy between majors/majors and majors/player.

---

:!:
58F680 | 0x018d480
length: 2F8

Code: Select all

CD CC 4C 3F CD CC 4C 3F CD CC 4C 3F 33 33 33 3F CD CC 4C 3F 9A 99 19 3F 33 33 33 3F 33 33 33 3F 00 00 00 3F 33 33 33 3F CD CC CC 3E 00 00 00 3F 9A 99 19 3F 9A 99 99 3E 9A 99 19 3F CD CC 4C 3E CD CC CC 3E CD CC CC 3E CD CC 4C 3E CD CC 4C 3E CD CC 4C 3F CD CC 4C 3F CD CC 4C 3F 33 33 33 3F CD CC 4C 3F 9A 99 19 3F 33 33 33 3F 33 33 33 3F 00 00 00 3F 33 33 33 3F CD CC CC 3E 00 00 00 3F 00 00 00 3F 9A 99 99 3E 9A 99 19 3F CD CC 4C 3E CD CC CC 3E CD CC CC 3E CD CC 4C 3E CD CC 4C 3E 00 00 80 BF 00 00 80 BF 00 00 80 BF CD CC 4C 3F 00 00 80 BF 00 00 80 BF 00 00 80 BF 00 00 A0 3F 33 33 33 3F CD CC 4C 3F 00 00 80 BF 00 00 80 BF 00 00 80 3F 9A 99 19 3F 33 33 33 3F 00 00 80 BF 00 00 80 BF CD CC 4C 3F 00 00 00 3F 9A 99 19 3F 00 00 80 BF 00 00 80 BF 00 00 80 BF CD CC 4C 3F 00 00 80 BF 00 00 80 3F 00 00 C0 3F 00 00 C0 3F 33 33 33 3F CD CC 4C 3F CD CC 4C 3F 00 00 80 3F 00 00 80 3F 9A 99 19 3F 33 33 33 3F 33 33 33 3F CD CC 4C 3F CD CC 4C 3F 00 00 00 3F 9A 99 19 3F 00 00 80 BF 00 00 80 BF 00 00 80 BF 00 00 80 BF 00 00 80 BF 00 00 40 3F 9A 99 59 3F 9A 99 59 3F 9A 99 19 3F 33 33 33 3F 9A 99 19 3F 33 33 33 3F 33 33 33 3F 00 00 00 3F 9A 99 19 3F 00 00 00 3F 00 00 00 3F 00 00 00 3F CD CC CC 3E 00 00 00 3F 0A D7 A3 3C 00 00 00 00 00 00 00 00 0A D7 A3 3C 0A D7 A3 3C 02 00 00 00 04 00 00 00 04 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00 00 04 00 00 00 9A 99 99 3F 66 66 A6 3F 66 66 A6 3F CD CC 8C 3F 00 00 A0 3F CD CC AC 3F 00 00 C0 3F 9A 99 D9 3F 9A 99 99 3F 00 00 C0 3F 00 00 00 3F 66 66 66 3F 00 00 E0 3F 00 00 00 3F 00 00 00 3F 00 00 E1 43 00 00 48 43 00 00 C8 43 00 00 7A 43 00 00 AF 43 33 33 B3 3F 33 33 B3 3F 33 33 B3 3F 33 33 B3 3F 33 33 B3 3F 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 9A 99 19 3F 9A 99 19 3F 9A 99 19 3F 9A 99 19 3F 9A 99 19 3F 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 80 3F 0A D7 A3 3C 0A D7 A3 3C 0A D7 A3 3C 0A D7 A3 3C 0A D7 A3 3C 0A D7 23 3D 0A D7 23 3D 0A D7 23 3D 0A D7 23 3D 0A D7 23 3D 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 0A D7 A3 3B 0A D7 A3 3B 0A D7 A3 3B 0A D7 A3 3B 0A D7 A3 3B 00 00 80 40 00 00 80 40 00 00 80 40 00 00 80 40 00 00 80 40 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 80 3F
:!: Area appears to have 5 four byte floats here. I intend to determine their function. Appears to possibly alter AI ability to send non aggression treaties. Only tested 15-20 turns of each so highly speculative.
Update: This area contains values which are compared to the table of values at 577D04. I think here we are comparing the base value of the 5 races to cmp -1.0 and using it as a frequency for which types of treaties are being sent.

Code: Select all

0058F720 flt_58F720 dd 3 dup(-1.0), 8.0000001e-1, -1.0
0058F720                                         ; DATA XREF: AI_AIDipEvl_PropCalc_432390+E1r
0058F734 flt_58F734 dd 2 dup(-1.0), 1.25, 6.9999999e-1, 8.0000001e-1
0058F734                                         ; DATA XREF: AI_AIDipEvl_PropCalc_432390+133r
0058F748 flt_58F748 dd 2 dup(-1.0), 1.0, 6.0000002e-1, 6.9999999e-1
0058F748                                         ; DATA XREF: AI_AIDipEvl_PropCalc_432390+15Fr
0058F75C flt_58F75C dd 2 dup(-1.0), 8.0000001e-1, 5.0e-1, 6.0000002e-1
0058F75C                                         ; DATA XREF: AI_AIDipEvl_PropCalc_432390+1A6r
Compared values in laymans:

0058F720: first three floats value -1.0, fourth float value 0.8, last float value -1.0
Assumption: Something for Klingons i.e. less chance to send peace (maybe Feds if reversed viewed? more chance to send peace?)

0058F734: first two float values -1.0, third value 1.25, fourth value 0.7, fifth value 0.8
Assumption: Unknown *(related below?)

0058F748: first two -1.0, third 1.0, fourth 0.6, fifth 0.7
Assumption: Unknown *

0058F75C: first two -1.0, third 0.8, fourth 0.5, fifth 0.6
Assumption: Unknown *

We are so close... if it's a snake, we are bitten.


58B880 | 0x0189680
length: TBD
I missed this little hidden section :o
Last edited by Tethys on Tue Sep 26, 2023 12:30 am, edited 2 times in total.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: AI Diplomacy Empire/Player

Post by Flocke »

Tethys wrote: Sun Sep 24, 2023 9:35 pm I am still however using the SCT database from 2012, the one which works with IDA 5. The other databases require a higher version than I have installed.
Wow, that one is old. I just upgraded from IDA DB sct_trek_2022-11-24 to above sct_trek_2023-09-25 and it opens just fine in IDA Free 5.0.
But I faced a rendering issue with that old IDA version some time back. That one however luckily was fixed when I changed the font settings.

I also have IDA Free 8.2 installed that I sometimes use for analysis. Sadly it doesn't support this old IDA database format any longer.
When I searched on it a while back, I think I found there was an upgrade path. But I didn't give it a try yet. :mad:
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

This takes the cake...

Post by Spocks-cuddly-tribble »

Flocke wrote: Mon Sep 25, 2023 5:55 amI faced a rendering issue with that old IDA version some time back. That one however luckily was fixed when I changed the font settings.
Big thanks for this useful hint! Albeit it still doesn't fix all issues in IDA 5 caused by just installing ver 8.3. :shock:

IDA 8+ makes deep changes to the OS and leaves them behind after deinstallation. Even deleting windows roaming files and regkeys won't solve this. :mad:

Flocke wrote: Mon Sep 25, 2023 5:55 amI also have IDA Free 8.2 installed that I sometimes use for analysis. Sadly it doesn't support this old IDA database format any longer.
When I searched on it a while back, I think I found there was an upgrade path. But I didn't give it a try yet. :mad:
They propagate there is an easy way to do this. But all public conversations of turbo nerds on the subject indicate it just doesn't work (even with hacking, edited 'special' versions, ver 6 or 7 and extra tools). :sad: - A shame, the new IDA version works and looks nice.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: This takes the cake...

Post by Flocke »

Spocks-cuddly-tribble wrote: Mon Sep 25, 2023 2:06 pm Big thanks for this useful hint! Albeit it still doesn't fix all issues in IDA 5 caused by just installing ver 8.3. :shock:
I'm happy I was of help. :lol: I already wondered what caused the trouble. Before I installed IDA 8.2 I remember I have been using it without of issues.
But I did not notice any further issues, what more issues are you experiencing?
Spocks-cuddly-tribble wrote: Mon Sep 25, 2023 2:06 pm They propagate there is an easy way to do this. But all public conversations of turbo nerds on the subject indicate it just doesn't work (even with hacking, edited 'special' versions, ver 6 or 7 and extra tools). :sad: - A shame, the new IDA version works and looks nice.
I already feared there was an issue. I'm sure it can be resolved, but for now I have other priorities. :evil:
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 »

Guys, the values I have found when I attempt to alter them, is no noticeable difference.

432390 is a bugger. It compares AIAgent (hash) to value 2.0 then either exits or continues on with a proposal. It then checks for aliens before applying some calculations later on... after it gets some MilStat calculations. 432405 cmp 02 not sure what this is for, maybe monster final check as there is a side exit (retn) directly after. After the cmp 2 we call for EmpStat calculations and after another cmp 01 and a possible follow up check for monster and EmpireStats (00432466 cmp edi, 19h)? cmp edi 32h and 64h values 50 and 100 I can assume this might be comparing the base increment of attitude per subroutine? Here is where we start getting into calculations which I thought were the ones: 43246B, 4324BD, 4324E9, 432530 adjusting the table of related values has no effect, however adjusting the 2.0 in the beginning has a major impact just by itself. It stops all treaty proposals from the AI except for Bribes and Warpacts. So my assumption is that one of the subroutines contained within this one is doing additional calculations, and references that 2.0 to get the diplomatic/sympathy/attitude value necessary to send a given treaty type. Treaty types have ID's and there are thresholds for what type of treaty proposal you will receive from the AI.

It has just occurred to me that I am testing in Vendetta mode. Perhaps I should switch to Domination for a more accurate assessment (since all majors will start Neutral)

Thats all I got for now. Maybe some clues have been shed.
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 »

this is just my best guess at
004584E3 (accept/reject Diplomacy?) and 004583A0 (propose Diplomacy?)
if you added race comp
if race 2 call declare war sub (return)
else process sub call (return)

you might be able to do this in relocation table

I am guessing if you no-op those 2 calls all AI Diplomacy would stop but this could be human player also?

edit (min testing)
I think I am right stops AI and human Diplomacy, problem is even human can not declare war.
so you would need to find declare war sub and call that sub if race 2 then return?
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 »

Thanks TC, I am looking into these now. I think I might have messed up a save file though, at war with Dominion and they are worshipful and accepting my demands left and right. Something I changed I must have forgotten about. Also, liberating a minor race caused them to be enraged but that might have been due to raids. I stopped the raids to free the system (it was liberated the first time but i reloaded the save), and without raids the liberation failed.
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: Mon Sep 25, 2023 11:48 pm Something I changed I must have forgotten about.
you will never learn, edit vanilla if it works add changes to mod
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: This takes the cake...

Post by Spocks-cuddly-tribble »

Flocke wrote: Mon Sep 25, 2023 2:58 pmwhat more issues are you experiencing?
E.g. lots of other formatting deviations, doesn't save configurations right, plus it messed with the OS firewall. :dwn:


@ Tethys: Download and use this database - just removed an error in AI code (works with IDA 5)! https://workupload.com/file/e2VF4Fd5gZA [EDITED]

That's an order from Captain Picard himself :!:

And no funny business down your rabbit hole, the Doctor is watching you in my absence: https://www.youtube.com/watch?v=ShxnbsrfBnw :wink:


Some of your above codes:
Special code for federation AI vs minor race for attitude changes:

00422C67         cmp     word ptr [esi+8], 1               ; federation?
576ED4 | 0x0174cd4 length: A0 -> many different values for different AI features

577050 | 0x0174e50 length: 40 -> same, starts with minorGiftEffect multipliers for spechial cases

I'm quitting after this, it would be a long day...
This is a check for the current AI war type vs this empire:

00432405         cmp     dword ptr [eax+8], 2              ; open war?
thunderchero wrote: Mon Sep 25, 2023 9:52 pm004584E3 (accept/reject Diplomacy?) and 004583A0 (propose Diplomacy?)
Both just execute the dip orders from files like Ordinfo,even for basic stuff like trade routes (even from player empire).


EDIT:

This could be min delay values for AI dip features: :idea:
sub_404F80 AI_Dip_Random_Timer_1_5_4__EBX_turnIndex

58AEDC AI_min_turn_times_for? -> 12 values for case index 0-B (all 10/0xA only case 9 is 18/0x12)
Last edited by Spocks-cuddly-tribble on Tue Sep 26, 2023 1:32 pm, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Post Reply

Return to “General Modding Information/Questions”