editing main structure population per bar

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.
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

editing main structure population per bar

Post by Axis »

I tried to change the population support cost from 10 to 100 in the edifice.bst and it seems to me that it doesn`t affect the value I`m after.
I changed this value : "Offset 0x0080 to 0x0081 population cost (2 bytes) - either 00 or 0A ". You can input 100 (64), but it affects the production value of the building (I experimented with the Type 1 Automated farm) reverse, meaning when the farm produced 10 food, now it produced only 1. Well, then i changed the value to 1 (01), and then the farm produced 100 food.

So, a question : Is there somewhere in the trek.exe or some file a location where I can change the population requirement for those Type/Class/Mark 1-9 or whatever buildings from 10 to 100?

Explanation : I`m trying to mod my own Vanilla to more realistic proportions with 1000s of millions of people on solar systems. I have successfully tested with max. 1000 million people on large Terran worlds etc. The total capacity of the Sol system was something like 2450! Today, I even multiplied the populations with 10 (what is the current population of the Earth today? Something between 7 and 8 billion and we`re growing to 12 billion in 2050 by some calculations). So I`ve decided that the large terran worlds should have a maximum of 10 billion (10000 million) people when with all the bonuses.

This is why I need that info, I just don`t want to build thousands of buildings in a solar system (if that`s even possible, and that max 50 buildings shown in the system screen seems to be at least the graphical limit).
Impress the Empress.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Structure of edifice.bst

Post by thunderchero »

Hi Axis,
Axis wrote:Offset 0x0080 to 0x0081 population cost (2 bytes) - either 00 or 0A
this does not change population per bar in game

example unchanged at 0A (10)
if bonus of 10 it would take 1 bar (10 pop) to get the 10 bonus
example changing to 64 (100)
if bonus of 10 it would take 10 bars (100 pop) to get the 10 bonus
example changing to 01 (1)
if bonus of 10 it would take 1/10 of a bars (1 pop) to get the 10 bonus (1/10 of 1 bar is not possible so 1 bar would be 100 bonus)

I am not sure if the population per bar has ever been searched for, this value would be within trek.exe

thunderchero
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

Well, if someone could find it, I think it would be a great addition to modding.

If it is only 1 byte long, I would modify it to 50 (just to balance my current modded populations), if 2 bytes, then maybe even to 500, then I could have those "superlarge" realistic populations and such.
Impress the Empress.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Structure of edifice.bst

Post by thunderchero »

personally I would do this a simpler way, just change the text million -> billion
then adjust population to your taste. then each bar would use 10 billion pop.

thunderchero
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

Yes, that could be it, but then again, you would have only max 10 population on those large terrans (actually readjusted the populations of my new "Gaia"-type instead to support 1000 million with all bonuses on high, with that discovery, i could and would increase it to full 10 000).

That 10 billion per bar just would not be enough to "power up" enough buildings, also the populations of planets would increase to astronomical sizes (just impossible in other words).
Last edited by Axis on Mon Feb 13, 2023 6:49 am, edited 1 time in total.
Impress the Empress.
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

Tried to find it myself,

at 0x1779c0 there`s

ORDER_LABOR...... industry %d.. energy %d.. food %d.... research %d.... intel %d...

4F 52 44 45 52 5F 4C 41 42 4F 52 0A 00 00 00 00
09 20 20 69 6E 64 75 73 74 72 79 20 25 64 0A 00
20 20 20 20 20 65 6E 65 72 67 79 20 25 64 0A 00
20 20 20 20 20 66 6F 6F 64 20 25 64 0A 00 00 00
20 20 20 20 20 72 65 73 65 61 72 63 68 20 25 64
0A 00 00 00 20 20 20 20 20 69 6E 74 65 6C 20 25
64 0A 00 00

Changing those 0As to 32 or 64 didn`t change a thing.

Perhaps someone could narrow down the search a little.
Impress the Empress.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Structure of edifice.bst

Post by thunderchero »

Axis wrote: industry %d
this is a text statement "%d" is variable.

I am guessing you are just looking at trek.exe with a hex editor?

if so you should look at trek.exe using the ida data base QD released
viewtopic.php?f=76&t=2175

you would need to download and install the free version of ida to use his files.

just a side note this may require a combo of multiple locations and values, 09 if below, 0b if above, plus a division of system pop for total available plus it may need the edifice.bst population cost (Offset 0x0080) edited
Axis wrote:Perhaps someone could narrow down the search a little.
40AFA0 sub-routine call the edifice.bst population cost (Offset 0x0080)

thunderchero
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

Actually I used that trek idb to find that LABOR-thing (much easier that way), just forgot to mention it.

I`ll try with those guidelines.
Impress the Empress.
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

It is possible!

I mean, I`ve accidentally edited something in the trek.exe sometime (just don`t know where anymore),
because now I can "pump" the whole laborpool full just by using those arrowbuttons of cardassian, ferengi, klingon and romulan intel buildings. And there`s only 1-2 buildings filled with labor (bars are active), but when you use the bars of those intel buildings to decrease or increase workforce, then it works as original.

When I tried to"pump empty" those intel buildings, the bars didn`t move at all, but the laborpool bars were filled one click by one,
I guess that now the setting is something like 1 pop per bar, or even lower than that, and must be lower, because if you had 1 building with the 1 pop per bar, then you`d get 10 bars to the laborpool from that one.

Also, it hasn`t had much effect on the federation intel buildings, though I got 2 bars from that 1, also tried to increase buildings to 2, and then I got 3 bars in the laborpool, when 10, then I got 11.

