System Size Boundaries

Galaxy Control Values; support/discussion/questions

Moderator: thunderchero

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

System Size Boundaries

Post by Gowron »

One of the most important BotF secrets, the position of the system size boundaries in trek.exe (or wherever they're stored) is still unknown...


------------------------------------------------------------------
------------------------------------------------------------------


Increasing the size of star systems has been the goal of many a mod, but there happens to be a reason why it doesn't work as well as it "should":

When creating a star system, the game adds the planets one by one.

As long as the maximum population is below 80, the systems will keep adding planets except Gas Giants.

As soon as the max. population reaches or exceeds 80, after every planet added there's a random decision if the game stops adding planets or not. Also, Gas Giants are now eligible.

As soon as the max. population exceeds 400, the game stops adding planets.

Thus, in vanilla BotF the maximum possible systems size for an empty system is 540 (400 plus 140 for the best class M planet).
Minor race home planets do not count towards the population capacity sum here, so it's possible to get even higher maximum populations in minor race home systems.


A system that is generated this way (i.e. all systems except for major race home systems) cannot have more than 7 planets. If the system has 7 planets, the game stops adding planets. If the system's maximum population is lower than 80 at this point, the game crashes (this is not possible in vanilla BotF, since planets have at least size 15). If the system is a minor race system, then one planet slot is reserved for the home planet of that minor race.


Of course, changing the boundary values would be interesting, but unfortunately the value 400 is not stored in trek.exe, neither as a float nor as an integer. The value 80 is not stored in trek.exe as a float and neither as an integer of length 4 or 8 (and I don't really feel like hunting "5000"s or even "50"s in trek.exe for fun, since if the 400 is not stored in trek.exe, the 80 most likely isn't either).








Side Note:

It looks like the game designers wanted to use the file ppgrowth.bin for this, but ran out of time and decided not to use it.
ppgrowth.bin is included in BotF, but even overwriting it with zeros doesn't seem to make any difference at all.
If you interpret is as a table with 10 rows, is looks like this:

Code: Select all

0A 00 32 00 40 42 0F 00 00 FF 00 00
32 00 64 00 20 A1 07 00 00 FF 00 00
64 00 C8 00 50 C3 00 00 01 FF 00 00
C8 00 2C 01 40 9C 00 00 01 FF 00 00
2C 01 90 01 30 75 00 00 01 FF 00 00
90 01 58 02 20 4E 00 00 01 FF 00 00
58 02 20 03 10 27 00 00 01 FF 00 00
20 03 B0 04 88 13 00 00 01 FF 00 00
B0 04 D0 07 C4 09 00 00 01 FF 00 00
D0 07 10 27 E2 04 00 00 01 FF 00 00


The first row,
0A 00 32 00 40 42 0F 00 00 FF 00 00
for example can be translated into
10 50 1000000 0
or
"if current maximum population is between 10 and 50, set some funny variable to 1000000, with Gas Giants disabled (=0)"

Or take the third row,
64 00 C8 00 50 C3 00 00 01 FF 00 00
in dec. numbers
100 200 50000 1
or
"if current maximum population is between 100 and 200, set some funny variable to 50000, with Gas Giants enabled (=1)"

The "funny variable" would then e.g. have something to do with the probability to add more planets to the system.

Interpreted this way, ppgrowth.bin reads as follows:

Code: Select all

  10    50   1000000   0
  50   100    500000   0
 100   200     50000   1
 200   300     40000   1
 300   400     30000   1
 400   600     20000   1
 600   800     10000   1
 800  1200      5000   1
1200  2000      2500   1
2000 10000      1250   1



But of course that's just speculation.
Last edited by Gowron on Sun Jan 31, 2010 5:59 pm, edited 2 times in total.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

Is it possible that a similar table is included in trek.exe?

If we find it, we should be able to manipulate it.
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 »

Good idea, but it seems there's no similar table in trek.exe.

Maybe the "80" is stored as 0x50 (single byte), and the "400" is calculated as "80 times 5", with only the "5" being stored in trek.exe - that way it would be next to impossible to find these controls.
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: 7852
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

very nice, :D
looks like one more piece of the puzzle :wink:

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

Post by Flocke »

thunderchero wrote:very nice, :D
looks like one more piece of the puzzle :wink:
Exactly my thought! Amazing discovery! =)
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7852
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Hi,

I was just wondering could there be a code for extra starting systems planets chance if it will be terraformed? I would like them to always be terraformed.

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 »

Updated the part about minor races:
The minor race home planet is actually added before the other planets. The number of randomly generated planets is then reduced by one (so that the total number of planets stays the same). Due to a bug or a feature, a stack variable counting the total population capacity of the star system is not updated when the home planet is added, so the pop space of the home planet is neglected when the system size boundaries are applied.
thunderchero wrote:Hi,

I was just wondering could there be a code for extra starting systems planets chance if it will be terraformed? I would like them to always be terraformed.

thunderchero
viewtopic.php?name=Forums&file=viewtopic&t=1238
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

i changed 0xB4577 to 03 from 01 in trek.exe and now my systems start with 3 planets (unless population boundry conditions are met) and i've had some with as many as 9 planets :) thanks gowron for this :)
User avatar
ketteringdave
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 99
Joined: Sun Apr 27, 2008 2:00 am

