Colonies: population, farms, factories
Moderator: thunderchero
Re: Colonies: population, farms, factories
No need to use the hex editor if you are not familiar with it. QD made this easy for us: he has given us a tool the bof_patcher; the patches for this tool are text files editable by notepad;
There is the better_colonies patch available; you can edit the values as you like inside and use the tool to install the patch.
Here is a link to a post about the patcher:
viewtopic.php?f=4&t=2515
There is the better_colonies patch available; you can edit the values as you like inside and use the tool to install the patch.
Here is a link to a post about the patcher:
viewtopic.php?f=4&t=2515
- supertyp79
- Cadet 1st Year
- Posts: 4
- Joined: Thu May 25, 2017 8:30 am
Re: Colonies: population, farms, factories
I need help with something familiar and i'm a total loser with Editing or stuff. So i'll need a "step by step" how to do and what lines and Hexes to edit.
I don't want to have my new colonies updated to my Tech-Lv in UDM III. Also the enemies shouldn't have this either. Every new colony should start with Tech-Lv 1, but there's no need of change the quantity of the buildings for the colony ships. If there is a post for this already, please link me to, cause i've found nothing in two days of search. A kind of tutorial or maybe a short video would be more than just a little helpful.
Thanks, Manuel
I don't want to have my new colonies updated to my Tech-Lv in UDM III. Also the enemies shouldn't have this either. Every new colony should start with Tech-Lv 1, but there's no need of change the quantity of the buildings for the colony ships. If there is a post for this already, please link me to, cause i've found nothing in two days of search. A kind of tutorial or maybe a short video would be more than just a little helpful.
Thanks, Manuel
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies: population, farms, factories
Hi supertyp79,
This is a simple hex edit,
at 0x68fab change 03 D8 to 90 90
or you can use QD's patcher (in start menu in tools folder)
download this file and extract to UDM folder execute QD's Patcher from start menu
QD's Patcher will look like this first browse for new patch folder "Tech1_patch" folder next use dropdown menu to select the UDM\trek.exe UDML\trek.exe depending on what version you want to edit next select the line "UDM new colonies start at tech 1" (it should turn purple)
next select install button line "UDM new colonies start at tech 1" (it should turn yellow with + )
next select apply button.
after that you are done repeat on other UDM trek.exe if you want then close QD's Patcher
This is a simple hex edit,
at 0x68fab change 03 D8 to 90 90
or you can use QD's patcher (in start menu in tools folder)
download this file and extract to UDM folder execute QD's Patcher from start menu
QD's Patcher will look like this first browse for new patch folder "Tech1_patch" folder next use dropdown menu to select the UDM\trek.exe UDML\trek.exe depending on what version you want to edit next select the line "UDM new colonies start at tech 1" (it should turn purple)
next select install button line "UDM new colonies start at tech 1" (it should turn yellow with + )
next select apply button.
after that you are done repeat on other UDM trek.exe if you want then close QD's Patcher
- supertyp79
- Cadet 1st Year
- Posts: 4
- Joined: Thu May 25, 2017 8:30 am
Re: Colonies: population, farms, factories
Thanks Thunderchero. Buddy, you're the best.
- jonesie85two
- Lieutenant-Commander
- Posts: 201
- Joined: Sat Apr 26, 2008 2:00 am
Re: Colonies: population, farms, factories
I have added this to my mod. works like a charn. My question. Is there a version of this that works with minor races on them becoming a member of your faction?
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies: population, farms, factories
this change has nothing to do with minors, you might check out Minor Race Advancement
viewtopic.php?f=187&t=13
viewtopic.php?f=187&t=13
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies: population, farms, factories
I was planning on using the "Colonies Starting Pop and Buildings - experimental code" on mirror universe mod. but a comment by cleverwise
this would allow me to drop colony ship upgrades
example;
table entry 0 = tech 1
table entry 1 = tech 2
table entry 2 = tech 3
table entry 3 = tech 4
table entry 4 = tech 5
table entry 5 = tech 6 and so on until table entry 8 = tech 9
note; it would be nice to have a multiplier for extended techs levels "rounded down"
got me wondering if it would be possible to change testing of production value to test tech level?
this would allow me to drop colony ship upgrades
example;
table entry 0 = tech 1
table entry 1 = tech 2
table entry 2 = tech 3
table entry 3 = tech 4
table entry 4 = tech 5
table entry 5 = tech 6 and so on until table entry 8 = tech 9
note; it would be nice to have a multiplier for extended techs levels "rounded down"
- Spocks-cuddly-tribble
- Code Master
- Posts: 1960
- Joined: Sun Apr 27, 2008 2:00 am
Re: Colonies: population, farms, factories
I don't have BotF installed for hex-code, but this should work for Ollydbg:
Code: Select all
00469AD4 8A42 28 MOV AL,BYTE PTR DS:[EDX+28]
00469AD7 BA 06000000 MOV EDX,6 // tech ID = all tech aka lowest
00469ADC E8 9F9BFEFF CALL 00453680
00469AE1 48 DEC EAX
00469AE2 D1E8 SHR EAX,1 // tech level /2 rounded down
00469AE4 3C 08 CMP AL,8
00469AE6 7E 02 JLE SHORT 00469AEA
00469AE8 B0 08 MOV AL,8
00469AEA 8BF8 MOV EDI,EAX
00469AEC 90 NOP
00469AED 90 NOP
00469AEE 90 NOP
00469AEF 90 NOP
00469AF0 90 NOP
00469AF1 90 NOP
00469AF2 90 NOP
00469AF3 90 NOP
00469AF4 90 NOP
00469AF5 90 NOP
00469AF6 90 NOP
00469AF7 90 NOP
00469AF8 90 NOP
00469AF9 90 NOP
00469AFA 90 NOP
00469AFB 90 NOP
00469AFC 90 NOP
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies: population, farms, factories
thanks SCT, I will give this a try and test when I start adding this code later. Right now I am keeping trek.exe with min changes until some of other major changes are complete so I can keep track of changes better, also to insure no conflicts.
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies Starting Pop and Buildings - experimental code
I could use some help here for Mirror universe modSpocks-cuddly-tribble wrote: ↑Wed Dec 21, 2011 7:58 pm To adapt upgrade feature to reduced upgrades mods: (code is shared for all main buildings!)Code: Select all
00469B9B 48 DEC EAX // current tech level -1 00469B9C 9090 NOP -> e.g. 'dec eax' & 'shr eax,1' = [tech level-1]/2 for BoP (4 upgrades instead of vanilla 8) 00469B9E 3C 08 CMP AL, 8 // max upgrades for main buildings 00469BA2 B0 08 MOV AL, 8 // max upgrades for main buildings -> e.g. set 4 for BoP, 0 if no upgrades
MUM has 5 total main structures (4 upgrades) so set I set 469B9E and 469BA2 to CMP AL, 4 and MOV AL, 4
but since it uses 20 tech level how would I set at 469B9B ?
upgrades happen at tech 5, 10, 15, 20
note; this will not work on BOP since food has 0 upgrades, industry has 4 upgrades, energy has 0 upgrades, intel has 8 upgrades, research has 8 upgrades.
- Spocks-cuddly-tribble
- Code Master
- Posts: 1960
- Joined: Sun Apr 27, 2008 2:00 am
Re: Colonies Starting Pop and Buildings - experimental code
This depends on what you want, the colony & building values of your mod and how much effort you're willing to invest in adapting the code.thunderchero wrote: ↑Sat Apr 18, 2020 3:17 pmMUM has 5 total main structures (4 upgrades) so set I set 469B9E and 469BA2 to CMP AL, 4 and MOV AL, 4
but since it uses 20 tech level how would I set at 469B9B ?
upgrades happen at tech 5, 10, 15, 20
In theory you would use div 5, but this requires moving parts of code and adapting its jump statements.
And how bad do you want always the latest upgrades pre-built in new colonies?
For example, for my taste, I would use the middleground for colonies anyways (i.e. not the latest and not always T1). In vanilla pre-built upgrade = [techlevel -1 ] /2 (dec eax shr eax, 1). So on tech 3 the first upgrade(T2), tech 5 the second(T3) with the T9 buildings at T19.
Problem is that depending on pop, pop growth, current industry buildings overall output vs. build cost of current upgrade-level buildings, one must buy buildings to prevent unemployment in newer colonies. Not good if one is short on credits....
The closest easy workaround for you is shr eax, 3 i.e. pre-built upgrade level on colonies is techlevel /8, but this means your latest upgrade is pre-built at tech 32 and not at tech 20 in new colonies.
Current level of the building's science-area requirement / pre-built upgrade levels in new colonies:
1-7 / base buildings
8-15 / 1st upgrades
16-23 / 2nd upgrades
24- 31 /3rd upgrades
32+ / 4th upgrades
Thanks for noticing. I forgot about Gowron removing food & energy upgrades in latest BoP revision. So yes, the upgrade option of this patch must be disabled when using with BoP.note; this will not work on BOP since food has 0 upgrades, industry has 4 upgrades, energy has 0 upgrades, intel has 8 upgrades, research has 8 upgrades.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies Starting Pop and Buildings - experimental code
tbh I am not sure what code would be for dev 5 I tried 48 90 90 -> C1 E8 05 , moving parts of code and adapting its jump statements is easy enough.Spocks-cuddly-tribble wrote: ↑Sun Apr 19, 2020 9:13 amThis depends on what you want, the colony & building values of your mod and how much effort you're willing to invest in adapting the code.thunderchero wrote: ↑Sat Apr 18, 2020 3:17 pmMUM has 5 total main structures (4 upgrades) so set I set 469B9E and 469BA2 to CMP AL, 4 and MOV AL, 4
but since it uses 20 tech level how would I set at 469B9B ?
upgrades happen at tech 5, 10, 15, 20
In theory you would use div 5, but this requires moving parts of code and adapting its jump statements.
And how bad do you want always the latest upgrades pre-built in new colonies?
but now I am thinking I needed 48 C1 E8 05 then move code to make room?
edit:
ok I moved code up 1 byte reset call for sub_453680 and everything looks right in ida but does not place latest structures
here is what section looks like in ida I am lost any ideas
extra info on my upgrade list (thought it might help)
this list first column cards, first 5 down are upgrades then last upgrade repeats.
this is only way I found to get upgrades working properly.
30 00 type 1, 31 00 type 2, 32 00 type 3, 33 00 type 4, 34 00 type 5, then type 5 repeats to fill list
- Spocks-cuddly-tribble
- Code Master
- Posts: 1960
- Joined: Sun Apr 27, 2008 2:00 am
Re: Colonies: population, farms, factories
Sorry pal, but I really can't memorize all specific hex opcodes of asm statements. So no idea what your hex codes mean.
IIRC at 469B9B you must:
xor ecx, ecx (looks like an unused register)
mov cl, 5
xor edx, edx
idiv ecx
But you need more than the 3 nop bytes.
In my code at asm-469BCC are four nops you can overwrite, so you have to move the code in between down to them (and pray we missed no fixed jumps from and into this area).
EDIT: Even with this you still need one byte more. There are some free nops above, but I can't check all possible xrefs just looking at posted code.
I'd use OllyDbg.
EDIT 2: If I'm not mistaken this should work for you:
At asm 469B85 enter in OllyDbg:
CALL EBX
MOVZX EDX, BYTE [ESP+85h]
MOV EAX, [ESP+0Ch]
CALL 453680
imul eax, 0Dh
shr eax, 6
IIRC at 469B9B you must:
xor ecx, ecx (looks like an unused register)
mov cl, 5
xor edx, edx
idiv ecx
But you need more than the 3 nop bytes.
In my code at asm-469BCC are four nops you can overwrite, so you have to move the code in between down to them (and pray we missed no fixed jumps from and into this area).
EDIT: Even with this you still need one byte more. There are some free nops above, but I can't check all possible xrefs just looking at posted code.
I'd use OllyDbg.
EDIT 2: If I'm not mistaken this should work for you:
At asm 469B85 enter in OllyDbg:
CALL EBX
MOVZX EDX, BYTE [ESP+85h]
MOV EAX, [ESP+0Ch]
CALL 453680
imul eax, 0Dh
shr eax, 6
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
- thunderchero
- Site Administrator aka Fleet Admiral
- Posts: 7963
- Joined: Fri Apr 25, 2008 2:00 am
- Location: On a three month training mission, in command of the USS Valiant.
Re: Colonies: population, farms, factories
Thank you, working on saves I had setup, but will test more.Spocks-cuddly-tribble wrote: ↑Sun Apr 19, 2020 5:00 pm EDIT 2: If I'm not mistaken this should work for you:
At asm 469B85 enter in OllyDbg:
CALL EBX
MOVZX EDX, BYTE [ESP+85h]
MOV EAX, [ESP+0Ch]
CALL 453680
imul eax, 0Dh
shr eax, 6
BTW I would have never got that.
I had your first changes and crashed on turn process. I even had 8 bytes open lol
I wish I knew more about OllyDbg, but I was able to use it as you instructed.
Question will OllyDbg save changes to trek.exe? if so how.
- Spocks-cuddly-tribble
- Code Master
- Posts: 1960
- Joined: Sun Apr 27, 2008 2:00 am
Re: Colonies: population, farms, factories
This doesn't sound right, shouldn't be more than 1-2 bytes (nops) left.
Yes, but IIRC it's really nerdish in some cases.Question will OllyDbg save changes to trek.exe? if so how.
See my my hints here #3: viewtopic.php?f=72&t=598#p27485
Save code changes to exe:
Right click -> Copy to executable -> All modifications (ignore any strange warnig messages, just continue)
In pop-up "Copy to executable file" -> Copy all
In pop-up window with changed code (it's just a documentation!) -> Right click -> Save file [under different name e.g. trek1.exe]
Now just change the file names (e.g. trek.exe to trekold.exe and trek1.exe to trek.exe) and test your new code.
- I used version 110 (I think), not the newest 2+
- BotF must be installed to save code to a new trek.exe
Just a trek.exe on an usb stick won't allow for this, hence no hex code for your above request: viewtopic.php?p=52008#p48766
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.