"Automatic" Build function test

You can talk about anything. (please read forum rules before posting)

Moderator: thunderchero

Post Reply
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 5894
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

"Automatic" Build function test

Post by thunderchero » Sat Jun 25, 2016 2:42 pm

Hi everyone,

Auto build was recently brought up here by EnPhreg

So I thought I would do some testing. :smile:

the Auto build does work. just not how everyone wants it to work. it would be very helpful if you could specify on how to set up each system. (industry, intel, research, energy or balanced)

first what Auto build will do
build/upgrade only main structures
will not remove items you add to build queue even ships :wink:
once all main structures are upgraded to current tech level auto build will build nothing :shock:
you can speed up/buy queue items without effecting auto build

My question is how it decides how many of each type to build? it looks to be based on max pop

intel 17% of max pop
research 17% of max pop
industry 55% of max pop
food 30% of max pop
energy 5% of max pop

So if you use this info you can make use of this function with minimal micromanagement.

this is how I used this function

first does system have special energy structures, if so buy them
calculate how much energy the structure you want in this system will need
if needed buy energy main structures.
buy special structure that use energy
move population if needed to energy to power structures
on last purchase set to automatic

after 50 - 75 turns check on system,
now depending on how you plan on using system, add structures to build list.
if industry system add industry structures to queue
if intel system add intel structures to queue
if research system add research structures to queue

allow the auto function to run, but you need to optimize system every 20 - 30 turn by adjusting population allocation and make sure all structures are powered.

could I have built the systems quicker and better? yes
did it decrease how much time I spent doing micromanagement? yes
will I continue to use auto build function? yes

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

Re: "Automatic" Build function test

Post by Spocks-cuddly-tribble » Sun Jun 26, 2016 3:37 pm

thunderchero wrote:My question is how it decides how many of each type to build? it looks to be based on max pop
Food & Energy just check the system's consumption, other are based on population and shipyards.

Trek.exe multipliers:

Code: Select all

- Food -
ensure the system's current Food consumption * 1.25
DGROUP:0057896C               dq 1.25

- Industry -
0.6 (shipyard)
AUTO:0042EBF8                 mov     edi, 33333333h
AUTO:0042EBFD                 mov     ebp, 3FE33333h
0.3  (no  shipyard)
AUTO:0042ECD8                 mov     ecx, 33333333h
AUTO:0042ECDD                 mov     esi, 3FD33333h

- Research -
0.2 (shipyard)
AUTO:0042E9F8                 mov     edi, 9999999Ah
AUTO:0042E9FD                 mov     ebp, 3FC99999h
0.4 (no shipyard)
AUTO:0042EAD8                 mov     ecx, 9999999Ah
AUTO:0042EADD                 mov     esi, 3FD99999h

- Intel -
0.2 (shipyard)
AUTO:0042E7F8                 mov     edi, 9999999Ah
AUTO:0042E7FD                 mov     ebp, 3FC99999h
0.3 (no shipyard)
AUTO:0042E8D8                 mov     ecx, 33333333h
AUTO:0042E8DD                 mov     esi, 3FD33333h
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Re: "Automatic" Build function test

Post by thunderchero » Mon Jun 27, 2016 8:20 am

Spocks-cuddly-tribble wrote:Food & Energy just check the system's consumption, other are based on population and shipyards.
this just brings up other questions.

1. can energy check be edited separately from food?
2. from my tests it does not consider special energy/food structures in system's consumption?
3. any other info on Auto build?

great info to have though, I think I can still use this to adjust it to my personal use.

example I would have;
food check is good for me (might set to 1.10 instead of 1.25)
no check for energy (I set this up before turning on auto build)
0.8 industry with and without shipyard
0.6 Intel with and without shipyard (depending on race I am playing)
0.2 research with and without shipyard (depending on race I am playing)

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

Re: "Automatic" Build function test

Post by Spocks-cuddly-tribble » Mon Jun 27, 2016 10:49 am

Note that

- sub_42EE40 is shared with the AI, so all changes might affect AI system building behavior

- the whole code is implemented in a VERY intricate way e.g. energy and especially food code is loaded at least five times (i.e. skipping energy for player systems has to be done at least five times)

- there are checks for static bonuses (e.g. Aquaculure Center & Wind turbine) but this doesn't prove the whole code works correctly

- altering techlevel bonus factors(default 2%) or minimum industry value(default 5) will distort auto build & AI features

- food multiplier (1.25) is only used if the system still can grow (unterraformed planets do not count)

Given this fix: viewtopic.php?f=157&t=58#p32778 food code can be optimized (no multiplier):

Code: Select all

remove:
AUTO:00441E58                 cmp     ebp, 1
AUTO:00441E5B                 jnb     food_1_25_still_growth
AUTO:00441E61                 test    ebp, ebp
AUTO:00441E63                 jnz     short loc_441E69
change:
AUTO:00441E65                 mov     di, [ecx+1Ah]   -> mov     di, [ecx+1Ch]
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

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

Re: "Automatic" Build function test

Post by Spocks-cuddly-tribble » Sun Jul 03, 2016 10:07 am

It's even more intricate. After the upper numbers are reached, and there are no more upgrades available, the below multipliers apply:

Code: Select all

- Industry -
0.7 (shipyard)
AUTO:0042E5F8                 mov     edi, 66666666h
AUTO:0042E5FD                 mov     ebp, 3FE66666h
0.3 (no  shipyard)
AUTO:0042E6D8                 mov     ecx, 33333333h
AUTO:0042E6DD                 mov     esi, 3FD33333h

- Research -
0.5 (shipyard)
AUTO:0042E3F8                 mov     ebp, 3FE00000h (fist part 0 is hard-coded)
0.7 (no shipyard)
AUTO:0042E4D3                 mov     ecx, 66666666h
AUTO:0042E4D8                 mov     esi, 3FE66666h

- Intel -
0.4 (shipyard)
AUTO:0042E1F8                 mov     edi, 9999999Ah
AUTO:0042E1FD                 mov     ebp, 3FD99999h
0.7 (no shipyard)
AUTO:0042E2D8                 mov     ecx, 66666666h
AUTO:0042E2DD                 mov     esi, 3FE66666h
I didn't test it, but looking at the code this should fix the auto-upgrade bug mentioned here: viewtopic.php?f=187&t=13#p5297

Code: Select all

trek.exe at 0x2D44D change 0x19 to -> AA

-asm--
0042E04C  ^74 AA    JE SHORT 42DFF8 // exit no upgrade
EDIT:

Also here is the hex-code for the food fix I suggested above (might help AI systems to grow a bit better and waste less resources):

Code: Select all

trek.exe at 0x41258 change 0x11 bytes to

90 90 90 90 90 90 90 90 90 90 90 90 90 66 8B 79 1C


-asm--
00441E58   90            NOP
00441E59   90            NOP
00441E5A   90            NOP
00441E5B   90            NOP
00441E5C   90            NOP
00441E5D   90            NOP
00441E5E   90            NOP
00441E5F   90            NOP
00441E60   90            NOP
00441E61   90            NOP
00441E62   90            NOP
00441E63   90            NOP
00441E64   90            NOP
00441E65   66:8B79 1C    MOV DI,WORD PTR DS:[ECX+1C]
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

Post Reply

Return to “General Chat”

Who is online

Users browsing this forum: No registered users