Hi Everyone,

The 20th Anniversary of the release of Birth of the Federation is now less than 2 months away "May 25 2019" it is gratuitous that it also falls on Saturday.

I propose we gather on GameRanger for quick multi-player games and reminiscing about our favorite game.

I will try to be on GameRanger as much as I can that day and night and hope to see you there.


For discussion see this Topic

Re: Pop Support, Ground Combat, Orbital Batteries, Credit Ou

Pop Support, Ground Combat, Orbital Batteries, Credit Output; support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Code Master
Code Master
Posts: 721
Joined: Sun Apr 27, 2008 2:00 am

Re: Pop Support, Ground Combat, Orbital Batteries, Credit Ou

Post by Spocks-cuddly-tribble » Fri Jan 15, 2010 2:13 pm

Gowron wrote:3. Orbital Batteries:

...there's some odd effect: You can take on a LV8 orbital battery with a 640 HP (shields + hull) Cardassian Cruiser II, and it will survive with 0 HPs... This doesn't make much sense
These code errors are quite easy to correct: (jle -> jl) :)

Ships survive with 0 HPs (fix):

at 0x67AA6 and at 0x67B5B change 8E to -> 8C (asm-4686A5 & 46875A)

OBs survive with 0 PTs (fix):

at 0x67CB3 change 7E to -> 7C (asm-4688B3)

OB firepower : (defense output * tech level)

Code: Select all

46853A   mov   edx, 5 // tech-ID (weapon)
OB hitpoints : (defense output * tech level)

Code: Select all

468552   mov   edx, 2 // tech-ID (construction)
Option: (example)

Code: Select all

46856D     0FAFC8          IMUL ECX,EAX
468570     0FAFC2          IMUL EAX,EDX
468573     9090            NOP
468575     898C248C020000  MOV [ESP+28C],ECX
The 2 bytes at 468573 we can use to etablish any desired 1:2 ratio via shr (/shl) eax(HitPoints) / ecx(firepower). (remember this for later)

:idea: Option: no SH protection for active OBs (i.e. SH power not wasted for OBs :wink:)

Code: Select all

at 0x67C8B change -> 7D to EB
and at 0x67CA9
29 DD C7 00 00 00 00 00
90 90 90 90 90 90 90 90

46888B   jge   short_4688A2       // jge = jmp

4688A9   sub   ebp, ebx           // removed
4688AB   mov   dword ptr [eax], 0 // removed

Gowron wrote:Although Strike Cruisers are labelled as orbital killers, regular Cruisers will do better.
:arrow: Establishing a defensive bonus for Strike Cruisers against OBs

The below modification reduces the firepower of the OBs against Strike Cruisers, but only for one OB per Strike Cruiser. So this specialised counter ability is limited if there are more active batteries than attacking ships (i.e. when approaching to the planet in order to bomb, whilst there are remaining OB shots).

For more info see: Attacking a System :idea:

Code: Select all

trek.exe at 0x67A54

8B 84 04 3E 02 00 00 C1 F8 10 E8 2D 20 FE FF 89 C1 89 C3 31 C0 89 E2 8A 41 52 E8 4D 73 00 00 8B 94 24 90 02 00 00 85 D2 0F 84 80 01 00 00 8B 84 24 8C 02 00 00 8D 72 FF 8B 79 38 89 B4 24 90 02 00 00 39 F8 0F 8E F8 01 00 00 8B 71 3C 29 F8 39 F0 0F 8E 50 01 00 00 8B B4 24 80 02 00 00 8B 51 28 8B 41 4E C1 FA 10 C1 F8 10

66 8B 84 04 40 02 00 00 E8 2F 20 FE FF 8B C8 8B D8 8B D4 8A 41 52 E8 51 73 00 00 8B B4 24 90 02 00 00 85 F6 0F 84 84 01 00 00 8B 84 24 8C 02 00 00 4E 80 7C 24 68 03 75 03 C1 E8 01 8B 79 38 89 B4 24 90 02 00 00 3B C7 0F 8E F4 01 00 00 8B 71 3C 2B C7 3B C6 0F 8C 4C 01 00 00 8B B4 24 80 02 00 00 66 8B 51 2A 66 8B 41 50