It seems that there are truly many, many places that have to be modified in order to get a working result.
Impress the Empress.
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

What`s this? : 0040C279 (0xb679) mov ax, [esp+188h+var_190.popCost]

And what do these mean? (I copypaste a part of the code here, if thunder or someone could describe those "cmp, jnz, xor, etc.")
0040C23D loc_40C23D: ; CODE XREF: AI_AISysDev_40C130:loc_40C18Cj
0040C23D cmp edx, 2
0040C240 jnz loc_40C17D
0040C246 xor eax, eax
0040C248 lea edx, [esp+188h+building] ; building
0040C24F mov ax, word ptr [esp+188h+buildingId] ; buildingId
0040C257 call Game_Building_REdifice_ReadBuilding
0040C25C xor eax, eax
0040C25E mov edx, esp ; building
0040C260 mov ax, word ptr [esp+188h+buildingId+2] ; buildingId
0040C268 xor esi, esi
0040C26A call Game_Building_REdifice_ReadBuilding
0040C26F xor eax, eax
0040C271 mov si, [esp+188h+building.industryCost]
0040C279 (0xb679) mov ax, [esp+188h+var_190.popCost]
0040C27E sub eax, esi
0040C280 xor edx, edx
0040C282 mov esi, eax
0040C284 mov eax, [ebx+2]
0040C287 mov dx, [esp+188h+building.id] ; buildingId
0040C28F sar eax, 10h ; systemId
0040C292 call Game_SolarAPI_4455F0
0040C297 imul eax, esi
0040C29A xor edx, edx
0040C29C mov dx, [esp+188h+var_24]
0040C2A4 mov dword ptr [esp+188h+var_14], ecx
0040C2AB sub eax, edx
0040C2AD xor ebp, ebp
0040C2AF mov [esp+188h+var_4], eax
0040C2B6 mov dword ptr [esp+188h+var_14+4], ebp
0040C2BD jmp loc_40C1D5
0040C2BD AI_AISysDev_40C130 endp
Impress the Empress.
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

Now I found these :

Pop_requirements_cmp_60_64 : 0043E5B0

Pop_to_manned energy : 00450A70

People_to_new_main_buildings : 004460F0

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

Re: Structure of edifice.bst

Post by thunderchero »

I did not see anything in those, but it might be part of it. and also shows how multiple location might need to be edited

example; People_to_new_main_buildings : 004460F0
this looks like how much pop to add when new structure is built (if population is available)

but most changes is done by trial and error. :wink:

so backup files and keep track of every test change and see what changes what.

test test test.....and more tests

thunderchero
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

What do you see here? :

AUTO:004460BC
AUTO:004460BC population_cost?: ; CODE XREF: add_building_ID_edx__system_ax+149j
AUTO:004460BC ; add_building_ID_edx__system_ax+16Ej
AUTO:004460BC cmp word ptr [esp+80h], 0
AUTO:004460C5 jbe short substract_maxpop_x10_systInfoBC?
AUTO:004460C7 mov edx, esp
AUTO:004460C9 mov eax, esi
AUTO:004460CB call people_to_new_main_buildings
AUTO:004460D0
AUTO:004460D0 substract_maxpop_x10_systInfoBC?: ; CODE XREF: add_building_ID_edx__system_ax+2D5j
AUTO:004460D0 mov eax, [esp+7Ah]
AUTO:004460D4 sub [esi+0BCh], ax
AUTO:004460DB
AUTO:004460DB exit_sysPopCap_too_low: ; CODE XREF: add_building_ID_edx__system_ax+69j
AUTO:004460DB add esp, 174h
AUTO:004460E1 pop ebp
AUTO:004460E2 pop edi
AUTO:004460E3 pop esi
AUTO:004460E4 pop ecx
AUTO:004460E5 pop ebx
AUTO:004460E6 retn
AUTO:004460E6 add_building_ID_edx__system_ax endp
AUTO:004460E6
Impress the Empress.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7934
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Structure of edifice.bst

Post by thunderchero »

Axis wrote:What do you see here? :
a lot of numbers, letters and expressions :grin:

while I might get lucky with assbly editing, it is above my skill level for the most part.

but if you look at the start of that sub-routine it says;
add_building_ID_edx__system_ax proc near

"add building" would not be where I would expect needed code to be, but may be a secondary area that might need changing.

thunderchero
User avatar
Axis
Commander
Commander
Posts: 497
Joined: Sun Aug 16, 2015 8:28 am
Location: Finland
Contact:

Re: Structure of edifice.bst

Post by Axis »

So, I`ve decided to put my focus on this Buildcoststuff

