Gifts to Minor Races: Amounts and Effects

Gifts to Minor Races: Amounts and Effects + major race gifts, offers & demands !; support/discussion/questions

Moderator: thunderchero

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

Gifts to Minor Races: Amounts and Effects

Post by thunderchero »

Credit for this post topic; Gowron

As DCER found out, there's an area in trek.exe, starting at position 0x174948, that controls these mechanics.

As usual, I divide the post into several sections. The positions of the individual values in trek.exe will be listed in the last section. I'll also include a section with some hints for modders.



1. The influence of Tech Levels

As you most probably know, minor races advance by "jumps", gaining better technology levels. These tech levels have an influence on both the number of credits you can give to them and the effect that your gift will have.

Note that a minor race that joins an empire will still have its own advancement level. It will also advance further, but you can't see it on the F1 screen, because its population and ground combat values are now determined by the controlling empire. But its own tech levels will still be used for gift/bribe calculations (amount and effect). If the minor race leaves the empire, then its new evolution level can be much higher than at the point where it joined the empire, because it silently advanced in the meantime.

To evaluate their technology, add all their current single tech levels for each tech area (biotech, energy tech...), including "sociology" (7 areas in total) and multiply it by the [techfactor]. The [techfactor] for amounts can be different from the [techfactor] for effects. (see last section)

If the result is less than 4.0, then the minor race is considered to be at low tech.
If the result is equal to or more than 8.0, then the minor race is considered to be at high tech.


Example:

Tech levels: 3, 4, 5, 6, 3, 4, 3
[techfactor]: 1/7

Evaluation:
1/7 * (3 + 4 + 5 + 6 + 3 + 4 +3) = 4.0

=> The minor race is neither at low tech nor at high tech.



2. The amounts of money you can give them

For the locations and default values of all the variables, see last section.

The base amount for a gift is 1000 credits.

This base amount is modified as follows:

If the race is at low tech, multiply by [low2].

If the race is at high tech, multiply by [high2].

If the race's personality is "warlike" or "peaceful", multiply by [high2].

If the race's personality is "pacifist" or "deceptive", multiply by [low2].

If the race is a member of another major empire, multiply by [emp2]. (see update below)

If you are the Federation, multiply by [fed2].

After that, if they have an active "bribe resistancy" building, add the output amount of that building (500 credits for the default Communication Grid). This value is only added once, even if you are giving a "multiple" gift (i.e. you press the button that doubles/triples/etc. your gift).



3. The effect of gifts

Two turns after you submit your gift, the attitude of the respective minor race towards you will rise. Also, if the minor race is a member of another major empire, its attitude towards that empire will decrease.

The effect is directly proportional to the amount of money you've given them. The base effect for the attitude increase towards you is 4% of the attitude bar per 1000 credits.
So if the attitude bar is completely dark, you'd have to give them 25000 credits to increase it to the maximum.

If you are giving the gift to a minor race that is a member of another empire, then the base effect for the attitude decrease towards that empire is approximately 2% of the attitude bar per 1000 credits. Note that their attutude towards that empire will also recover by about 5% of the attitude bar per turn, so if you want to bribe them, give them large gifts quickly and not small gifts over a long time.

These base values are modified as follows:

If the race is at low tech, multiply by [low1].

If the race is at high tech, multiply by [high1].

If the race's personality is "warlike" or "peaceful", multiply by [high1].

If the race's personality is "pacifist" or "deceptive", multiply by [low1].

If the race is a member of another major empire, multiply by [emp1]. (see update below)

If you are the Federation, multiply by [fed1].



4. Gifts from AI players

AI players always give half of the amounts that a human player would be giving (including all the modifications of section 2, except for "bribe resistancy", for which the AI players will fully pay). I don't know if they get any bonus or penalty on the effect.



5. Why you should scrap your Communication Grids NOW

The Grid is supposed to make it harder to bribe your members. But does it really help you? Let's look at what it does. It increases the amounts of money other races can give to your members. On the other hand, the effects of their gifts are directly proportional to these amounts. So the Grid in fact makes it easier to steal your member races.

See the next section for hints how to fix that.



6. Important hints for modding


a) NEVER let gift amounts be negative

Simple but important. Negative amounts won't crash the game, but bad things happen if you give negative gifts, i.e. your treasury will experience a shift and you'll find yourself with a total of minus 2 billion credits or so (this is not exaggerated, I've seen worse results). Just keep all the values positive and be very careful with negative "bribe resistancy" building outputs.


b) Changing amounts and adjusting effects

