Borg turn timer

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
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Borg turn timer

Post by stljeffbb »

Hello everyone....first post here on the new AFC...I was around a bit about five or six years ago, and I'm thouroughly impressed with the determination and resiliance of this modding community.... :)

OK, I've been enjoying the All the Ages mod, and I'm trying to change the borg so they do not come after me on turn fifty in my "impossible" game...I researched numerous posts here on the board, the main source of info being this thread: viewtopic.php?name=Forums&file=viewtopi ... c&start=30

So, using a hex editor, I changed the code at 321393 (I prefer decimal...the hexadecimal address is 0x4E771) from 32 00 00 00 to 90 02 00 00...this should change the time from fifty turns to 401 turns before a borg cube spawns (along with other checks)...but alas, they still keep coming "early"....my poor Constitution class light crusiers are no match (lol)....about the only area I have had success in is using the UE and changing the borg cube cost to 65535....this delays them somewhat (as it seems if a cube costs more than an empire's fleet, they will not spawn), but not enough....I've tried a bunch of different things too, like changing the stbof.ini from Borg=OFF to Borg=ON in the middle of a saved game, but this does not seem to have any effect....I would hate to have to nerf the borg cubes but I might need to do this (also since the AI is completely useless against borg cubes for some reason)

Any thoughts? Thanks in advance for any replies! :)

Jeff
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3693
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Borg turn timer

Post by Flocke »

Hey, welcome to AFC and thanks for the great praise! :)
I've never touched the Borg Timer, but according to the post you linked, it's a dynamic key variable loaded at multiple places.

Edit: Hm, first thought you simply edited wrong place, but reading the code that should be the delay value for impossible difficulty. :roll:

Edit2: Hmmn, ok, well, seems like the delay value is only used to spawn additional cubes. Initially the borg timer is set to zero at asm450038 / 0x4F438. When Timer is zero, at asm44F2F5 / 0x4E6F5 there's a jump causing to spawn a cube.
Try to nop

Code: Select all

test    eax, eax
jz      loc_44F397
at asm44F2F3 / 0x4E6F3
by replacing 85 C0 0F 84 9C 00 00 00 with 90 90 90 90 90 90 90 90
together with your change that should do it
btw 90 02 = 656 turns, not sure what other checks you mean


HTH
User avatar
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Re: Borg turn timer

Post by stljeffbb »

Flocke wrote:Hey, welcome to AFC and thanks for the great praise! :)
I've never touched the Borg Timer, but according to the post you linked, it's a dynamic key variable loaded at multiple places.

Edit: Hm, first thought you simply edited wrong place, but reading the code that should be the delay value for impossible difficulty. :roll:

Edit2: Hmmn, ok, well, seems like the delay value is only used to spawn additional cubes. Initially the borg timer is set to zero at asm450038 / 0x4F438. When Timer is zero, at asm44F2F5 / 0x4E6F5 there's a jump causing to spawn a cube.
Try to nop

Code: Select all

test    eax, eax
jz      loc_44F397
at asm44F2F3 / 0x4E6F3
by replacing 85 C0 0F 84 9C 00 00 00 with 90 90 90 90 90 90 90 90
together with your change that should do it
btw 90 02 = 656 turns, not sure what other checks you mean


HTH
Hello Flocke....thanks much for the info....oops on the 90 02....I only know enough info to be dangerous as they say....I was shooting for 401 turns, and using the UE Calculator I now see that is 91 01...will try it and report back!

Regards,

Jeff
User avatar
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Re: Borg turn timer

Post by stljeffbb »

stljeffbb wrote:
Flocke wrote:Hey, welcome to AFC and thanks for the great praise! :)
I've never touched the Borg Timer, but according to the post you linked, it's a dynamic key variable loaded at multiple places.

Edit: Hm, first thought you simply edited wrong place, but reading the code that should be the delay value for impossible difficulty. :roll:

Edit2: Hmmn, ok, well, seems like the delay value is only used to spawn additional cubes. Initially the borg timer is set to zero at asm450038 / 0x4F438. When Timer is zero, at asm44F2F5 / 0x4E6F5 there's a jump causing to spawn a cube.
Try to nop

Code: Select all

test    eax, eax
jz      loc_44F397
at asm44F2F3 / 0x4E6F3
by replacing 85 C0 0F 84 9C 00 00 00 with 90 90 90 90 90 90 90 90
together with your change that should do it
btw 90 02 = 656 turns, not sure what other checks you mean


HTH
Hello Flocke....thanks much for the info....oops on the 90 02....I only know enough info to be dangerous as they say....I was shooting for 401 turns, and using the UE Calculator I now see that is 91 01...will try it and report back!

Regards,

Jeff
OK, I've run some tests, and it seems based on my experiences that editing/replacing the code at 0x4E6F3 seems to stop the borg entirely from spawning...no cubes at all... :( I wish I had a better grasp on being able to hex edit things like the "Borg multiplier" as mentioned in the above posted thread....I see that the value is "1.25" and it is an eight byte sequence, however I do not yet understand how the code equates 1.25 :(

