Tech Level Bonus Factors

Tech Level Bonus Factors (+2%); support/discussion/questions

Moderator: thunderchero

User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 110
Joined: Thu Jul 10, 2008 2:00 am

Re: Tech Level Bonus Factors

Post by EnPhreg » Sat Oct 15, 2016 10:59 am

thanks for the link. but i think that won't help much. most probably the techid isn't implemented yet in vanilla botf. so it's useless to search for.
would it be possible to ask SCT to write also a code for industry like he already did for research and intel?
that way it seems the only way to me to make it possible to change the techid for industry as well.

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 5918
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Tech Level Bonus Factors

Post by thunderchero » Sat Oct 15, 2016 11:22 am

unfortunately, you are about 4 years to late for requesting new code change. :sad:

but I wish you luck

thunderchero

User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 110
Joined: Thu Jul 10, 2008 2:00 am

Re: Tech Level Bonus Factors

Post by EnPhreg » Sat Oct 15, 2016 1:36 pm

what do you mean?
has SCT no more interest in code changes anymore? :sad:

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 5918
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Tech Level Bonus Factors

Post by thunderchero » Sat Oct 15, 2016 3:08 pm

your guess is as good as mine, but he told me when he was doing his last bit of coding earlier this year it was only to complete some changes he wanted to ECM and once he was done, I did not hear from him again, and my last PM to him has gone unread.

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 5918
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Tech Level Bonus Factors

Post by thunderchero » Fri May 04, 2018 10:26 pm

Hi Everyone,

I noticed a small omission of code for energy bonus that caused "OUTPUT: value" to display red when energy levels were good. here is new code I had to add to my patch.

Code: Select all

004F562D E8 5E E4 F4 FF          call    sub_443A90 (bonusTotal__energy) 
004F5632 31 D2                   xor     edx, edx
004F5634 6A 00                   push    0 
with the addition of this code I had to move several offset calls so You would need to reset all value to vanilla code (0x000f492a - 0x000f4b5a) before applying this patch, and be sure to change all "XX" to proper value

This makes some major code changes to popups. This will display total tech bonus as you advance tech levels (same as vanilla), and added morale bonus for intel and enabled morale for industry and research (disabled in previous patch).

Code: Select all

NAME: Production Bonus Popup XX%
AUTHOR: thunderchero
DESC: This patch fixes popup for production values
DESC: patch file name: production_Bonus_Popup_XX%.patch
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?f=181&t=238&p=49015#p49015
TAG: enhancement
 
# >>  = vanilla/original value

# <<  = new value
 
>> 0x000f179c 74 72
>> 0x000f179f c0

<< 0x000f179c 6b c0
<< 0x000f179f 90