Since effects depend on amounts, if you want to change an amount without changing the effect, you'll have to change the corresponding effect value accordingly.

Examples that won't change the "effect per gift" relation:
multiply [high2] by 2 and divide [high1] by 2

divide [fed2] by 1.5 and multiply [fed1] by 1.5


c) Fixing the Communication Grid

In order to make it harder to bribe member races, the Communication Grid must actually give a negative "bribe resistancy", since only lower amounts will mean lower effects. Be careful, since AI empires only pay half of the normal gift amounts, but they fully pay the "bribe resistancy", so if you might end up with the AI giving negative gifts (with bad consequences).



7. Names, locations and default values for all variables


All values are 8 bytes in size (double precision floating-point values).


[techfactor] for gift effects
starting position: 0x174948
default value: 1/7

[fed1]
starting position: 0x174950
default value: 1.5

[high1]
starting position: 0x174958
default value: 0.75

[low1]
starting position: 0x174960
default value: 1.25

[emp1]
starting position: 0x174968
default value: 0.5

[techfactor] for gift amounts
starting position: 0x174970
default value: 1/7

[fed2]
starting position: 0x174978
default value: 0.5

[high2]
starting position: 0x174980
default value: 1.33

[low2]
starting position: 0x174988
default value: 0.8

[emp2]
starting position: 0x174990
default value: 2.0


Note: There's one more value at 0x174998 (default: 1/7), but I didn't mention any difference when I changed this. Maybe it's not used.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

UPDATE:

a. Base Amount Calculation

The base amount for gifts is computed via this code segment:

Code: Select all

-OFFSET-    ---HEX CODE---     -----------ASM CODE-----------

0x006BEF    8D04AD00000000     lea eax, dword[4*ebp+00000000]  // eax ==  4*ebp
0x006BF6    29E8               sub eax, ebp                    // eax ==  3*ebp
0x006BF8    C1E003             shl eax, 03                     // eax == 24*ebp
0x006BFB    01E8               add eax, ebp                    // eax == 25*ebp
This sets eax to 25 times the value of ebp, whose value is 40*n, with n being an integer between 1 and 5 which determines the size of the gift.

Default base amounts:

Code: Select all

n  ebp   eax
1   40  1000   // minimum gift, 1000 credits
2   80  2000
3  120  3000
4  160  4000
5  200  5000   // maximum gift, 5000 credits
Since the default code uses up quite some space, and since the same calculation can be writte in a much shorter way (using a multiplication by 25), there's much room for customized formulas :)



b. Correction about [emp1] and [emp2]

After checking the assembler code, I noticed that both "pacifist" and "deceptive" minors IGNORE the [emp1] and [emp2] values. "Spiritual" minors also IGNORE [emp1] and [emp2], but it seems that the [high1] and [high2] values can be applied for these minors under some conditions that I wasn't able to determine.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

Gowron wrote:"Spiritual" minors also IGNORE [emp1] and [emp2], but it seems that the [high1] and [high2] values can be applied for these minors under some conditions that I wasn't able to determine.
It seems (and is reasoned) that "spiritual" minors do apply the [high1] & [high2] values instead of the [emp1] & [emp2] values.

This explains the scale of prices: (more allegiance = costlier)

cheap: "pacifist" & "deceptive"

medium: "spiritual"

expensive: "warlike" & "peaceful"


Edit: Is it possible to influence the Communication Grid in order to lower the effect of gifts as by [emp1]or[high1]?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Update:

At position 407B75, there's a 4-byte integer value which acts as a divisor for the effects of gifts to minor races. So if you, for example, double that number, all gift effects will be halved.

Default value: 25
Last edited by Gowron on Sun Jul 26, 2009 6:28 am, edited 1 time in total.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Thanks Gowron, :wink:

this will make getting a minor as a member not as easy :twisted:

any max on this? already tested value of 100
value 25
5 turns max gift and could member on turn 7
value 100
18 turns max gift and could member on turn 20

thunderchero
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

thunderchero wrote:any max on this?
Anything that fits into 4 bytes would probably be accepted by the game, but remember this is an integer, so integer division is used. Any remainders are discarded. If you divide 1000 by 1001, you get 0 ;)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

For better clearness, I'll put every gift/offer/demand info into this thread (dislike tons of separated topics^^).

Gowron wrote:a. Base Amount Calculation