Post by ketteringdave »

The offsets given in this thread are for the assembler code, not the hex locations in trek.exe. Check out this thread for the difference, and how to convert back and forth.

And doesn't the Ultimate Editor already do this? It's been awhile since I've done any tinkering...
stardust
Rear-Admiral
Rear-Admiral
Posts: 1381
Joined: Sat Apr 26, 2008 2:00 am
Location: good ole Blighty

Post by stardust »

ketteringdave wrote: And doesn't the Ultimate Editor already do this? It's been awhile since I've done any tinkering...
It can be accessed by opening trek.exe with Ultimate Editor.

From there it's Edit>Starting Conditions and here you can change the starting populations of each system provided the planets in said system can support the population.
Computers! [Expletive deleted]

My 4shared folder
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

By adjusting some code in *_sysmap.wdf files, you can move all the planet graphics INCLUDING the star graphic left and right, so I dont know if this might be related to having/allowing 10 planets in a system or not (somehow)? Just a thought that came to mind as i was rummaging through the wdf files making the system informations fit better ;)
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
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 »

Cyberus wrote: I only want to incrase population in SOL system to 400 and nothing more.
Use the Ultimate Editor to change the properties of the planets of the Sol system:

In the Ultimate Editor menu, after loading stbof.res, go to
Edit -> Galaxy -> Planets.

Then you can for example search for Mercury and set its size to "large" and its pop bonus to "high" to make it support more population. And of course the same can be done for the other planets of the Sol system.
Peter1981 wrote:
Edit:
Class specification for the additional planet (default = 6 = terran):
Code:

Code: Select all

:004B4C9D B806000000              mov eax, 00000006 
This can be changed to any other class (0=arctic, ..., 7=volcanic), even gas giants work. Each additional major empire starting system will contain at least one planet of the specified class.
I've got 6 extra starting colonies on advanced start and I changed the above to b8 03 00 00 00 ie maditory gas giant however 2/6 did not contain gas giants but these systems had less than 5 planets so was this overridden?
Maybe the Gas Giants were overwritten because additional population space was needed. It heavily depends on what else you changed ;)
Last edited by Gowron on Tue Jul 27, 2010 3:39 pm, 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
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Peter1981 wrote:I've just played a game with the change to min 3 systems as discribed above and it only had two plamets large Terran and large Jungle
Maybe the system already exceeded the upper population limit?
In this case the game would stop adding more planets, and the system might end up without its "special" planet.
Tethys wrote:What I am interested in is the location of how/where the planet type is placed in the solar system. Y class is always first, followed by any combination of J M L G and O, and then finally P and B classes are placed at the end randomly.

If the location(s) is(are) known, this can probably be disabled meaning to have a Gas giant as the first planet type (as has been seen IRL) and a nice P class right before your M class planet.
I've just found the code for planet sorting. I'll post it as a new topic :)

viewtopic.php?name=Forums&file=viewtopic&t=1624
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Re: A little help for non-programmers?

Post by DCER »

Hi,

I'll try to explain :)
capt_blondbeard wrote:
Offset hex code asm code

:004B48BD 817C244CA00F0000 cmp dword[esp+4C], 0FA // upper limit
----------
:004B4849 817C244C20030000 cmp dword[esp+4C], 00000320 // lower limit
The offset on the far left is an assembler offset. You'll need to convert it to a hexadecimal address to use with the hex editor. You can use the jump to offset function if the editor has one to get to the address. Usually the address of the selected byte is shown at the bottom, and the start addresses of the each line are shown at the left of the hex code.

Next is the hex code (817C244CA00F0000), you should find that exact code at the given address.

Next is the explanation what the hex code means. It's what a disassembler would show (cmp dword[esp+4C], 00000320). This is a single instruction to the cpu. The data shown here is in big endian format. In the hex code (817C244C20030000) it's in little endian format. 00000320 in big endian equals 20030000 in little endian. Basically you just rearrange the bytes in reverse order (bytes are two characters long).

capt_blondbeard wrote:Then moving on to Ultra edit: There are three blocks of information:

the first is a hexnumber with 8 digits (XXXXXXXXh:)
That is the line address in hex, probably in big endian.
capt_blondbeard wrote: Then comes 16 two-digit blocks ;
That's the hex code you need to edit.
capt_blondbeard wrote: Then comes a block of asci text (presumably the translation of the former info, if it actually has a translation, otherwise just nonsense)
That's just the representation of the hex code in ascii. Not any help unless you're editing text. A hex editor doesn't know how to convert the hex code to asm code. You need a disassembler for that. But that's only if you want to figure out the code and what it does. If you already have instruction like here you only need a hex editor.

Hope that helps.
User avatar
jonesie85two
Lieutenant-Commander
Lieutenant-Commander
Posts: 201
Joined: Sat Apr 26, 2008 2:00 am

Re: System Size Boundaries

Post by jonesie85two »

is this the info i need to make the additional major race starting planets have a minimum pop of 350 and a aximum of 650? (i have increased planet populations).

Thank you for your time.
Post Reply

Return to “Galaxy Control Values”