>> 0x000f492a 75 07 31 c0 66 89 44 24 10 8b 41 1a 31 d2 c1 f8 10 e8 50 
>> 0x000f493d e7 f4 ff 8b 81 a8 00
>> 0x000f4945 00 e8 f5 c3 04 00 e8 10 c8 01 00 31 c0 31 d2 a0 2a 2b 5a 00 e8 22 4b f4 ff 6a 00 8b 57 14 52 6a 00 8b 5d 04 53 50 31 c0 66 8b 47 1a 50 56 8b 74 24 30 56 8b 44 24 30 31 d2 50 8d 81 00 01 00 00 bb ff 7f 00 00 e8 91 cc ff ff b8 10 02 00 00 66 89 54 24 10 66 89 5c 24 12 e8 3d 5d f9 ff 8d 5c 24 10 89 c6 8b 41 1a ba 
>> 0x000f49ad 0d 00 00
>> 0x000f49b0 00 c1 f8 10 e8 b7 fc f4 ff 85 c0 75 07 31 c0 66 89 44 24 10 31 c0 ba 02 00 00 00 a0 2a 2b 5a 00 e8 ab 4a f4 ff 6a
>> 0x000f49d7 8b 57 2c 52 8b 54 24 20 31 db 66 8b 5a 06 53 8b 55 14 52 50 6a 00 56 8b
>> 0x000f49f1 30 53 8b 74 24 30 31 d2 56 8d 81 18 01 00 00 bb ff 7f
>> 0x000f4a05 e8 16 cc ff ff b8 17 01 00 00 66 89 54 24 10 66 89 5c 24 12 e8 c2 5c f9 ff 8d 5c 24 10 
>> 0x000f4a22 89 c6 8b 41 1a ba 02 00 00 00 c1 f8 10 e8 3c fc f4 ff 85 c0 75 07 31 c0 66 89 44 24 10 31 c0 ba 03 00 00 00 a0 2a 2b 5a 00 e8
>> 0x000f4a4d 4a f4 ff 89 c3 8b 41 1a 31 d2 c1 f8 10 e8 31 e4 f4
>> 0x000f4a5f 31 d2 6a 00 66 8b 57 1e 52 6a 00 8b 55 0c 52 53 50 56 8b 5c 24 30 53 8b 74 24 30 31 d2 56 8d 81 30 01
>> 0x000f4a82 00 bb ff 7f 00 00 e8 93 cb ff ff b8 24 02
>> 0x000f4a92 66 89 54 24 10 66 89 5c 24 12 e8 3f 5c 
>> 0x000f4a9f f9 ff 8d 5c 24 10 89 c6 8b 41 1a ba 0a 00 00 00 c1 f8 10 e8 b9 fb f4 ff 85 c0 75 07 31 c0 66 89 44 24 10 6a 00 8b 47 40 50 6a
>> 0x000f4aca 6a 00 6a 00 6a 00 56 8b 54 24 30 52 8b 5c 24 30 53 8d 81 48 01 00 00 e8 3a cb ff ff 31 d2 bb ff 7f 00 00 b8 e4 03 00 00 66 89 54 24 10 ba 07 00 00 00 66 89 5c 24 12 e8 da 5b f9 ff 89 c6 8b 41 1a 8d 5c 24 10 c1 f8 10 e8 59 fb 
>> 0x000f4b15 f4 ff 85 c0 75 07 31 c0 66 89 44 24 10 6a 01 8b 47 30
>> 0x000f4b28 54 24 1c
>> 0x000f4b2c 31 c0 66 8b 42 08 50 8b 55 1c 52 6a 00 6a 00 56 8b 5c 24 30 53 8b 74 24 30 56 8d 81 60 01 00 00 e8 cf ca ff ff 5b 5a 5e 5f 83 c4 0c 5d 59 c3