...whose value is 40*n, with n being an integer between 1 and 5 which determines the size of the gift.
For players the value [size*40] is read from sub_4C7E48. It's also used for player gifts/offers to empires (Presumably the AI size value is determined by sub_4306A0).

EDIT:

According to F-11 info the AI gift size value for minors is:

Code: Select all

411C19    mov  ecx, 14h


Amounts of (player)gifts/ offers to Majors

Code: Select all

sub_4106C0(empire_gift_offer_calculation)

41070F     fild    dword ptr [esp+10h] (for player from sub_4C7E48)
410713     fmul    ds:576F4C (0.25)
410719     fld     qword ptr [esp] (Income [EmpsInfo+9Ch] min 50) 
41071C     fmul    ds:576F54 (0.05)
410722     fmul    st, st(1)
410724     fmulp   st(1), st
minimum gift/offer to empires (player/unmodded):

[40*0.25 = 10] * [50*0.05 = 2.5] * [40*0.25 = 10] = 250




Amounts of (player) demands to Majors

The values are explicitely stored in sub_4C7E98.


There's another identical table in sub_4C7DA8(Gift_Offer_Size_Player) at 4C7D90, maybe unused or for player vs. player gifts/offer/demands in multi-player?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Maximum Amounts for AI Gifts, Offers & Demands to Majors

Post by Spocks-cuddly-tribble »

And here come the maximum amounts for AI gifts, offers & demands to majors. (offers have been reported as a serious issue in BoP)



-> The default calculation for AI gifts, offers & demands is always the same:

( [size value * 0.25] ^2 ) * [Income * 0.05]

But due to different code locations, it can be modded independently of each other.


-> Result of the calculation is always a maximum value! - (also for gifts to minors)

Unlike players the AI isn't forced to minimum amounts (i.e. can skip/lower if insufficient credits, sympathy... random?)


-> The AI behavior is controlled via tons of empire-specific data fields (4 byte floats). The mechanics are not complicated, but IMHO the sheer masses of needed code changes/analysis foils significant alterations of AI behavior in this area. So I'll stick with how to mod the max amounts of credits.




:arrow: 1. Amounts of AI Gifts to Majors (mainly /only? AI to AI traffic)


AI gift size value to empires:

Code: Select all

4122B4    mov   ecx, 28h
In this case the AI shares the code with players i.e. sub_4106C0.

See above: 'Amounts of (player)gifts/ offers to Majors'



Some unknown size values connected with sub_4306A0 (AI_Gifts_minor_AI-major)

Code: Select all

411E5C                 mov     ebx, 28h
411E8C                 mov     ecx, 0A0h

411256                 mov     ecx, 0A0h
411260                 xor     ebx, ebx     //   = 0
Maybe for war-pacts, some priority minor bribing or just unused.




:arrow: 2. Amounts of AI Offers to Majors


AI offer size values:

Code: Select all

Current relationship to the offeree:


With some Treaty / unclear - (sub_432580)

0 / 25 turns
432685                 mov     dword ptr [ecx], 0

4326B8                 mov     dword ptr [ecx], 28h
4326E0                 mov     dword ptr [ecx], 28h

100 turns & unlimited
4326FB                 mov     dword ptr [ecx], 28h

50 turns
432742                 mov     dword ptr [ecx], 28h

100 turns & unlimited
432753                 mov     dword ptr [ecx], 50h

432723                 mov     dword ptr [ecx], 0A0h
43276E                 mov     dword ptr [ecx], 0A0h


Neutral - (sub_432160):

43225A         mov     dword ptr [edi], 28h


War - (sub_432820):

25 turns
4328F8                 mov     dword ptr [ecx], 28h
432964                 mov     dword ptr [ecx], 28h
4329B5                 mov     dword ptr [ecx], 28h
432A29                 mov     dword ptr [ecx], 28h

50 turns
432905                 mov     dword ptr [ecx], 50h
432981                 mov     dword ptr [ecx], 50h

100 turns & unlimited
4328DB                 mov     dword ptr [ecx], 0A0h
Note altering might be behavior-modifying (i.e. 'confuse' the AI) w.r.t. the contested territory vs. credits issue!

This can be prevented via this static bypass option:

Code: Select all

413168      mov     edx, [esp+4BCh] // load offer size value for credits calculation
at 0x12568  replace: 8B 94 24 BC 04 with: 90 90 BA XX 00 (= always offer size XX)
To be consistent, the size value 40 would be recommended: 90 90 BA 28 00