....lastly, when I convert what I assume is the assembler offset for the multiplier (5791B8), I get 0x176fb8 which appears to be an eight byte: 00 00 00 00 00 00 F4 3F Is it the "F4 3F" part that holds the multiplier? I will mess with this and report back....

Jeff
User avatar
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Re: Borg turn timer

Post by stljeffbb »

Ugh! OK, I first edited the 0x176fb8 spot....no cubes....then, I tried using the UE, first reducing the costs of ships by dividing by ten....this was assuming that ship costs are one of the factors in causing a borg cube to appear (based on the thread mentioned in the first post)...no luck there as cubes spawned at about the normal time (in an "impossible" game)...and then I tried reducing all ship costs to one credit (not maintenance, but cost to buy)....ha ha, I then had a borg cube in my area (after having only my original ships [a colony ship and a science vessel]) by turn sixty-three! 8O

So, I'm kind of at a loss here unfortunately....currently, my two options are 1) nerf the borg cubes or 2) turn off the borg :(

I wish the AI was as good as the borg's ability to spawn, and no wonder people/mods simply turn off the borg....what a shame :( :( :(

Jeff
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3693
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Borg turn timer

Post by Flocke »

sry, dunno what's wrong, you might find something more useful in forum, else maybe SCT can help.
I'd have to give this deeper analysis by debugging with savegames before spawning a cube, but I'm currently busy with other things. :(
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 8572
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Borg turn timer

Post by thunderchero »

option 3 As flocke says wait to see if SCT can explain.

option 4 make them easier to defeat so they have less effect to game. (I guess this is what you ment by nerf)

thunderchero
User avatar
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Re: Borg turn timer

Post by stljeffbb »

thunderchero wrote:option 3 As flocke says wait to see if SCT can explain.

option 4 make them easier to defeat so they have less effect to game. (I guess this is what you ment by nerf)

thunderchero
Thanks much for your help flocke and thunderchero....greatly appreciated! I enjoy almost as much figuring out how modding works as I do playing games...as you know the code is like a puzzle just waiting to be figured out...however, I do not know how all the pieces are shaped, so I'm hoping SCT will stop by...if not, I will keep on tweaking! :)

Regards,

Jeff
User avatar
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Re: Borg turn timer

Post by stljeffbb »

OK, I think I have come up with a very gamey workaround....

I have noticed using UE to change ship attributes (shield and hull points) works in a saved game....so:

1) Super-nerf borg cubes to one (yep!) shield and hull point so that the first cubes that appear are very easy to defeat....the AI is still rather dumb in that I've noticed a Cardassian system under attack and no one came to it's rescue....lol

2) Hope that the borg turn timer works for subsequent cubes...set this to a turn length (I'm thinking about 400-500 turns...your game may vary) that will approximate more cubes appearing about tech level five or six

3) Save game and use UE to change the cubes back to an appropiate level....**NOTE this must be done before more cubes spawn so that they will have the proper shield/hull points

(An alternative would be to simulate the borg's adaptive qualities....using a random number generator outside the game and a spreadsheet, one could devise a scheme to save the game, use the UE to update borg cubes, and then play on to simulate the borg "adapting"....so every so many turns, the borg adapt to get more difficult to defeat! 8O )

This should have the effect of borg cubes spawning at "about the right time" in relation to the tech levels especially when starting at "Beginning" level...of course I'm currently using the -Mudd for testing, and the tricky part will be approximating the appearance of cubes in other empires (without being able to see the entire galaxy) and then avoiding the "real" cubes happening when tech levels are still too low...I will need to do some more testing and I will report back with my findings...

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

Re: Borg turn timer

Post by Spocks-cuddly-tribble »

First of all, see F3 -> 'Random Events' topic -> #2: viewtopic.php?f=9&t=1284

On 'impossible' the problem is the 40 turns delay of asm-44CC7C (shared for all monster) see #2.3. Also cf. #2.2 for a second limit of 75 turns shared for all difficulty levels i.e. 75 turns + the shared base delay of event groups 2 & 3.

stljeffbb wrote:I've run some tests, and it seems based on my experiences that editing/replacing the code at 0x4E6F3 seems to stop the borg entirely from spawning...no cubes at all... :( I wish I had a better grasp on being able to hex edit things like the "Borg multiplier" as mentioned in the above posted thread....I see that the value is "1.25" and it is an eight byte sequence, however I do not yet understand how the code equates 1.25 :(

....lastly, when I convert what I assume is the assembler offset for the multiplier (5791B8), I get 0x176fb8 which appears to be an eight byte: 00 00 00 00 00 00 F4 3F Is it the "F4 3F" part that holds the multiplier?
1. The suggestion by Flocke is correct (delay values shared for the first cube), so it's an editing error and/or conflicting not removed older changes or just the random engine (very erratic i.e. sometimes you have to wait up to 150 turns - after the turn delay - for the first borg cube).

2. Alternatively, when using the default setup resp. the [(cube buildcost * 1.25) vs. (empire warfleet costs)] check for delay of the first cube, see this link for floating-point values (or use Ultimate Editor):
http://babbage.cs.qc.edu/IEEE-754.old/Decimal.html
E.g. for 1.25 you see @ 64 bits aka 8 bytes: 3FF4000000000000 (in code this must be resorted to 000000000000F43F)

Of course, the whole code should be optimized (added mosters bitmask is bugged, empire techlevels should be read for borg delay and the new fleet/techlevel check shared for other powerful monsters), but we don't have the time.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is....
User avatar
stljeffbb
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 05, 2012 6:12 pm

Re: Borg turn timer

Post by stljeffbb »

Thanks very much SCT! I will certainly check this out.... :)

