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
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: Tue Sep 26, 2023 11:41 am E.g. lots of other formatting deviations, doesn't save configurations right, plus it messed with the OS firewall. :dwn:
Interesting, I didn't notice any such issues.
For the Font I selected Courier Standard size 8, but I'd need comparison or some offsets to tell on the formatting.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: This takes the cake...

Post by Spocks-cuddly-tribble »

IDA 8.3 during installation told something about updating palettes (without choice) installing visual c++ and firewall changes for cloud features (not available for free version anyway). Most are just minor inconveniences, but it's confusing if you're used to a certain look for ages. :???:

E.g. everytime I load my database in IDA 5 I have to adjust the above bars (it used to save configurations right) - bottom how it should be:
bars.png
bars.png (9.54 KiB) Viewed 772 times
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 »

thunderchero wrote: Tue Sep 26, 2023 7:33 am
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
:lol: :mrgreen: I double checked the code locations (4 in total) and they all match the vanilla exe. Just good ol BotF stuff happening I think
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 »

Spocks-cuddly-tribble wrote: Tue Sep 26, 2023 11:41 am
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)
I will investigate this sometime today :) thanks

Also, related, I might have been using QD database, I can't really be sure because I only have 2 that works, and one seems to be lost. So I'm just using the one right now (many labels from myself may have been lost) but, such is life

Edit: I am confused how you are getting 1.5 and 4.0 from those values, unless they are ID's linked to another location? Is this a math product? Looking on the registers it seems there *could* be some upper/lower register math happening, FF FF being 65535 or some other identifier to confirm the case "jump if above 05" and setting any other value to 1.5 if below 5. Not sure, I'm more used to editing values directly, which is why/how I found that table of values in the dw section.
Last edited by Tethys on Tue Sep 26, 2023 3:04 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: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

Tethys wrote: Tue Sep 26, 2023 2:09 pmI will investigate this sometime today :) thanks

Also, related, I might have been using QD database, I can't really be sure because I only have 2 that works, and one seems to be lost. So I'm just using the one right now (many labels from myself may have been lost) but, such is life
You can use different databases for comparison, just leave another notepad open with asm locations (here you see my own and QD in IDA 5 launcher):

Screenshot (103).png
Screenshot (103).png (7 KiB) Viewed 750 times
I think IDA 5 doesn't support multiple databases in different tabs at the same time :?: (Flocke?)

Tethys wrote: Tue Sep 26, 2023 2:09 pmEdit: I am confused how you are getting 1.5 and 4.0 from those values, unless they are ID's linked to another location? Is this a math product?
[EDIT] Composed double float values; 0.4 for minors and AI empires else 0.15 for player empires (labels were off by a decimal point :idea: :???: )

https://baseconvert.com/ieee-754-floating-point

EDIT2: There appear to be even more comment labels corrupted - horrific :mad: :dwn:
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 »

I mean, I might not even need to understand these fully to get where I need to get. I think I need to investigate the subroutine(s) that are calling this particular one, and see what is further down. There must be some trigger to define how majors interact and react to each other. I plan to look on this alot though, and yes it is indeed QD database I was using. Thank you for your updated one, I have no idea where yours went because I have a HDD (now backed up thankfully) which is intermittent in its workability, and when I went to load in your database it said the system path was not existent. And it removed that entry automatically from this list of previous projects. I thought I put yours and QD one in the same folder, but alas, it has been lost. I had a lot of labels added, for the nebular projects and such else.. will have to locate it perhaps by name "sct*"

I am not familiar with "composed" double floats. But I know 33333333h does not match any value close to 0.15 well it seems I am in fact wrong there it seems its a true decimal, not 1.5 being calculated via e-1. By composed, you must mean with BIG endien as per UE. I use UE for calculations. I also do not have the text view linked so let me do so now..

Ty for all the tips and such I really appreciate. Btw, how would I find out if its little or big endien if you already know?

Edit: UE said now 0.15 little endien = 33 33 33 33 33 33 C3 3F

Questions: It moves the first half of the number into 218h and then the second half into 21Ch... so what does this do? Why the additional byte to split them up? Because 218h and 21Ch are 4 bytes apart anyway... confused yet again :lol: Edit: Maybe not so confused, as I recall registers using the upper and lower halves. Assumption: Thats why.

Followup: I will try zeroing this value (0.0) <- and even though it kinda looks like a surprised face, if my hunch is correct, I should receive proposals every turn. I will report my findings here.
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 »

sub_404F80
location: 404FEB
length: 0Ah
composition: 8 byte composed double float