Code: Select all

sub_412F20 (AI_Offer_calculation)

-> skipped if 'per turn'

4131AB         fild    dword ptr [esp+4A4h] (size value)
4131B2         fmul    ds:dbl_576EEC  (0.25)
4131B8         fld     qword ptr [esp+47Ch] (Income [EmpsInfo+9Ch] min 50)
4131BF         fmul    ds:dbl_576EF4  (0.05)
4131C5         fmul    st, st(1)
4131C7         fmulp   st(1), st



:arrow: 3. Amounts of AI Demands to Majors

Code: Select all

AI demand size value: (always)

4123A8          mov     edi, 28h


sub_412330 (AI_Demand_calculation)

4123E9         fild    dword ptr [esp+484h] (size value)
4123F0         fmul    ds:dbl_576F04  (0.25)
4123F6         fld     qword ptr [esp+47Ch] (Income [EmpsInfo+9Ch] min 50)
4123FD         fmul    ds:dbl_576F0C  (0.05)
412403         fmul    st, st(1)
412405         fmulp   st(1), st
Note: this once the income of the own i.e. demanding empire.

---

:arrow: The min interval delay for AI demands is a sought-after 'fix'. :idea: (0x188CEE default 0x12 / 18 dec turns)

Plus we can change the AI demand calculation (use the income of the target empire as base) for a better player experience, so it's more endurable in vanilla low tech games playing a poor empire. Albeit, for balance reasons the default might be better, since this infuences AI bidding-wars for allies?

NAME: AI Demand Calculation based on the Income of the Target Empire
DESC: Vanilla default calculation is based on the income of the own i.e. demanding empire.
AUTHOR: Spocks-cuddly-tribble
URL: viewtopic.php?p=24148#p24148

>> 0x00011787 66 8b 56 08 8d 04 d5 00 00 00 00
<< 0x00011787 8a 94 24 8c 04 00 00 6b c2 08 90

#00412387     8A9424 8C040000    MOV DL,BYTE PTR SS:[ESP+48C]
#0041238E     6BC2 08            IMUL EAX,EDX,8
#00412391     90                 NOP
Last edited by Spocks-cuddly-tribble on Mon Nov 06, 2023 10:05 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
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Re: Gifts to Minor Races: Amounts and Effects

Post by Spocks-cuddly-tribble »

Gowron wrote:5. Why you should scrap your Communication Grids NOW

The Grid is supposed to make it harder to bribe your members. But does it really help you? Let's look at what it does. It increases the amounts of money other races can give to your members. On the other hand, the effects of their gifts are directly proportional to these amounts. So the Grid in fact makes it easier to steal your member races.
:arrow: Communication Grid Bug (fix):

Code: Select all

trek.exe at 0x6F6E
replace:
0F 8F 0C 01 00 00
with:
7C 02 8B C5 2B E8


407B6E    7C 02     JL SHORT 407B72 // if bribe resistance greater than gift amount...
407B70    8BC5      MOV EAX, EBP // ...then set bribe resistance = gift amount
407B72    2BE8      SUB EBP, EAX // neutralise gift effect of communication grid penalty

Gowron wrote:3. The effect of gifts

These base values are modified as follows:

If the race is at low tech, multiply by [low1].

If the race is at high tech, multiply by [high1].

If the race's personality is "warlike" or "peaceful", multiply by [high1].

If the race's personality is "pacifist" or "deceptive", multiply by [low1].

If the race is a member of another major empire, multiply by [emp1]. (see update below)

If you are the Federation, multiply by [fed1].


At position 407B75, there's a 4-byte integer value which acts as a divisor for the effects of gifts to minor races. So if you, for example, double that number, all gift effects will be halved.

Default value: 25
Result of sub_407A94 (GiftEffectsMinor) is sometimes multiplied by ds:577050... (4 times 8 byte floats -> 1.25 each) before added to the attitude level (range 0-1000, see sub_405930) ?


Note that sub_407A94 is also used for effects of trade routes - see Trade Route Outputs.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
xDx
Commander
Commander
Posts: 299
Joined: Sat May 10, 2008 2:00 am
Location: East Coast, USA

Re: Gifts to Minor Races: Amounts and Effects

Post by xDx »

I apologize for bringing up this subject if it has been covered already since major empire attitudes to each other cannot seem to be adjusted as of yet. Can the effects of gifts be altered to affect specific empires more or less. For example using UDM races, Cardassians give a gift to the Federation and the same amount to Dominion; the gift to the Dominion would be more effective due to code adjustments. For the purpose of making it easier, if this was the easier route, it doesn't matter if the Cards are AI or player controlled and Feds and Dom are AI or player controlled. OR....