<< 0x000f492a 31 c0 ba 00 00 00 00 a0 2a 2b 5a 00 e8 45 4b f4 ff 6b c0 
# change XX to disired food bonus %
<< 0x000f493d XX 52 8b 57 14 52 6a
<< 0x000f4945 8b 5d 04 53 50 31 c0 66 8b 47 1a 50 56 8b 74 24 30 56 8b 44 24 30 31 d2 50 8d 81 00 01 00 00 bb ff 7f 00 00 e8 b2 cc ff ff b8 10 02 00 00 66 89 54 24 10 66 89 5c 24 12 e8 5e 5d f9 ff 8d 5c 24 10 89 c6 8b 41 1a ba 0d 00 00 00 c1 f8 10 e8 d8 fc f4 ff 85 c0 31 c0 ba 02 00 00 00 a0 2a 2b 5a 00 e8 d5 4a f4 ff 6b c0 
# change XX to disired industry bonus %
<< 0x000f49ad XX 6a 01
<< 0x000f49b0 8b 57 2c 52 8b 54 24 20 31 db 66 8b 5a 06 53 8b 55 14 52 50 6a 00 56 8b 5c 24 30 53 8b 74 24 30 31 d2 56 8d 81 18
<< 0x000f49d7 00 00 bb ff 7f 00 00 e8 3d cc ff ff b8 17 01 00 00 66 89 54 24 10 66 89
<< 0x000f49f1 12 e8 e9 5c f9 ff 8d 5c 24 10 89 c6 8b 41 1a ba 02 00
<< 0x000f4a05 c1 f8 10 e8 63 fc f4 ff 85 c0 31 c0 ba 03 00 00 00 a0 2a 2b 5a 00 e8 60 4a f4 ff 6b c0 
# change XX to disired energy bonus %
<< 0x000f4a22 XX 89 c3 8b 41 1a 31 d2 c1 f8 10 e8 5e e4 f4 ff 31 d2 6a 00 66 8b 57 1e 52 6a 00 8b 55 0c 52 53 50 56 8b 5c 24 30 53 8b 74 24
<< 0x000f4a4d 31 d2 56 8d 81 30 01 00 00 bb ff 7f 00 00 e8 c0 cb
<< 0x000f4a5f ff b8 24 02 00 00 66 89 54 24 10 66 89 5c 24 12 e8 6c 5c f9 ff 8d 5c 24 10 89 c6 8b 41 1a ba 0a 00 00
<< 0x000f4a82 c1 f8 10 e8 e6 fb f4 ff 85 c0 31 c0 ba 06
<< 0x000f4a92 00 a0 2a 2b 5a 00 e8 e3 49 f4 ff 6b c0 
# change XX to disired intel bonus %
<< 0x000f4a9f XX 6a 01 8b 57 40 52 8b 54 24 20 31 db 66 8b 5a 06 53 8b 55 5c 52 50 90 6a 00 56 8b 54 24 30 52 8b 5c 24 30 53 8d 81 48 01 00
<< 0x000f4aca e8 51 cb ff ff 31 d2 bb ff 7f 00 00 b8 e4 03 00 00 66 89 54 24 10 ba 07 00 00 00 66 89 5c 24 12 e8 f1 5b f9 ff 89 c6 8b 41 1a 8d 5c 24 10 c1 f8 10 e8 70 fb f4 ff 85 c0 31 c0 ba 06 00 00 00 a0 2a 2b 5a 00 e8 6d 49 f4 ff 6b c0 
# change XX to disired research bonus %
<< 0x000f4b15 XX 6a 01 8b 57 30 52 8b 54 24 20 31 db 66 8b 5a 06 53
<< 0x000f4b28 55 1c 52
<< 0x000f4b2c 90 6a 00 56 8b 5c 24 30 53 8b 74 24 30 56 8d 81 60 01 00 00 e8 db ca ff ff 5b 5a 5e 5f 83 c4 0c 5d 59 c3 00 00 00 00 00 00 00 00 00 00 00 00
You must replace "XX" for each bonus multiplier before adding
XX= bonus multiplier food, industry, energy, intel, research (in that order)
production_Bonus_Popup_XX%.patch
(4.35 KiB) Downloaded 16 times
bonus values for UCW 21% (15 hex) all tech types
bonus values for NBU 100% (64 hex) all tech types
bonus values for UM5 Food 30% (1E hex), industry 80% (50 hex), Energy 30% (1E hex), Intel 100% (64 hex), Research 50% (32 hex)

changes summary

Code: Select all