Regards,

Jeff
User avatar
teukros
Cadet 2nd Year
Cadet 2nd Year
Posts: 7
Joined: Sun Feb 12, 2012 3:17 pm

Re: Borg turn timer

Post by teukros »

about the only area I have had success in is using the UE and changing the borg cube cost to 65535....this delays them somewhat (as it seems if a cube costs more than an empire's fleet, they will not spawn),

Jeff

This is the construction cost I take it

since the maintenance is what really sets the limit on how many ships you can have (assuming you do not exploit build 'n' scrap) maybe you could just halve / quarter or whatever, the build costs of all ships.

If you want it to take the same amount of time to build ships, UE can globally reduce the build points of all fabricators/construction yards etc, as well as the build costs of most (all?) buildable things besides ships. I have no idea what effect this would have on minors, though.

I know this is not a perfect solution but maybe it is worth a try.
User avatar
Hestah
Cadet 1st Year
Cadet 1st Year
Posts: 1
Joined: Wed Jul 08, 2026 4:25 am

Re: Borg turn timer

Post by Hestah »

Hi I just came back to the game playing all the ages and ran into this problem I’m not as smart as you guys I’m old lol so with ChatGPT I found a fix below is a lay out of what we did for those of us not as skilled as others and still want to enjoy the game

All the Ages — Delaying the Borg Arrival

Goal:
Delay the Borg so they arrive around the TNG era instead of early game, while keeping random events enabled.

What was happening

In my All the Ages game, the Borg were arriving far too early, sometimes around turn 50–60, while I was still using early/movie-era ships.

I wanted to delay them, not disable random events.

Tools used

* Ultimate Editor v0.9.0dev3
* HxD Hex Editor
* Backup copy of trek.exe

Important discovery

The Borg timer does not appear to be controlled through stbof.res.

Ultimate Editor showed no normal event setting for it. The Borg behaviour appears to be controlled inside:

trek.exe

My executable details

My trek.exe MD5 was:

E1A3622CB3E049AD540FCCC0BF3B35CD

Steps taken

1. Went to the All the Ages install folder:

C:\botf\AAML\

2. Made a backup of:

trek.exe

Renamed backup to:

trek_original.exe

3. Opened trek.exe in HxD.
4. Searched for the older known Borg pattern from the AFC forum:

85 C0 0F 84 9C 00 00 00

This pattern was not found in my version.

5. Because my executable was different from the older forum example, we worked from my exact trek.exe instead.using ChatGPT
6. A patched version of trek.exe was made to delay the Borg spawn.
7. Replaced the original trek.exe with the patched one.
8. Started a new game.

Results

Before patch:

Borg appeared around turn 50–60

After patch:

No Borg at turn 65
No Borg at turn 145
No Borg at turn 253
No Borg at turn 353
Borg arrived at turn 400

First Borg contact:

Turn 400
Borg Sphere appeared near Cardassian/Federation border
Destroyed a level 3 outpost
Later defeated by Federation fleet
Federation losses: 4 ships

Conclusion

The edit successfully delayed the Borg until roughly turn 400, which fits much better with the TNG-era progression in All the Ages.

Random events still worked, including the Planet Killer event.

Notes

* This should be done on a new game.
* Always backup trek.exe first.
* Do not blindly use old offsets from old forum posts unless your trek.exe matches that version.
* The old AFC Borg timer info helped identify the issue, but my executable was different.

Credits

During troubleshooting I worked with ChatGPT (OpenAI GPT-5.5) to investigate the Borg timer.

The process involved:

* Researching previous AFC forum posts.
* Comparing those older hex edits against my version of trek.exe.
* Determining that my executable differed from the older releases, so the published offsets did not apply directly.
* Identifying and applying a compatible hex modification to my specific executable.
* Testing the results over a full campaign.

The modification successfully delayed the Borg from approximately turn 50–60 to turn 400, while leaving other random events (including the Planet Killer) functioning normally.

This wasn’t a theoretical change—we tested it through an entire game until the Borg appeared and confirmed the results in live gameplay.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3693
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Borg turn timer

Post by Flocke »

Congratz for getting it work then! :up:
For some more recent research on Borg encounters you might be interested to check out : viewtopic.php?p=64641#p64641 ;)
Post Reply

Return to “General Modding Information/Questions”