MP issue with Extending Edifbnft.bst (new building types/bonuses)

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
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

Spocks-cuddly-tribble wrote: Sun May 01, 2022 10:28 pm Also now there should be the same one turn delay when adding a ship and previous build was not a ship?
just double checked and you are correct
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

Hi

I was doing so basic tests this morning

vanilla code changes
res changes
edifice.bst changes Daystrom Institute to 25% shipbuilding industry
edifbnft.bst extended benefit list

trek.exe changes added

Code: Select all

trek.exe at 0x4FBDC new code 0xC bytes:

C1 E0 02 03 02 8B 04 10 03 C2 5A C3

Code: Select all

0x0003e5d4 6C FC 58 00 -> F0 A3 68 00

0043F1D1 8B 04 85 6C FC 58 00                            mov     eax, ds:blg_output_type_Index_for_systInfoC0[eax*4]

moved table to relocation data area 
redid new table to 4 byte 
removed marker for A8 and 14
Guess what sync error on turn 1 in MP
I did not expect this :shock:

single player game bonuses applied on same turn.

edit after changing all entries of FF 02 00 00 -> FF FF FF FF
no sync error

question?
where are the bonus types/calculations? (% industry, utopia, static industry)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by Spocks-cuddly-tribble »

thunderchero wrote: Mon May 02, 2022 8:51 amquestion?
where are the bonus types/calculations? (% industry, utopia, static industry)
Codes in 'techlevel bonus factors', but as told NOT for vanilla utopia.

Stop messing around and try this (with all original patches and utopia preview fix):

Code: Select all

0043F1CB     807A 34 03           CMP BYTE [EDX+34], 3  // systInfo+80 = order ID
0043F1CF     75 1B                JNZ SHORT 43F1EC  // if not 3 = build ship -> not stored

-> replace with long jump to relocation & nop

E9 XXXXXXXX 90

@ relocation

mov eax, [edx+4]
push edx
mov EdX,DWORD PTR SS:[ESP+174]
imul ecx,edx,58
call 441460
pop edx
CMP BYTE PTR DS:[ECX+EDX+230],0
JZ 43F082
JMP 43F1D1
It should check the ordInfo for a build ship order in that system. :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
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

A picture says a 1000 words.....
what did I do wrong?

before turn process
before.jpg
before.jpg (201.06 KiB) Viewed 2077 times
after turn process
after.jpg
after.jpg (199.04 KiB) Viewed 2077 times
after single player test I did not test in MP

here is ida flow
flow.jpg
flow.jpg (421.59 KiB) Viewed 2077 times
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by Spocks-cuddly-tribble »

Looks like you are VERY hungry.

EDIT: I think I see the error (EAX). Will update post soon.

Here you go:

Code: Select all

0043F1CB     807A 34 03           CMP BYTE [EDX+34], 3  // systInfo+80 = order ID
0043F1CF     75 1B                JNZ SHORT 43F1EC  // if not 3 = build ship -> not stored

-> replace with long jump to relocation & nop

E9 XXXXXXXX 90

@ relocation

push eax
movsx eax, word[edx+4]
push edx
mov EdX,DWORD PTR SS:[ESP+178]
imul ecx,edx,58
call 441460
pop edx
pop eax
CMP BYTE PTR DS:[ECX+EDX+230],0
JZ 43F082
JMP 43F1D1
Last edited by Spocks-cuddly-tribble on Mon May 02, 2022 4:37 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: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

looks like basically same result as soon as I add ship to queue with static or % bonus powered, food goes crazy

here is flow
flow.jpg
flow.jpg (403.1 KiB) Viewed 2058 times
Spocks-cuddly-tribble wrote: Mon May 02, 2022 4:18 pm EDIT: With patch means also with adapted adr map: viewtopic.php?p=32929#p32929 (2byte entries)
I used the adr map from next post labeled;
"adapted & updated systInfo bonuses address-map (with 'shipbuilding bonus preview-fix') :!: NOT for multiplayer :!:"
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by Spocks-cuddly-tribble »

thunderchero wrote: Mon May 02, 2022 4:35 pmlooks like basically same result as soon as I add ship to queue, food goes crazy
Sorry I edited the post.
thunderchero wrote: Mon May 02, 2022 4:35 pmadapted & updated systInfo bonuses address-map (with 'shipbuilding bonus preview-fix') :!: NOT for multiplayer :!:"
:up:
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: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

Spocks-cuddly-tribble wrote: Mon May 02, 2022 4:18 pm Looks like you are VERY hungry.

EDIT: I think I see the error (EAX). Will update post soon.