004F552A 31 C0                   xor     eax, eax
004F552C BA 00 00 00 00          mov     edx, 0 (type of tech required 0 = food)
004F5531 A0 2A 2B 5A 00          mov     al, ds:byte_5A2B2A (player empire)
004F5536 E8 45 4B F4 FF          call    sub_43A080 (Get race tech level)
004F553B 6B C0 XX                imul    eax, XXh (XX = food bonus multiplier)
004F553E 52                      push    edx   (morale switch not functional)
004F553F 8B 57 14                mov     edx, [edi+14h]
004F5542 52                      push    edx
004F5543 6A 00                   push    0
004F5545 8B 5D 04                mov     ebx, [ebp+4]
004F5548 53                      push    ebx
004F5549 50                      push    eax
004F554A 31 C0                   xor     eax, eax
004F554C 66 8B 47 1A             mov     ax, [edi+1Ah]
004F5550 50                      push    eax
004F5551 56                      push    esi
004F5552 8B 74 24 30             mov     esi, [esp+40h+var_10]
004F5556 56                      push    esi
004F5557 8B 44 24 30             mov     eax, [esp+44h+var_14]
004F555B 31 D2                   xor     edx, edx
004F555D 50                      push    eax
004F555E 8D 81 00 01 00 00       lea     eax, [ecx+100h]
004F5564 BB FF 7F 00 00          mov     ebx, 7FFFh
004F5569 E8 B2 CC FF FF          call    sub_4F2220
004F556E B8 10 02 00 00          mov     eax, 210h
004F5573 66 89 54 24 10          mov     word ptr [esp+24h+var_14], dx
004F5578 66 89 5C 24 12          mov     word ptr [esp+24h+var_14+2], bx
004F557D E8 5E 5D F9 FF          call    sub_48B2E0
004F5582 8D 5C 24 10             lea     ebx, [esp+24h+var_14]
004F5586 89 C6                   mov     esi, eax
004F5588 8B 41 1A                mov     eax, [ecx+1Ah]
004F558B BA 0D 00 00 00          mov     edx, 0Dh
004F5590 C1 F8 10                sar     eax, 10h
004F5593 E8 D8 FC F4 FF          call    sub_445270
004F5598 85 C0                   test    eax, eax
004F559A 31 C0                   xor     eax, eax
004F559C BA 02 00 00 00          mov     edx, 2 (type of tech required 2 = construction)
004F55A1 A0 2A 2B 5A 00          mov     al, ds:byte_5A2B2A (player empire)
004F55A6 E8 D5 4A F4 FF          call    sub_43A080 (Get race tech level)
004F55AB 6B C0 XX                imul    eax, XXh  (XX = industry bonus multiplier)
004F55AE 6A 01                   push    1  (morale switch)
004F55B0 8B 57 2C                mov     edx, [edi+2Ch]
004F55B3 52                      push    edx
004F55B4 8B 54 24 20             mov     edx, [esp+2Ch+var_C]
004F55B8 31 DB                   xor     ebx, ebx
004F55BA 66 8B 5A 06             mov     bx, [edx+6]
004F55BE 53                      push    ebx
004F55BF 8B 55 14                mov     edx, [ebp+14h]
004F55C2 52                      push    edx
004F55C3 50                      push    eax
004F55C4 6A 00                   push    0
004F55C6 56                      push    esi
004F55C7 8B 5C 24 30             mov     ebx, [esp+40h+var_10]
004F55CB 53                      push    ebx
004F55CC 8B 74 24 30             mov     esi, [esp+44h+var_14]
004F55D0 31 D2                   xor     edx, edx
004F55D2 56                      push    esi
004F55D3 8D 81 18 01 00 00       lea     eax, [ecx+118h]
004F55D9 BB FF 7F 00 00          mov     ebx, 7FFFh
004F55DE E8 3D CC FF FF          call    sub_4F2220
004F55E3 B8 17 01 00 00          mov     eax, 117h
004F55E8 66 89 54 24 10          mov     word ptr [esp+24h+var_14], dx
004F55ED 66 89 5C 24 12          mov     word ptr [esp+24h+var_14+2], bx
004F55F2 E8 E9 5C F9 FF          call    sub_48B2E0
004F55F7 8D 5C 24 10             lea     ebx, [esp+24h+var_14]
004F55FB 89 C6                   mov     esi, eax
004F55FD 8B 41 1A                mov     eax, [ecx+1Ah]
004F5600 BA 02 00 00 00          mov     edx, 2
004F5605 C1 F8 10                sar     eax, 10h
004F5608 E8 63 FC F4 FF          call    sub_445270
004F560D 85 C0                   test    eax, eax
004F560F 31 C0                   xor     eax, eax
004F5611 BA 03 00 00 00          mov     edx, 3 (type of tech required 3 = energy)
004F5616 A0 2A 2B 5A 00          mov     al, ds:byte_5A2B2A  (player empire)
004F561B E8 60 4A F4 FF          call    sub_43A080 (Get race tech level)
004F5620 6B C0 XX                imul    eax, XXh  (XX = energy bonus multiplier)
004F5623 89 C3                   mov     ebx, eax
004F5625 8B 41 1A                mov     eax, [ecx+1Ah]
004F5628 31 D2                   xor     edx, edx
004F562A C1 F8 10                sar     eax, 10h
004F562D E8 5E E4 F4 FF          call    sub_443A90 (bonusTotal__energy) 
004F5632 31 D2                   xor     edx, edx
004F5634 6A 00                   push    0
004F5636 66 8B 57 1E             mov     dx, [edi+1Eh]
004F563A 52                      push    edx
004F563B 6A 00                   push    0 (morale switch not functional)
004F563D 8B 55 0C                mov     edx, [ebp+0Ch]
004F5640 52                      push    edx
004F5641 53                      push    ebx
004F5642 50                      push    eax
004F5643 56                      push    esi
004F5644 8B 5C 24 30             mov     ebx, [esp+40h+var_10]
004F5648 53                      push    ebx
004F5649 8B 74 24 30             mov     esi, [esp+44h+var_14]
004F564D 31 D2                   xor     edx, edx
004F564F 56                      push    esi
004F5650 8D 81 30 01 00 00       lea     eax, [ecx+130h]
004F5656 BB FF 7F 00 00          mov     ebx, 7FFFh
004F565B E8 C0 CB FF FF          call    sub_4F2220
004F5660 B8 24 02 00 00          mov     eax, 224h
004F5665 66 89 54 24 10          mov     word ptr [esp+24h+var_14], dx
004F566A 66 89 5C 24 12          mov     word ptr [esp+24h+var_14+2], bx
004F566F E8 6C 5C F9 FF          call    sub_48B2E0
004F5674 8D 5C 24 10             lea     ebx, [esp+24h+var_14]
004F5678 89 C6                   mov     esi, eax
004F567A 8B 41 1A                mov     eax, [ecx+1Ah]
004F567D BA 0A 00 00 00          mov     edx, 0Ah
004F5682 C1 F8 10                sar     eax, 10h
004F5685 E8 E6 FB F4 FF          call    sub_445270
004F568A 85 C0                   test    eax, eax
004F568C 31 C0                   xor     eax, eax
004F568E BA 06 00 00 00          mov     edx, 6 (type of tech required 6 = all)
004F5693 A0 2A 2B 5A 00          mov     al, ds:byte_5A2B2A (player empire)
004F5698 E8 E3 49 F4 FF          call    sub_43A080 (Get race tech level)
004F569D 6B C0 15                imul    eax, 15hXXh (XX = intel bonus multiplier)
004F56A0 6A 01                   push    1 (morale switch)
004F56A2 8B 57 40                mov     edx, [edi+40h]
004F56A5 52                      push    edx
004F56A6 8B 54 24 20             mov     edx, [esp+2Ch+var_C]
004F56AA 31 DB                   xor     ebx, ebx
004F56AC 66 8B 5A 06             mov     bx, [edx+6]
004F56B0 53                      push    ebx
004F56B1 8B 55 5C                mov     edx, [ebp+5Ch]
004F56B4 52                      push    edx
004F56B5 50                      push    eax
004F56B6 90                      nop
004F56B7 6A 00                   push    0
004F56B9 56                      push    esi
004F56BA 8B 54 24 30             mov     edx, [esp+40h+var_10]
004F56BE 52                      push    edx
004F56BF 8B 5C 24 30             mov     ebx, [esp+44h+var_14]
004F56C3 53                      push    ebx
004F56C4 8D 81 48 01 00 00       lea     eax, [ecx+148h]
004F56CA E8 51 CB FF FF          call    sub_4F2220
004F56CF 31 D2                   xor     edx, edx
004F56D1 BB FF 7F 00 00          mov     ebx, 7FFFh
004F56D6 B8 E4 03 00 00          mov     eax, 3E4h
004F56DB 66 89 54 24 10          mov     word ptr [esp+24h+var_14], dx
004F56E0 BA 07 00 00 00          mov     edx, 7
004F56E5 66 89 5C 24 12          mov     word ptr [esp+24h+var_14+2], bx
004F56EA E8 F1 5B F9 FF          call    sub_48B2E0
004F56EF 89 C6                   mov     esi, eax
004F56F1 8B 41 1A                mov     eax, [ecx+1Ah]
004F56F4 8D 5C 24 10             lea     ebx, [esp+24h+var_14]
004F56F8 C1 F8 10                sar     eax, 10h
004F56FB E8 70 FB F4 FF          call    sub_445270
004F5700 85 C0                   test    eax, eax
004F5702 31 C0                   xor     eax, eax
004F5704 BA 06 00 00 00          mov     edx, 6 (type of tech required 6 = all)
004F5709 A0 2A 2B 5A 00          mov     al, ds:byte_5A2B2A (player empire)
004F570E E8 6D 49 F4 FF          call    sub_43A080 (Get race tech level)
004F5713 6B C0 XX                imul    eax, XXh  (XX = research bonus multiplier)
004F5716 6A 01                   push    1  (morale switch)
004F5718 8B 57 30                mov     edx, [edi+30h]
004F571B 52                      push    edx
004F571C 8B 54 24 20             mov     edx, [esp+2Ch+var_C]
004F5720 31 DB                   xor     ebx, ebx
004F5722 66 8B 5A 06             mov     bx, [edx+6]
004F5726 53                      push    ebx
004F5727 8B 55 1C                mov     edx, [ebp+1Ch]
004F572A 52                      push    edx
004F572B 50                      push    eax
004F572C 90                      nop
004F572D 6A 00                   push    0
004F572F 56                      push    esi
004F5730 8B 5C 24 30             mov     ebx, [esp+40h+var_10]
004F5734 53                      push    ebx
004F5735 8B 74 24 30             mov     esi, [esp+44h+var_14]
004F5739 56                      push    esi
004F573A 8D 81 60 01 00 00       lea     eax, [ecx+160h]
004F5740 E8 DB CA FF FF          call    sub_4F2220
004F5745 5B                      pop     ebx
004F5746 5A                      pop     edx
004F5747 5E                      pop     esi
004F5748 5F                      pop     edi
004F5749 83 C4 0C                add     esp, 0Ch
004F574C 5D                      pop     ebp
004F574D 59                      pop     ecx
004F574E C3                      retn
Also Spocks-cuddly-tribble gave me code for this fix
Spocks-cuddly-tribble wrote:
Wed Jul 18, 2012 11:15 am
-Update-