Spocks-cuddly-tribble wrote:
-> The AI behavior (trigger situations/frequencies) is controlled via tons of empire-specific data fields (4 byte floats). The mechanics are not complicated, but IMHO the sheer masses of needed code changes/analysis foils significant alterations of AI behavior in this area. So I'll stick with how to mod the max amounts of credits.
Is this what I'm looking for and the amount of code needed to change is still incognito somewhere in trek.exe? Also if I read this right, AI gift giving is determined mainly by empire strength indicator so if the above is not possible can the base value that determines the indicator be adjusted for specific empires? I hope I worded all this the right way. :?

Spocks-cuddly-tribble wrote:The empire strength indicator [EmpsInfo+9Ch] has been identified as the empire's income (before AI bonuses and support costs).

Also have a look at the "Economic and Military Score" topic. :wink:
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1883
Joined: Sun Apr 27, 2008 2:00 am

Bribe Resistance Fix (advanced)

Post by Spocks-cuddly-tribble »

Here is the first prototype of a building bonus with an altered functionality. :)

Aside from the above-named bug the AI-crippling problem with the default setup is:
Gowron wrote:"bribe resistancy"....the output amount of that building (500 credits for the default Communication Grid)....is only added once, even if you are giving a "multiple" gift (i.e. you press the button that doubles/triples/etc. your gift).
:arrow: Bribe Resistance Fix (advanced)

1.) In edifbnft.bst change "bribe resistance" to "% bribe resistance" (just cosmetics).

2.) In edifice.bst change the output value of the communication grid from 500 to (for example) 30% i.e. effect of gifts is reduced to 70%. Needless to say the max value is 100% bribe resistance.

3.) In trek.exe change code at the following 4 locations:

Code: Select all

at 0x6C80 change 75 -> EB

at 0x6F14 new code 0x16 bytes:

D8 33 C0 83 7B 3C 02 75 52 31 C9 8A 4C 24 34 83 7C 8B 28 03 74 45

at 0x6F6C new code 0x1E bytes:

83 E0 7F BA 64 00 00 00 2B D0 0F AF EA 89 6C 24 2C DB 44 24 2C DC 0D A8 7D 40 00 90 90 90

and at 0x71A8 (8 zero bytes) -> 2D 43 1C EB E2 36 3A 3F

asm changes:

00407880     EB 5F           JMP SHORT 4078E1 // skip amount increase due to defense value

00407B13     8BD8           MOV EBX, EAX
00407B15     33C0           XOR EAX, EAX
00407B17     837B 3C 02     CMP DWORD [EBX+3C], 2
00407B1B     75 52          JNZ SHORT 407B6F

00407B23     837C8B 28 03   CMP DWORD [EBX+ECX*4+28], 3
00407B28     74 45          JE SHORT 407B6F

00407B6C   83E0 7F          AND EAX, 7F   // sign safeguard
00407B6F   BA 64000000      MOV EDX, 64  // base level 100%
00407B74   2BD0             SUB EDX, EAX   // - % defense level = remaining effect %
00407B76   0FAFEA           IMUL EBP, EDX  // value * %
00407B79   896C24 2C        MOV [ESP+2C], EBP
00407B7D   DB4424 2C        FILD DWORD [ESP+2C]
00407B81   DC0D A87D4000    FMUL QWORD [407DA8]   // * 0.0004
00407B87   909090           NOP

00407DA8     8 byte float 0.0004
The multiplier is 0.0004 (0.01 / 25) due to the skipped default effect divisor (25 see above) :!:

Thus e.g. to get a divisor effect of 50 the float value must be 0.0002 (0.01 / 50) :idea:
Last edited by Spocks-cuddly-tribble on Sun May 08, 2022 12:57 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
xDx
Commander
Commander
Posts: 299
Joined: Sat May 10, 2008 2:00 am
Location: East Coast, USA

Re: Gifts to Minor Races: Amounts and Effects

Post by xDx »

