One per empire bug with more than 1 minor structure

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
Dafedz
Lieutenant-Commander
Lieutenant-Commander
Posts: 129
Joined: Mon May 05, 2008 2:00 am

One per empire bug with more than 1 minor structure

Post by Dafedz »

Spocks-cuddly-tribble wrote: Fri Sep 17, 2021 12:56 pm

Code: Select all

NAME: AI multiple One-per-Empire buildings fix
DESC: Skips also output types trade goods & emergency morale program, in case they are mistakenly in aibldreq.bin.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=54784#p54784

>> 0xB2BF 24 66 8B 4E 08 66 83 F9 20 0F 83 98 00 00 00 B8 01 00 00 00 D3 E0 89 C1 23 4C 24 68 83 F9 01
<< 0xB2BF 12 8A 46 08 8B D1 E8 B6 FB 02 00 85 C0 0F 85 F9 FA FF FF 80 7C 24 72 04 74 05 80 7C 24 72 24

# 40BEBE   74 12           JE SHORT 40BED2      // skip One-per-empire check
# 40BEC0   8A46 08         MOV AL,[ESI+8]       // empire ID
# 40BEC3   8BD1            MOV EDX,ECX          // building ID
# 40BEC5   E8 B6FB0200     CALL 43BA80          // check_one_per_empire_buildings_eax1_there
# 40BECA   85C0            TEST EAX,EAX
# 40BECC  ^0F85 F9FAFFFF   JNZ 40B9CB           // skip is there
# 40BED2   807C24 72 04    CMP BYTE [ESP+72],4  // skip trade goods output type (AI placeholder building bug)
# 40BED7   74 05           JE SHORT 40BEDE
# 40BED9   807C24 72 24    CMP BYTE [ESP+72],24 // skip emergency morale program output type
I'm using this patch in the update for UM5 v5.5 but still experiencing the "build infinite instances of a structure". It's happening with a minor-race, one of their special structures which is set to One Per Empire. Just dropping this here.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: One per empire bug with more than 1 minor structure

Post by Spocks-cuddly-tribble »

This topic is about the AI ignoring the restriction in all cases, not player UI. :idea:
Dafedz wrote: Tue Jan 24, 2023 10:22 am"build infinite instances of a structure". It's happening with a minor-race, one of their special structures which is set to One Per Empire. Just dropping this here.
Player can build more than one due to a glitch? One of the issues with outdated system takeover fixes: viewtopic.php?p=33859#p33859 (now deleted)

Just checked UM5.5 trek.exe and You did not remove one of the outdated codes as advised:

Try this (might require starting new game?) 0x4009F RESET -> 0F 82 (UM5 has outdated 90 E9).

Remove patch to restore vanilla (for all mods if vanilla not installed):

Code: Select all

NAME: Restore Vanilla - Fix Outdated Minor Race Special Structure System Takeover Codes - Ignore Conflict

>> 0x3FFF2 23
>> 0x40118 EB
>> 0x4009F 90 E9

<< 0x3FFF2 FF
<< 0x40118 73
<< 0x4009F 0F 82
Note the BotF default code can still fail if a minor race has more than one special structure in the build list!

Also note the 'one per empire' feature has a max limit of 40 building IDs per empire.
If at any point an empire owns more than 40 structures of that type you get glitches (30 minor structures + 10 empire would be critical).
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: One per empire bug with more than 1 minor structure

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 4:27 pm Note the BotF default code can still fail if a minor race has more than one special structure in the build list!
yes, UM5 has multiple minor special structures per minor.

but also MUM has 2 structures per minor, except MUM has a special non buildable structure for each minor (3 total), the non buildable structure is just an image place holder for race icon in diplomacy "Race Info" screen. after adding 'AI multiple One-per-Empire buildings fix' patch
I think it took AI membering minor race then AI subjugation by a different major race and finally subjugation by human player before multiple structures bug popped up.
info.jpg
info.jpg (231.75 KiB) Viewed 175 times
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: One per empire bug with more than 1 minor structure

Post by Spocks-cuddly-tribble »

The patch without removed/bugged 'keep minor race special structure' option will not cause this issue with vanilla setup.

But it cannot fix new issues with more than one special structure per minor (patch independent bug).

You might need a new loop to check more than one building per minor at asm 440CAF-440D0E: EDIT not needed! Code just to clean ex-owner empsInfo!

Code: Select all