Some code mirrors for AI building behavior, the auto-build feature & a food/energy deficit warning?:

Code: Select all

tech level bonus factors for:

0044182F                 add     eax, eax // industry (AI output check, ignores morale)
00442088                 add     eax, eax // food
00442F5F                 add     eax, eax // energy
00443B30                 add     ecx, ecx // energy
00443DCA                 add     eax, eax // food

Code: Select all

AUTO:0044182A                 and     eax, 0FFFFh
AUTO:0044182F                 add     eax, eax
-> set
CWDE
nop x3
IMUL EAX, EAX, 2  // -> % bonus per tech level

at 0x40C2A -> 98 90 90 90 6B C0 02 (last byte is industry % bonus per tech level)


AUTO:00442080                 and     eax, 0FFFFh
AUTO:00442085                 mov     ecx, [edx+4]
AUTO:00442088                 add     eax, eax
-> set
CWDE
mov     ecx, [edx+4]
nop x3
IMUL EAX, EAX, 2  // -> % bonus per tech level

at 0x41480 -> 98 8B 4A 04 90 90 90 6B C0 02 (last byte is food % bonus per tech level)


AUTO:00442F5A                 and     eax, 0FFFFh
AUTO:00442F5F                 add     eax, eax
-> set
CWDE
nop x3
IMUL EAX, EAX, 2  // -> % bonus per tech level