Hmm an interesting idea.... I like the idea of a percent value instead of a set value. It seems that if you mod the divisor at position 407B75 to an integer higher than vanilla 25 and use this prototype fix would impact the the bribing of minors more than with a set amount? Not sure though, I will test in the near future and see if it does :) Great work.... another thing for me to tinker with.
Spocks-cuddly-tribble wrote:Not wrt the divisor 407B75 (quite well explained by Gowron above), but yes wrt older fixed penalty amouts vs. the total gift size. Also to avoid any misunderstandings wrt the fix code, note that the old divisor at position 407B75 has been removed due to code changes, but doubling the new multilpier does the same effect as halving the old divisor would do (and vice versa) since / X = * 1/X.
"The only thing we have to fear is fear itself." -- FDR
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Gifts to Minor Races: Amounts and Effects

Post by Tethys »

Spocks-cuddly-tribble wrote:
Tethys wrote:SCT, this Bribe Resistance Fix (advanced) does not work well
Thanks for reporting this. Missing part added to the fix code #2. :)

This should work for you:

at 0x6F14 change 0x16 bytes to

D8 33 C0 83 7B 3C 02 75 52 31 C9 8A 4C 24 34 83 7C 8B 28 03 74 45
Heh, guess Im not so much of a Pakled after all! :lol: 8O Thanks for this.

Actually SCT, this part of the code is conflicting with the other link in my post above:

Code: Select all

at 0x6F6C new code 0x1E bytes:

83 E0 7F BA 64 00 00 00 2B D0 0F AF EA 89 6C 24 2C DB 44 24 2C DC 0D A8 7D 40 00 90 90 90
Or is this code now obsolete and replaced with the code you posted?

0x6f75 (407B75) is the value in question which controls the effect of the gift to the minor race
Spocks-cuddly-tribble wrote:Yes, that's exactly what I explained (even two times): :idea:
The multiplier is 0.0004 due to the skipped default effect divisor (25 see above) i.e. *0.04 *0.01(%). Thus e.g. to get a divisor of 50 the float value must be 0.0002.
note that the old divisor at position 407B75 has been removed due to code changes, but doubling the new multilpier does the same effect as halving the old divisor would do (and vice versa) since / X = * 1/X.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Axis
Commander
Commander
Posts: 489
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re:

Post by Axis »

Gowron wrote:UPDATE:

a. Base Amount Calculation

The base amount for gifts is computed via this code segment:

Code: Select all

-OFFSET-    ---HEX CODE---     -----------ASM CODE-----------

0x006BEF    8D04AD00000000     lea eax, dword[4*ebp+00000000]  // eax ==  4*ebp
0x006BF6    29E8               sub eax, ebp                    // eax ==  3*ebp
0x006BF8    C1E003             shl eax, 03                     // eax == 24*ebp
0x006BFB    01E8               add eax, ebp                    // eax == 25*ebp
This sets eax to 25 times the value of ebp, whose value is 40*n, with n being an integer between 1 and 5 which determines the size of the gift.

Default base amounts:

Code: Select all

n  ebp   eax
1   40  1000   // minimum gift, 1000 credits
2   80  2000
3  120  3000
4  160  4000
5  200  5000   // maximum gift, 5000 credits
I guess I`m a Pakled myself too, but could someone "bend it from iron wire" (as we say in my country when something gets too complicated) for me these default base amounts?

Do those base amounts have their own addresses?

Let`s see, if I wanted :
1 to be 5000
2 to be 7500
3 to be 10000
4 to be 15000
5 to be 30000

What should I modify, and how?
Impress the Empress.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Re:

Post by thunderchero »

Axis wrote:I guess I`m a Pakled myself too, but could someone "bend it from iron wire" (as we say in my country when something gets too complicated) for me these default base amounts?

Do those base amounts have their own addresses?

Let`s see, if I wanted :
1 to be 5000
2 to be 7500
3 to be 10000
4 to be 15000
5 to be 30000

What should I modify, and how?
you made me look at the assembly code this time, :grin:

I am not sure of location of base value, but it warns it is used by multiple sub-routines so it is not suggested to change any way.

but to edit the 5 values above you can change these locations in sub routine 004C7E48
0xc7258 28 00 -> C8 00 (original value *5)
0xc725e 50 00 -> 90 01 (original value *5)
0xc7264 78 00 -> 58 02 (original value *5)
0xc726a A0 00 -> 20 03 (original value *5)
0xc7270 C8 00 -> E8 03 (original value *5)

note not sure if this value is shared by other sub-routines or if other sub-routines will need to be edited for AI gifts, bribes, ect

good luck
thunderchero
Post Reply

Return to “Gifts to Minor Races: Amounts and Effects + major race gifts, offers & demands !”