00440CB4           call  4C22F8 Minor_race_blg_IDs -> shared for diplomacy screen
But first try if above two bytes fix is good enough for you.
Last edited by Spocks-cuddly-tribble on Tue Jan 24, 2023 5:36 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.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: One per empire bug with more than 1 minor structure

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 5:21 pm You might need a new loop to check more than one building per minor at asm 440CAF-440D0E:

Code: Select all

00440CB4           call  4C22F8 Minor_race_blg_IDs -> shared for diplomacy screen
correct me if I am wrong but a loop would not help if structure ID is not in "Minor_race_blg_IDs" structure id data list would need to be increased?
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: One per empire bug with more than 1 minor structure

Post by Spocks-cuddly-tribble »

Yes, it needs to be a list with all special structures per minor.

But this code is only for cleanup of one-per-empire empsInfo entries of the ex-owner (if empire).

So the glitch will keep wrong IDs in the list when loosing minor systems with one-per-empire structures not listed in sub_4C22F8.

But the better question is: Can't you just set minor special to one-per-system and use pop/race restriction (40 limit won't work for you guys)?


OT: Can you split and move OT posts to General Modding Information/Questions?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: One per empire bug with more than 1 minor structure

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 5:45 pm OT: Can you split and move OT posts to General Modding Information/Questions?
OT: done
OT: -> OT: just an idea when a patch is intended to restore vanilla code create patch with vanilla code on >> and << this way if removed or installed it will restore vanilla code and display non highlighted (when vanilla) or red if code differs

Code: Select all

NAME: Restore Vanilla - Fix Outdated Minor Race Special Structure System Takeover Codes - Ignore Conflict

>> 0x3FFF2 FF
>> 0x40118 73
>> 0x4009F 0F 82

<< 0x3FFF2 FF
<< 0x40118 73
<< 0x4009F 0F 82
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: One per empire bug with more than 1 minor structure

Post by Spocks-cuddly-tribble »

No problem, albeit not meant for patch database.

Dafedz bug should be the max 40 entries per empire limit. So you need to look into this option or issues with it:
Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 5:45 pmCan't you just set minor special to one-per-system and use pop/race restriction (40 limit won't work for you guys)?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: One per empire bug with more than 1 minor structure

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 5:45 pmCan't you just set minor special to one-per-system and use pop/race restriction (40 limit won't work for you guys)?
I am having good luck with MUM minor structures set at
one per system
pop req 80
max pop req 200
Edit; never understood descriptions UE uses or if they are correct.

if you have not already looked, yes this is an area UM5 needs attention. "AI build requirements" for minors
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: One per empire bug with more than 1 minor structure

Post by Spocks-cuddly-tribble »

thunderchero wrote: Tue Jan 24, 2023 7:56 pmI am having good luck with MUM minor structures set at
one per system -> edifice.bst
pop req 80 -> aibldreq.bin
max pop req 200 -> aibldreq.bin
Edit; never understood descriptions UE uses or if they are correct.
No need to change aibldreq.bin, there should be no change at all for AI and/or player (only description in build screen: one-per-empire -> one-per-system).
But IIRC there was a reason they set minor race special structures to one per empire, albeit it makes more sense to use one per system?
If this works with no issues and/or gameplay changes you don't need to change any trek.exe codes. :wink:

80 pop might be a bit low for expensive structures?
With population/race I meant inhabitant ID edifice.bst 0x68-0x6F Race requirement bitmask (should be minor race ONLY anyway).
40 limit is not pop but this:
Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 4:27 pmnote the 'one per empire' feature has a max limit of 40 building IDs per empire.
If at any point an empire owns more than 40 structures of that type you get glitches (30 minor structures + 10 empire would be critical).
IDs 41+ (total number in all systems of the empire) get no list slots in empsInfo so BotF fails to see you already have them. :idea: = build infinite bug :!:

thunderchero wrote: Tue Jan 24, 2023 7:56 pmif you have not already looked, yes this is an area UM5 needs attention. "AI build requirements" for minors
What's wrong with it? Vanilla AI doesn't even build the minor special buildings IIRC?
Last time I checked the major shipyard IDs in UM5 aibldreq.bin and they were fine (that's important).


EDIT:
plus_area_tech_local.png
plus_area_tech_local.png (11.85 KiB) Viewed 74 times
How does this work?
Local tech bonuses cannot be specified for tech areas, only global bonuses?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: One per empire bug with more than 1 minor structure

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Jan 24, 2023 9:54 pm EDIT:
plus_area_tech_local.png
How does this work?
Local tech bonuses cannot be specified for tech areas, only global bonuses?
It is just like the Breen to be misleading and deceptive....
Post Reply

Return to “General Modding Information/Questions”