Here you go:

Code: Select all

0043F1CB     807A 34 03           CMP BYTE [EDX+34], 3  // systInfo+80 = order ID
0043F1CF     75 1B                JNZ SHORT 43F1EC  // if not 3 = build ship -> not stored

-> replace with long jump to relocation & nop

E9 XXXXXXXX 90

@ relocation

push eax
movsx eax, word[edx+4]
push edx
mov EdX,DWORD PTR SS:[ESP+178]
imul ecx,edx,58
call 441460
pop edx
pop eax
CMP BYTE PTR DS:[ECX+EDX+230],0
JZ 43F082
JMP 43F1D1
so far it is working as expected (as always needs more testing)
no sync error in MP
bonus display
if structure powered then add ship, toggle next system and back, bonus displays correct.
if ship in queue, then power structure bonus displays updates in real time
when ship completes and queue is empty industry displays correctly (without bonus)
bonus applies on same turn as power up
special ship industry bonuses is not applied to structures

any thing you want me to test or look for?

Edit;
MUM testing
same as vanilla working as expected
went 43 turns, built 20+ ships between cardassians and federation
federation used % ship industry and static ship industry
Cardassians used static ship industry
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by Spocks-cuddly-tribble »

thunderchero wrote: Mon May 02, 2022 5:17 pmso far it is working as expected (as always needs more testing)
I hope that's the result you wanted. :wink:

If there is no issues after beta tests, I'll optimize the main patch.

To shorten the code you could check this for issue (but no priority):

Code: Select all

movsx eax, word[edx+4] -> mov eax,[edx+4]

mov EdX,DWORD PTR SS:[ESP+178] -> xor edx,edx
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: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

Spocks-cuddly-tribble wrote: Mon May 02, 2022 7:01 pm
thunderchero wrote: Mon May 02, 2022 5:17 pmso far it is working as expected (as always needs more testing)
I hope that's the result you wanted. :wink:
Us pakleds always want more power......
Spocks-cuddly-tribble wrote: Mon May 02, 2022 7:01 pm If there is no issues after beta tests, I'll optimize the main patch.

To shorten the code you could check this for issue (but no priority):

Code: Select all

movsx eax, word[edx+4] -> mov eax,[edx+4]

mov EdX,DWORD PTR SS:[ESP+178] -> xor edx,edx
No Idea how you will "optimize" that much code to fit

with changes above look to work the same on a quick test

will add to MUM for further testing.

Edit update
after code update I continued same saved game without issues
at turn 70 I loaded auto save but selected romulan and klingon (switched races mid game)
The Romulans was in mid build of an escort with 1 turn remaining. they had static ship industry powered and the prior turn industry plus static ship bonus was given properly.

problem with AI some structure they just don't build or build only after system is fully developed.
The ship build above was at Romulus (prebuilt structure), but at least we know bonus works properly for AI.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by Spocks-cuddly-tribble »

