Mysterious 'aigen.c' tactical combat-group feature

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.
Post Reply
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Mysterious 'aigen.c' tactical combat-group feature

Post by Spocks-cuddly-tribble »

Of the many broken and unfinished features in trek.exe there is still one refusing to divulge it's purpose.

An unknown/unused 'aigen.c' function supposed to affect behavior of tactical combat groups with special codes for Federation, Ferengi and Klingon ships.

Sub_554574/5546D0 generates for each ship, each turn in tactical combat, two random values between 0-7. At least one of them has a subtle impact.

Last group ship's random values get copied into (a seemingly unused part of) the group data ds:597860.

Our special feature replaces the second random value (with the subtle impact for ships) in the group data with the lowest of all group ships for Ferengi, the greatest of all group ships for Klingons and the greatest of all fleet ships for Federation.

Sadly the group random values don't seem to be applied, so I wasn't able to deduce a patchable concept.

Any ideas?


Code: Select all

0x15359C 76 -> EB (disable all features) -> massive impact

0x153A11 75 -> EB (disable group race deviation special feature) -> no change

0x153B37 01 D3 -> 33 DB  +188h (random always 0) -> subtle change

0x153B64 01 D3 -> 33 DB  +184h (random always 0) -> no change
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: 3237
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Mysterious 'aigen.c' tactical combat-group feature

Post by Flocke »

I had a look but the asm code didn't tell me much about it. Therefore I tried to debug the code and set a hardware breakpoint for when same memory location is being read, both for the +5Ch group values and the +188h ship values

Playing the Cardies, for +188h during combat vs a small Ferengi fleet it also breaked at asm_5542E1, asm_554307 and at asm_554739. The latter is called first and seems to generate the ship values. The group values indeed were not read at any further point during combat. But maybe you can find more on the ship values to figure what they are about.
It further breaked on asm_554602, even though that one reads one value ahead at +184h. But having a look at asm_554739 they relate to each other.

Other than that I can only guess in the blind and say it might be about group tactics and Ferengi are cowards so when one ship retreats they all retreat while the Federation stays together and Klingons don't stop their fight by traitors anyway. But only a very blind guess.

Edit: During next turn progress, the breakpoints were also triggered at asm_54F2D0, asm_54F2D9 and asm_54F2DE.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Re: Mysterious 'aigen.c' tactical combat-group feature

Post by Spocks-cuddly-tribble »

That's yesterday's news, but the ship random values +188 (0-7) get added to:

5A0A48 dword index data for combat command IDs 1-D (0 unused): viewtopic.php?p=28508#p28508
Largest values for ram, evade, charge... lowest retreat, hold, hail (100).

A cmp loop replaces the checked value with the first greater sum (command index data + random) :???:
-> via memmove function, your turn progress is part of memset_addrEAX_bytesEBX_withEDX = memory re-used for unrelated new data.

Might be for movement deviations or random target selection (phaser group vs group mode). But still no indication for the unused race group feature.
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: 3237
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Mysterious 'aigen.c' tactical combat-group feature

Post by Flocke »

Spocks-cuddly-tribble wrote: Sun Dec 04, 2022 1:16 pmBut still no indication for the unused race group feature.
Already by the name, "AI Gen" must be some AI dicing generator code. And since the value is in bounds 0-7 and not normalized, it is likely it is same for the group like it is for the individual ships.

They possibly tried to simulate some different race bahaviour for the ship groups but later dropped the feature since it wasn't much eloberated and didn't work well. At least it doesn't look much sophisticated and in my debug attempts in combat I didn't find any code that reads the value back either.
Like many programmers do, they possibly just disabled the relevant part of the code but left the rest in place for a later time.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Re: Mysterious 'aigen.c' tactical combat-group feature

Post by Spocks-cuddly-tribble »

I found another hint in the ferengi AI's targeting behavior.

Usually, when targeting homogeneous groups (same stats e.g. all scouts and shields/hull 100%), the AI goes for the group leader (most often center of the group).

But sometimes there is random deviations. It appears that the ferengi show those targeting deviations more often than the other AI empires.
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”