468654    668B840440020000  MOV AX,WORD PTR[ESP+EAX+240]
46865C    E82F20FEFF        CALL 44A690  (read_GShipList)
468661    8BC8              MOV ECX,EAX
468663    8BD8              MOV EBX,EAX
468665    8BD4              MOV EDX,ESP
468667    8A4152            MOV AL,BYTE PTR[ECX+52]
46866A    E851730000        CALL 46F9C0  (read_shiplist.sst)
46866F    8BB42490020000    MOV ESI,DWORD PTR[ESP+290]
468676    85F6              TEST ESI,ESI (remaining OB-shots)
468678    0F8484010000      JE 468802    (ship-weapons free)
46867E    8B84248C020000    MOV EAX,DWORD PTR[ESP+28C]
468685    4E                DEC ESI
468686    807C246803        CMP BYTE PTR[ESP+68],3
46868B    7503              JNZ SHORT 468690
46868D    C1E801            SHR EAX,1  (OB firepower/2^1)
468690    8B7938            MOV EDI,DWORD PTR[ECX+38]
468693    89B42490020000    MOV DWORD PTR[ESP+290],ESI
46869A    3BC7              CMP EAX,EDI
46869C    0F8EF4010000      JLE 468896  (shields_only)
4686A2    8B713C            MOV ESI,DWORD PTR[ECX+3C]
4686A5    2BC7              SUB EAX,EDI
4686A7    3BC6              CMP EAX,ESI
4686A9    0F8C4C010000      JL 4687FB  (hull_damage)
4686AF    8BB42480020000    MOV ESI,DWORD PTR[ESP+280]
4686B6    668B512A          MOV DX,WORD PTR[ECX+2A]
4686BA    668B4150          MOV AX,WORD PTR[ECX+50]
The defence factor (OB firepower / 2^X) is at 0x67A8F (default 01).

:arrow: Adjusting ship weapons damage against OBs (unmodded first SH):

(ships that survive the OB initial attack)

The addresses [ESP+] represent shiplist.sst +84, +88 & +8C (i.e. torpedo number, multiplier & damage)+120h

Code: Select all

468812   8BAC24AC010000     MOV  EBP, [ESP+1AC]
468819   0FAFAC24A8010000   IMUL EBP, [ESP+1A8]
468821   0FAFAC24A4010000   IMUL EBP, [ESP+1A4]

and (relevance unclear) +240h / +360h :

46896B   8B8424CC020000     MOV  EAX, [ESP+2CC]
468972   0FAF8424C8020000   IMUL EAX, [ESP+2C8]
46897A   0FAF8424C4020000   IMUL EAX, [ESP+2C4]

468997   8B9424EC030000     MOV  EDX, [ESP+3EC]
46899E   0FAF9424E8030000   IMUL EDX, [ESP+3E8]
4689A6   0FAF9424E4030000   IMUL EDX, [ESP+3E4]

:arrow: Adjusting ship weapons bombing damage (SH, population & buildings):

(ships that survive ALL OB shots)

Code: Select all

467472   8B8424AC010000     MOV  EAX, [ESP+1AC]
467479   0FAF8424A8010000   IMUL EAX, [ESP+1A8]
467481   0FAF8424A4010000   IMUL EAX, [ESP+1A4]
The second statement (torpedo-multiplier) is each redundant for unmodded BotF, thus can be removed/replaced.

For example we could use unused parts of the plasma stats in shiplist.sst for the creation of ship-specific (& ship to ship combat independent) bombing resp. OB attacking abilities. This should be safe as long as we keep +0xB4 (plasma attNum) = 0. shiplist.sst at +0xBC (plasma attMul) I suggest we leave for a future use as pulse weapon graphic indicator.

Example: (change code for torpedo multiplier to ex-plasma attLev)

+0xB8 (ex-plasma attLev) -> position exactly 3 lines below the torpedo multiplier (+0x88)

The new value is at shiplist.sst +0xB8 (ex-plasma attLev) so we increase all values by 0x30:

468819 imul ebp, [esp+1A8h] -> +1D8h
-> at 0x67C1D change A8 -> to D8
468972 imul eax, [esp+2C8h] -> +2F8h
-> at 0x67D76 change C8 -> to F8
46899E imul edx, [esp+3E8h] -> +418h
-> at 0x67DA2 change E8 03 -> to 18 04