at 0x4235A -> 98 90 90 90 6B C0 02 (last byte is energy % bonus per tech level)


AUTO:00443B2A                 mov     cx, bx
AUTO:00443B2D                 mov     ebx, [eax+0Ch]
AUTO:00443B30                 add     ecx, ecx
-> set
mov     cl, bl
mov     ebx, [eax+0Ch]
IMUL ECX, ECX, 2  // -> % bonus per tech level

at 0x42F2A -> 88 D9 8B 58 0C 6B C9 02 (last byte is energy % bonus per tech level)


AUTO:00443DC4                 mov     ax, cx
AUTO:00443DC7                 mov     ecx, [edx+4]
AUTO:00443DCA                 add     eax, eax
-> set
mov     al, cl
mov     ecx, [edx+4]
IMUL EAX, EAX, 2  // -> % bonus per tech level

at 0x431C4 -> 88 C8 8B 4A 04 6B C0 02 (last byte is food % bonus per tech level)
production_food_energy_deficit_warning_XX%.patch
(1.1 KiB) Downloaded 21 times
thunderchero

User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 110
Joined: Thu Jul 10, 2008 2:00 am

Re: Tech Level Bonus Factors

Post by EnPhreg » Sun Sep 30, 2018 8:48 am

Spocks-cuddly-tribble wrote:
Tue Dec 13, 2011 6:52 pm
:arrow: Research Tech Bonus (default +2% * lowest tech level aka all tech req.)