This value when zeroed out prevented the AI sending any demands to the player (This value also affects whether a gift to a major empire increases attitude, zeroed they declared war no matter how many gifts I sent), and when set to 1.0 or higher, caused all kinds of treaties to be thrown about. They were still able to make statements and their attitude and sympathy values still work as expected. Seems to be a base value.

Example: BB 33 33 33 33 BE 33 33 C3 3F -> BB 00 00 00 00 BE 00 00 00 00

This probably also disables gifting (untested but not for long) Gifting works. This value also (likely) disables minor races from proposing any relations to you, and the other value for minors? (bribing, untested but not for long either).

Also, it has come to my attention that something may need to be fixed. I don't think it's a bug, but minor 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. I think it might be depending on which empire is more enraged at you. Klingons were the more enraged party so they got the first declaration. Some things to think about yeah ;)

location: 405030
length: 0Ah
composition: 8 byte composed double float

This value when zeroed out prevented the AI from declaring any wars, sending warpacts, or signing any thereof with each other. Minors still declared war on the major empires. The major empires still sent me demands.

I think from here now, using this new knowledge I should be able to now locate race specific values if any exist, thank you SCT again. 41 subroutines to look through, nice. I'll try to narrow them down by labeling :)

:!: Of Interest :!:
sub_405164
sub_41F5C0

Somewhere in here I might be able to jump to the relocation table and check for 02 "Ferengi" cmp 02 test > jump back from reloc > je to exit, for treaty proposals received. Not sure if its the ones received BY AI or Player though.. assumption is they will ignore any treaty proposal. Seems like I will have to insert the checks in various locations. It would be nice if they can still make war declarations. Maybe let them demand as well, but remove player/AI gifting.

Somewhere like here:

Code: Select all

004051CE 4E0 89 E8                   mov     eax, ebp
004051D0 4E0 E8 2B 69 11 00          call    gdlList_FirstItem ; Call Procedure
004051D5 4E0 89 C1                   mov     ecx, eax
004051D7 4E0 85 C0                   test    eax, eax        ; Logical Compare
004051D9 4E0 0F 84 8E 00 00 00       jz      loc_40526D      ; Jump if Zero (ZF=1)
Last edited by Tethys on Tue Sep 26, 2023 8:30 pm, edited 2 times 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: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

Your conclusions are wrong, but the test still confirms I identified the right code for you. :up:

It's both percentage values for the same (shared!) random switch.

0.15 = 15% -> vs players
0.4 = 40% -> vs other AIs

Using this info you just need to test cases for the turn delay values:
58AEDC AI_min_turn_times_for? -> 12 values for case index 0-B (all 10/0xA only case 9 is 18/0x12)
Once we know the full pattern I can write a small patch with custom values for each AI empire and case.
So you can even disable certain features for some empires. :idea: No relocation needed. :wink:
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 »

My tests were quick, probably too quick. 10 or 15 turns on the same save game just to see effects of gifting, raiding, encroaching, demanding, proposing, etc. Based on that I made the assumptions. I still have arrived at some pretty interesting locations. I will test turn delay values soon, I just got carried away looking for good places to cmp 02.

58AEDC

What I notice when I zero this table is that the frequency of diplomatic events increased moderately for ~35 turns, then dropped off sharply for the remaining 10 turns. One minor race sent me a statement, because they joined the Klingons and ended their war with me. Instead of 00's I will test 01's now and report back soon.

Update: Value 01 in place of 0A I did not receive a single proposal for the ~25 turns tested. Now thats just crazy :D
Last edited by Tethys on Tue Sep 26, 2023 9:05 pm, edited 3 times 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: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

If my idea works you don't need to look for ex-ferengi ID 2 (I guess for you Borg?) A ridiculous turn delay value in my new empire/case table will do.
Tethys wrote: Tue Sep 26, 2023 8:32 pm58AEDC What I notice when I zero this table
Dude, what is wrong with you? Increase only one value for each test (say FF = 255 turns delay) and/or set all others 0.

Then you see if you find the case value delaying/stopping demands and other cases (unless some are shared).
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 »

Because its faster to see general/visible changes by changing them all? Found that 00, 01, and 0A might not be what is expected. But FF would be a good test I think. I am skeptical that its a turn delay, and demands were not affected btw.
Spocks-cuddly-tribble wrote: Tue Sep 26, 2023 8:51 pm
Dude, what is wrong with you? Increase only one value for each test (say FF = 255 turns delay) and/or set all others 0.
I assume you are expecting each value to be one of the proposal types, yes? Demands are not here. Testing each one separately soon.