same for bombing damage: (other value/address optional)
467479 imul eax, [esp+1A8h] -> +1D8h
-> at 0x6687D change A8 -> to D8

From the counter-system point of view, perfect solution would be to use each a custom data-field in shiplist for OB-combat & an other for bombing (i.e. adapting each address of the first statement and removing the other two statements). But that's a considerable expenditure and one needs a mod manual, because there is no in-game display for these ship abilities.:(

The 'bombard system' morale event gets randomly prevented (not the worst, since it curbs exploiting). Removing the jmp statement at 46844F skips the random engine, but this will apply the morale effect even if all ships were destroyed by OBs (i.e. bombing task prevented): at 0x6784F change 75 22 to -> 90 90


[esp+270h] = number of OBs
[esp+284h] = destroyed OBs
[esp+28Ch] = OB firepower
[esp+290h] = remaining OB-shots
[esp+294h] = OB HitPoints (reloaded from [esp+26Ch] for next OB)

Possible future projects:

-> prevent wastage of OB overflow damage (possible options):

- techlevel * OB shots (instead of * OB firepower) problem: target selection
- shots * firepower to [esp+28Ch] & check if lower 1 (instead of [esp+290h], 0)
- if ships destroyed store overflow damage & add to next OB shot

-> prevent the line-up of specific ship types as cheap 'OB blocker' (colony, scout, destroyer?)

-> building hitpoints:

Code: Select all

466EF9  mov   edx, 2  // construction tech
-> Sometimes the bombing task somehow gets stuck -why? (this starvation modification pays off in that cases).
Last edited by Spocks-cuddly-tribble on Wed Apr 20, 2016 5:08 pm, edited 2 times in total.
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Multiple Tournament Champion
Multiple Tournament Champion
Posts: 880
Joined: Sat Apr 26, 2008 2:00 am
Location: GMT- 5

Post by ruthlessferengi » Fri Jan 15, 2010 10:12 pm

so, on a practical point of view, defence capability of my systems will be increased if i research weapons first....

and that trick of determining tech level of empire (defence/pop) - well, that's brilliant...


Do I need to calculate the ground combat value as er Gowron brilliant notes or can I just go by the value displayed with arrow hover?
Spocks-cuddly-tribble wrote:Of course, you must calculate based on the "arrow hovered" ground combat value and the current pop.

But more than that, you do need precise background knowledge w.r.t. actual tech levels for every minor evolution level (for each race)!
Relevance is a post hoc phenomenon

На безптичье и жопа воробей...
Ancient Klingon Battlecry

User avatar
Code Master
Code Master
Posts: 721
Joined: Sun Apr 27, 2008 2:00 am

OB Tech Level Bug Fix for Minor- & Rebel-Systems

Post by Spocks-cuddly-tribble » Mon Dec 19, 2011 2:41 pm

Gowron wrote:minor races...might be at weapon tech level 0 and still have level 8 orbitals, maybe that's a mechanism that was built into the game to prevent their planetary defenses from being utterly useless at the start of the game.
BotF mistakenly tries to read tech levels for race ID 0x23 i.e. the OB strength of minor and rebel systems purely coincidental starts with 0 (so minors are very easy blitzkrieg targets) and is later always tech 8. :?

:arrow: OB Tech Level Bug Fix for Minor- & Rebel-Systems

Code: Select all

trek.exe at 0x67937 & 0x6794F change 8A 42 4C -> 66 8B C6          

- asm -
00468537     66:8BC6    MOV AX, SI
0046854F     66:8BC6    MOV AX, SI

AI system attack check: (unsolved, but unimportant)
-> should read inhabitant ID for minor/rebel systems (only):
0047999E                 mov     al, [ebp+4Ch]
004799B2                 mov     al, [ebp+4Ch]
And a note wrt the Ships survive with 0 HPs (fix):

The value at 0x67AA6 i.e. asm-4686A5 should NOT be changed when using the defensive bonus for Strike Cruisers against OBs!
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Code Master
Code Master
Posts: 721
Joined: Sun Apr 27, 2008 2:00 am

Ground Defense Fix for Minor & Rebel Systems

Post by Spocks-cuddly-tribble » Sat Jan 14, 2012 7:45 am