The updated patch comes in two versions: (I lean toward #2 for ECM ?)



Without output preview of partially scrapped main buildings (vanilla default), might lead to this glitch: viewtopic.php?p=48408#p48408

Code: Select all

>> 0x3E42B 80
<< 0x3E42B 78

>> 0x3E5A7 BF D1 69 D2 28 03 00 00 A1 C8 36 5A 00 8A 44 02 4C 25 FF 00 00 00 66 8B 94 45 86 00 00 00 31 C0 8A 45 72 8B AC 24 74 01 00 00 8B 04 85 6C FC 58 00 01 E8 8B 8C 24 68 01 00 00 81 E2 FF FF
<< 0x3E5A7 B6 5D 72 66 8B 1C 5D 6C FC 58 00 80 FF 01 7F 35 7C 12 8B 01 33 D2 E8 9E 22 00 00 80 B9 7C 02 00 00 00 74 21 0F B6 C3 03 84 24 74 01 00 00 8B 51 4C 66 8B 94 55 86 00 00 00 8B 8C 24 68 01


#0043F028     8B8C24 78010000      MOV ECX, [ESP+178]  // systInfo entry

#0043F1A6     0FB65D 72            MOVZX EBX,BYTE [EBP+72]
#0043F1AA     66:8B1C5D 6CFC5800   MOV BX,WORD [EBX*2+58FC6C]
#0043F1B2     80FF 01              CMP BH,1
#0043F1B5     7F 35                JG SHORT 43F1EC
#0043F1B7     7C 12                JL SHORT 43F1CB
#0043F1B9     8B01                 MOV EAX,[ECX]
#0043F1BB     33D2                 XOR EDX,EDX
#0043F1BD     E8 9E220000          CALL 441460
#0043F1C2     80B9 7C020000 00     CMP BYTE [ECX+27C],0
#0043F1C9     74 21                JE SHORT 43F1EC
#0043F1CB     0FB6C3               MOVZX EAX,BL
#0043F1CE     038424 74010000      ADD EAX,[ESP+174]
#0043F1D5     8B51 4C              MOV EDX,[ECX+4C]
#0043F1D8     66:8B9455 86000000   MOV DX,[EBP+EDX*2+86]
#0043F1E0     8B8C24 68010000      MOV ECX,[ESP+168]


With output preview of partially scrapped main buildings (same as my original patch).

Partially scrapped main structures can remain active until the next turn! Might fix this output preview glitch: viewtopic.php?p=48408#p48408

Code: Select all

>> 0x3E42B 80
<< 0x3E42B 78

>> 0x3E5A7 BF D1 69 D2 28 03 00 00 A1 C8 36 5A 00 8A 44 02 4C 25 FF 00 00 00 66 8B 94 45 86 00 00 00 31 C0 8A 45 72 8B AC 24 74 01 00 00 8B 04 85 6C FC 58 00 01 E8 8B 8C 24 68 01 00 00 81 E2 FF FF 00 00
<< 0x3E5A7 B6 5D 72 66 8B 1C 5D 6C FC 58 00 80 FF 01 7F 35 7C 12 8B 01 33 D2 E8 9E 22 00 00 80 B9 7C 02 00 00 00 74 21 0F B6 C3 03 84 24 74 01 00 00 8B 51 4C 66 8B 94 55 86 00 00 00 0F B7 0E 90 90 90 90


#0043F028     8B8C24 78010000      MOV ECX,[ESP+178]  // systInfo entry

#0043F1A6     0FB65D 72            MOVZX EBX,BYTE[EBP+72]
#0043F1AA     66:8B1C5D 6CFC5800   MOV BX,WORD[EBX*2+58FC6C]
#0043F1B2     80FF 01              CMP BH,1
#0043F1B5     7F 35                JG SHORT 43F1EC
#0043F1B7     7C 12                JL SHORT 43F1CB
#0043F1B9     8B01                 MOV EAX,[ECX]
#0043F1BB     33D2                 XOR EDX,EDX
#0043F1BD     E8 9E220000          CALL 441460
#0043F1C2     80B9 7C020000 00     CMP BYTE[ECX+27C],0
#0043F1C9     74 21                JE SHORT 43F1EC
#0043F1CB     0FB6C3               MOVZX EAX,BL
#0043F1CE     038424 74010000      ADD EAX,[ESP+174]
#0043F1D5     8B51 4C              MOV EDX,[ECX+4C]
#0043F1D8     66:8B9455 86000000   MOV DX,[EBP+EDX*2+86]
#0043F1E0     0FB70E               MOVZX ECX,WORD[ESI]
#0043F1E3     90909090             NOP



thunderchero wrote: Mon May 02, 2022 7:39 pmproblem with AI some structure they just don't build or build only after system is fully developed.
The ship build above was at Romulus (prebuilt structure), but at least we know bonus works properly for AI.
1.) Yes the new code should work for AI, but AI will not understand ship industry bonuses i.e. anticipates the current nominal industry output (without morale modifier) for the next build task:

Some AI codes seem to have a limit depending on build type (ship, base structure, upgrade, special) of 20/30/25 * nominal industry output (without morale modifier) of the system.

When the build cost is larger than the limit the build task can be skipped on that system (even with plenty of credits for buying).

In the worst case this can lead to an extra turn idle AI system because of a task skip due to changed industry output now hitting one of the limits.


2.) If you want the AI to build special structures earlier try lower build costs and lower building IDs:
Gowron wrote: Thu May 01, 2008 4:57 pmAmong the buildings that are available for a system (and included in aibldreq.bin), the AI will build the building with the lowest ID first, working its way down the list.
- many special cases!

- AI shipyards in aibldreq.bin / bldset*.bin greatly help AI fleet buildup on higher starting levels, but at the same time can delay building of special structures on extra starting systems

- also keep in mind the AI code looks worse than a barker's egg. And no matter how hard you try, you can't polish such a thing....
(still no fix for AI builds unneeded main structures :mad: )
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: 7963
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: MP issue with Extending Edifbnft.bst (new building types/bonuses)

Post by thunderchero »

I did not have much time yesterday but did test patch 2 on vanilla and MUM without issues.

nice job. :grin:
Post Reply

Return to “General Modding Information/Questions”