Note: Code includes the % research (local) fix. Do not use research fix from below link with this!
viewtopic.php?p=32983&sid=14927df04445f ... 1b8#p32983

Code: Select all

trek.exe at 0x40A78-0x40AD2 new code 0x5B bytes:

8B 43 4C B2 06 E8 FE 89 FF FF 6B C0 02 6B D6 58 8D 8C 1A 40 02 00 00 90 90 90 90 8D 14 B5 00 00 00 00 29 F2 81 C3 C0 00 00 00 C1 E2 06 01 D3 83 79 50 01 75 0F C7 41 30 00 00 00 00 83 C4 0C 5D 5E 59 5B C3 0F B7 71 44 03 73 1C 8D 44 30 9C 89 04 24 DD 05 94 89 57 00 DB 04 24

code changes:

00441678     8B43 4C           MOV EAX, [EBX+4C]  // system owner ID
0044167B     B2 06             MOV DL, 6  // tech ID for bonus, 6= all techs
0044167D     E8 FE89FFFF       CALL 43A080  // get race tech level
00441682     6BC0 02           IMUL EAX, EAX, 2  // -> % bonus per tech level 
00441685     6BD6 58           IMUL EDX, ESI, 58
00441688     8D8C1A 40020000   LEA ECX, [EDX+EBX+240]
0044168F     90909090          NOP

004416BC     0FB771 44         MOVZX ESI,WORD [ECX+44]  // system morale
004416C0     0373 1C           ADD ESI, [EBX+1C]  // local system bonus %
004416C3     8D4430 9C         LEA EAX, [EAX+ESI-64]
004416C7     890424            MOV [ESP], EAX
004416CA     DD05 94895700     FLD QWORD [578994]
004416D0     DB0424            FILD DWORD [ESP]
greetings,
i'm back after a one year abstinence to finish my mod (a conversion of BoP (with gowrons blessing) and all the error corrections and many improvements - in some reasons, the mod will be a counterpart to some basic ideas of BoP - so it's not only a unification)
this code for research bonus is quite useful, but would it be possible to change the bonus to an increasing one?
so, for example, at tech level 1 you'll get 5% bonus and at level 2 10% and level 3 15%, all bonuses additional, so at level 3 you have 30% tech bonus overall. maybe at line 00441682 it could be possible to altering the code to change the behaviour of the bonus calculation?
i know about the structured modding index, but i haven't the time to get familiar with this tons of information, cause the implementation of all the new stuff and the sheer mass of balancing work consuming to much time anyway. so anyone have a useful idea?