Update: Using FF in all locations had the same effect as using 01 in all locations. Weird. Moving on with that little note in the back of my mind now..

00 = sharp increase followed by sharp decrease in diplomacy
01 = no diplomacy toward player
0A = vanilla normal
FF = no diplomacy toward player

Test one controlled
Variables: First value FF, all others 00
Effects: All diplomacy worked as expected vs major races. However, I received no statements even flying around Klingon space. They always let you know "We have not given your ships right of passage! Do not assume it!" every time. Not in this test.

Test two
Variables: Second value FF, all others 00
Effects: Increased chances to receive non-aggression, affiliation, warpact, and war being declared. AI demands came through, statements too. AI lost attitude when rejected as expected. While at war, increased chance for non-aggression.
Last edited by Tethys on Tue Sep 26, 2023 9:56 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: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

Tethys wrote: Tue Sep 26, 2023 9:08 pmI am skeptical that its a turn delay, and demands were not affected btw. (...) Demands are not here.
Note that lying to cuddly tribbles is prohibited by the forum rules! :wink:

I checked the code and these are delay values in turns, but only for this code switch i.e. some features might have alternative code paths as well. :idea:

And, as expected, 'demands' is case 9 (default 18 turns min delay): viewtopic.php?p=24148#p24148

Note there is an internal turn number deviation in the code (player turn displayed -2). So delay values lower than 2 or 3 might break the feature in the beginning of a game!
Last edited by Spocks-cuddly-tribble on Tue Sep 26, 2023 9:59 pm, edited 2 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
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: Tue Sep 26, 2023 9:56 pm Note there is an internal turn number deviation in the code (player turn displayed -2). So delay values lower than 2 or 3 might break the feature in the beginning of a game!
I see, the save is from turn 5 where I have already met 3 of the 4 majors. The 4th happens a turn or 2 later. So far, every adjustment I made has had a different set of results. Expected, but not really. More expected it to break rather than keep working. :shrug:
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: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: AI Diplomacy Empire/Player

Post by Spocks-cuddly-tribble »

This feature means min x turns after the last time of the same(?) action vs the same party i.e. it won't prevent the first action!

But we can add an extra switch for your borg to solve this. :wink:

Turn delay index cases 5, 7 and 8 are not used in the defult code, but way too many cases with turn index value B:

Screenshot (106).png
Screenshot (106).png (35.9 KiB) Viewed 616 times
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 »

I am going to test case 9 directly then. From there I will decide how I will proceed with the rest of testing. Will play with the values until the frequency increases and apply the same for the other values. See you soon.

Update: FF caused no more demands to be sent other than the first initial demand. Testing value 03 now.

Follow before testing: I notice there are 12 values, perhaps they are related to the (apparently) 12 types of treaties? I found by keyword search this button switch jump 426414, and I think there's another table that looks like this one as well. Here is the other location, this where 12 items gather loc_4C572D

Follow up after testing: The Ferengi are demanding bastards. They have the highest probability it seems for demanding. Klingons pretty high as well but they declare war too quickly to test thoroughly them or the Romulans. Cardassians less frequent, and more apt to be sending peace/affiliation.

Test 4
Variables: Third value set to 03, all others 0A.
Result: Possible increase in diplomatic frequency between AI. None toward the player except demands and war.

Test 5
Variables: Fourth value 03, others 0A
Result: There may have been an increased frequency of war pact proposals, mainly from the Cardassians.

Test 6
V: Fifth value 03, others 0A
R: UNKNOWN Possible increase in AI acceptance. Enraged Cardassians accepted Affiliation but other races did not accept non-aggression. AI Cardassians 2 turns later declared war on me along with their affiliated Ferengi. (This happens also with vanilla values)
V: Fifth value 00, others 0A
R: Same as above/unobservable

Test 7
V: Sixth value 03, others 0A
R: Unknown/unobservable Possible increase in AI acceptance

Test 8
V: Seventh value 03, others 0A
R: Unknown/unobservable

Test 9
V: Value eight 03, others 0A
R: Finally have a result. Statements disabled using value 03. I encroached, intel bombed, and destroyed outposts. They didn't have anything to say.
V: Value eight 00, others 0A
R: I feel like I got a few statements, but they stopped after one statement even with same steps above.
Last edited by Tethys on Thu Sep 28, 2023 1:10 am, edited 1 time in total.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
Post Reply

Return to “General Modding Information/Questions”