Here`s the hexcode, the whole subroutine is entirely here, but I just don`t know what to change, I notice there are some 01 00 00s around though.

AUTO:0040C130 53 51 52 56 57 55 81 EC 88 01 00 00 E8 AF E7 FF SQRVWUüýê..Þ»þ 
AUTO:0040C140 FF 89 C3 8B 40 02 C1 F8 10 69 C8 28 03 00 00 8B  ë+ï@-°i+(..ï
AUTO:0040C150 15 C8 36 5A 00 8D BC 24 60 01 00 00 8D B4 11 80 §+6Z.ì+$`..ì¦Ç
AUTO:0040C160 00 00 00 31 D2 A5 A5 A5 A5 A5 E8 D1 55 03 00 8B ...1ÊÑÑÑÑÑÞÐU.ï
AUTO:0040C170 94 24 60 01 00 00 89 C1 83 FA 01 73 0F 31 C0 81 ö$`..ë-â·s¤1+ü
AUTO:0040C180 C4 88 01 00 00 5D 5F 5E 5A 59 5B C3 0F 87 AB 00 -ê..]_^ZY[+¤ç½.
AUTO:0040C190 00 00 31 C0 8D 94 24 B0 00 00 00 66 8B 84 24 68 ..1+ìö$¦...fïä$h
AUTO:0040C1A0 01 00 00 E8 08 43 04 00 31 D2 31 C0 66 8B 94 24 ..ÞC.1Ê1+fïö$
AUTO:0040C1B0 28 01 00 00 66 8B 84 24 64 01 00 00 89 8C 24 74 (..fïä$d..ëî$t
AUTO:0040C1C0 01 00 00 29 C2 31 C0 89 94 24 84 01 00 00 89 84 ..)-1+ëö$ä..ëä
AUTO:0040C1D0 24 78 01 00 00 DB 84 24 84 01 00 00 DF AC 24 74 $x..¦ä$ä..¯¼$t
AUTO:0040C1E0 01 00 00 DE F9 E8 EA 14 11 00 DB 9C 24 7C 01 00 ..̨ÞÛ¶.¦£$|.
AUTO:0040C1F0 00 8B 84 24 7C 01 00 00 89 84 24 84 01 00 00 DB .ïä$|..ëä$ä..¦
AUTO:0040C200 84 24 84 01 00 00 83 EC 08 DD 1C 24 E8 E3 14 11 ä$ä..âý¦$ÞÒ¶
AUTO:0040C210 00 E8 BE 14 11 00 DB 9C 24 80 01 00 00 83 BC 24 .Þ¥¶.¦£$Ç..â+$
AUTO:0040C220 80 01 00 00 1E 0F 8E 52 FF FF FF B8 01 00 00 00 Ç..¤ÄR   ©...
AUTO:0040C230 81 C4 88 01 00 00 5D 5F 5E 5A 59 5B C3 83 FA 02 ü-ê..]_^ZY[+â·
AUTO:0040C240 0F 85 37 FF FF FF 31 C0 8D 94 24 B0 00 00 00 66 ¤à7   1+ìö$¦...f
AUTO:0040C250 8B 84 24 68 01 00 00 E8 54 42 04 00 31 C0 89 E2 ïä$h..ÞTB.1+ëÔ
AUTO:0040C260 66 8B 84 24 6A 01 00 00 31 F6 E8 41 42 04 00 31 fïä$j..1÷ÞAB.1
AUTO:0040C270 C0 66 8B B4 24 28 01 00 00 66 8B 44 24 78 29 F0 +fï¦$(..fïD$x)­
AUTO:0040C280 31 D2 89 C6 8B 43 02 66 8B 94 24 00 01 00 00 C1 1ÊëãïCfïö$...-
AUTO:0040C290 F8 10 E8 59 93 03 00 0F AF C6 31 D2 66 8B 94 24 °ÞYô.¤»ã1Êfïö$
AUTO:0040C2A0 64 01 00 00 89 8C 24 74 01 00 00 29 D0 31 ED 89 d..ëî$t..)ð1Ýë
AUTO:0040C2B0 84 24 84 01 00 00 89 AC 24 78 01 00 00 E9 13 FF ä$ä..ë¼$x..Ú 
AUTO:0040C2C0 FF FF
Impress the Empress.
Post Reply

Return to “General Modding Information/Questions”