The following code fixes three bugs at a stroke:
  • % ground defense building bonuses broken for minor & rebel systems (thanks again to Tethys)
  • rebel system ground combat value always -1 bug (see note)
  • F1-map ground defense pop-up missing for rebel systems
Note: Like Gowron found out, the negative sign will change by reason of the squaring of ground combat values:

:arrow: Ground Defense Bonus and Popup Fix for Minor & Rebel Systems

Code: Select all

trek.exe at 0x45D28 new code 0x2C bytes:

8B 02 52 BA 25 00 00 00 E8 AB E8 FF FF 5A 83 C0 64 89 44 24 08 DB 44 24 08 DC 0D 7C 87 57 00 DD 5C 24 08 8B 42 44 90 90 90 90 90 90

asm code:
00446928     8B02            MOV EAX, [EDX]   // system ID
0044692A     52              PUSH EDX
0044692B     BA 25000000     MOV EDX, 25  // %-ground defense bonus ID
00446930     E8 ABE8FFFF     CALL 4451E0 // cumulate system output by bonus ID
00446935     5A              POP EDX
00446936     83C0 64         ADD EAX, 64  // add base factor 100%
00446939     894424 08       MOV [ESP+8], EAX
0044693D     DB4424 08       FILD [ESP+8]
00446941     DC0D 7C875700   FMUL QWORD [57877C]  // * 0.01 percentage factor
00446947     DD5C24 08       FSTP QWORD [ESP+8]
0044694B     8B42 44         MOV EAX, [EDX+44]  // raceID of population
0044694E-446953     90       NOP

The below option (fix independent) turns the effect of local + global ground combat building bonuses from multiplicative into cumulative.

For example the calculation changes from
Gowron wrote:Example:
You play as the Cardassians and have acquired the Nausicaans, the Angosians and the Selay (with each special structure up and running). Your current weapon tech level is 8, and you have a (powered) bunker network in the Selay system (population: 250). Your ground combat strength in the Selay system is:

250 (pop) * 1.8 (tech) * 1.1 (Cardassians) * 2 (bunker + Mustering Base) * 1.9 (Nausicaan Recruitment Center + Angosian Super Soldier Academy) = 1881

250 (pop) * 1.8 (tech) * 1.1 (Cardassians) * 2.9 [1 + 1(bunker + Mustering Base) +0.9 (Nausicaan Recruitment Center + Angosian Super Soldier Academy)] = 1435

Code: Select all

trek.exe at 0x45D63 new code 0x14 bytes:

DD 44 24 04 DC 44 24 0C D9 E8 DE E9 DB 42 40 DE C9 90 90 90

asm code:

00446963     DD4424 04      FLD QWORD PTR SS:[ESP+4]
00446967     DC4424 0C      FADD QWORD PTR SS:[ESP+C]
0044696B     D9E8           FLD1
0044696D     DEE9           FSUBP ST(1),ST
0044696F     DB42 40        FILD DWORD PTR DS:[EDX+40]
00446972     DEC9           FMULP ST(1),ST
00446974     909090         NOP
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Code Master
Code Master
Posts: 721
Joined: Sun Apr 27, 2008 2:00 am

Shield Generator Phantom-power Fix

Post by Spocks-cuddly-tribble » Mon Apr 25, 2016 12:08 pm

Due to a bug the shield generator ignores its power state. This patch also fixes the f1 map display and popup for system defenses (i.e. SH is red when down).

NOTE: when powering on/off F1 map display will be updated next turn (it's the same phenomenon as with the bonuses for ground defense, scanner & map range)

Code: Select all

trek.exe at 0x45C0D change 0x17 bytes to

8B C3 80 78 4C 05 73 5B 80 79 04 00 74 51 90 90 90 90 90 90 90 90 90

0044680D   8BC3          MOV EAX,EBX
0044680F   8078 4C 05    CMP BYTE PTR DS:[EAX+4C],5
00446813   73 5B         JNB SHORT 446870
00446815   8079 04 00    CMP BYTE PTR DS:[ECX+4],0
00446819   74 51         JE SHORT 44686C
0044681B   90 *9         NOP
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

Post Reply

Return to “Pop Support, Ground Combat, Orbital Batteries, Credit Output”

Who is online

Users browsing this forum: No registered users