User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 709
Joined: Sun Apr 27, 2008 2:00 am

Re: Tech Level Bonus Factors

Post by Spocks-cuddly-tribble » Sun Sep 30, 2018 11:20 am

I highly doubt that there are currently volunteers for suchlike asm modifications, but if Gowron gave you permission to alter BoP, you might counter and give him permission to return for intricate coding tasks. :wink: :wink:

However, here are the Industry tech IDs, you asked for above:

Code: Select all

Industry tech IDs

AUTO:00461AF1                 mov     si, [eax+14h]   ; construction tech // Preview

AUTO:00461FD8                 mov     si, [eax+14h]   ; Construction tech // Effective

AUTO:00441826                 mov     ax, [eax+14h]   ; construction tech // AI check
Instructions how to calculate the tech IDs:

viewtopic.php?f=278&t=2937
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 110
Joined: Thu Jul 10, 2008 2:00 am

Re: Tech Level Bonus Factors

Post by EnPhreg » Tue Oct 02, 2018 2:55 pm

Spocks-cuddly-tribble wrote:
Sun Sep 30, 2018 11:20 am
I highly doubt that there are currently volunteers for suchlike asm modifications, but if Gowron gave you permission to alter BoP, you might counter and give him permission to return for intricate coding tasks. :wink: :wink:
yes, i also thought about that option.
but it's long ago since my last mail.
so before i will ask him to waste his time on coding,
i want to show for what, but the mod needs some more action to get beta ready.
but yes, if nobody else, i will ask him.

thanks very much for the IDs.

User avatar
EnPhreg
Lieutenant-Commander
Lieutenant-Commander
Posts: 110
Joined: Thu Jul 10, 2008 2:00 am

Re: Tech Level Bonus Factors

Post by EnPhreg » Mon Nov 12, 2018 3:05 pm

thunderchero wrote:
Fri May 04, 2018 10:26 pm
I noticed a small omission of code for energy bonus that caused "OUTPUT: value" to display red when energy levels were good. here is new code I had to add to my patch.

Code: Select all

004F562D E8 5E E4 F4 FF          call    sub_443A90 (bonusTotal__energy) 
004F5632 31 D2                   xor     edx, edx
004F5634 6A 00                   push    0 
hi thunder,
i have a problem setting the tech level for biology and energy to zero.
if i do, and i'm founding a colony or acquire a minor and try to enter the system screen, i'm getting a CTD and the changelog says:
File: ../../source/game/solarapi.c, Line: 2026, bonusTotal != 0 (if biology 0)
File: ../../source/game/solarapi.c, Line: 2126, bonusTotal != 0 (if energy 0)

i think it has to do with the system bonus (food & energy), but i don't know in which way.
the tech level for food and energy can't be zero cause of the system bonus, but why!?
i found this bonusTotal in your post.
so, do you know why/how the tech level and the system bonus are connected?
is there a way to fix this or isn't it possible to set all tech fields to zero?

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 5918
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Tech Level Bonus Factors

Post by thunderchero » Mon Nov 12, 2018 5:00 pm

Hi EnPhreg,

first, the code you referenced is only for production screen "popups" and only uses the values already in memory. The calculations are done in other sub-sections.

as for your CTD issue it sounds like a mathematical problem example;

0 (tech level) x 5 (main structure bonus) x 0.75 (system bonus) = 0

so without redesigning calculation process I doubt it could be fixed.

IIRC Tethys also had a similar request when he was working on Galaxy mod (to be able to use/start with tech level 0).

Post Reply

Return to “Tech Level Bonus Factors (+2%)”

Who is online

Users browsing this forum: No registered users