"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: 7936
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

"Automatic" Build function test

Post by thunderchero »

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: 1928
Joined: Sun Apr 27, 2008 2:00 am

Re: "Automatic" Build function test

Post by Spocks-cuddly-tribble »

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  // IF  current system max pop > current pop
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

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
Last edited by Spocks-cuddly-tribble on Tue May 10, 2022 9:54 am, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7936
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: "Automatic" Build function test

Post by thunderchero »

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: 1928
Joined: Sun Apr 27, 2008 2:00 am

Re: "Automatic" Build function test

Post by Spocks-cuddly-tribble »

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)
Last edited by Spocks-cuddly-tribble on Tue May 10, 2022 9:19 am, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1928
Joined: Sun Apr 27, 2008 2:00 am

"Automatic" Build function - Upgrade foreign structures bug fix

Post by Spocks-cuddly-tribble »

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

Issue: 'Automatic build' upgrades foreign structures ignoring the own tech levels.

Code: Select all

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

-asm--
0042E04C  ^74 AA    JE SHORT 42DFF8 // exit no upgrade
Last edited by Spocks-cuddly-tribble on Tue May 10, 2022 1:25 pm, edited 3 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1928
Joined: Sun Apr 27, 2008 2:00 am

AI Allocation of Manpower

Post by Spocks-cuddly-tribble »

I add this info into this thread because of the shared/similar codes for food and energy requirements. :smile:


The labor pool of AI systems is governed by:

- Staff requirements for Food & Energy

- Remaining workers allocated via research & intel multipliers (remainder to industry) depending on:


System State: Idle vs Busy (building something)

SysDevPlan: 0 Industry (e.g. designated for BldShp) or 1 Default

Production Focus: (global feature regulating research vs intel outputs) 0 Balanced (1 Food/ 2 Industry =unused/local) 3 Research / 4 Intel

Known empires: All unknown -> try to add intel pop to research then the rest to industry (else the order is research, intel, industry)


The multipliers are 8 bytes floating point values in trek.exe at 0x189518 (asm-58B718)

Production Focus 0-4: (1/2 unused by default ; set in sub_40DCA0)

Code: Select all

Research Idle:
0.4 0.4 0.3 0.5 0.2 - SysDevPlan Industry
0.6 0.6 0.5 0.7 0.3
Intel Idle:
0.3 0.2 0.2 0.2 0.5 - SysDevPlan Industry
0.4 0.4 0.5 0.3 0.7
Research Busy:
0.2 0.1 0.2 0.2 0.1 - SysDevPlan Industry
0.4 0.3 0.3 0.5 0.2
Intel Busy:
0.1 0.0 0.1 0.1 0.2 - SysDevPlan Industry
0.3 0.2 0.3 0.2 0.5
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1928
Joined: Sun Apr 27, 2008 2:00 am

'Required Food' fix for "Automatic" Build function and AI

Post by Spocks-cuddly-tribble »

I found a possible cause for the AI building unneeded main food.

AI codes overwrite my "required food for maximum growth" systInfo fix (later auto corrected for player GUI): viewtopic.php?p=32778#p32778

Code: Select all

NAME: 'Required Food' fix for "Automatic" Build function and AI (helps AI systems to grow better and waste fewer resources)
DESC: Skips dysfunctional AI multipliers and sets optimal food output for max growth.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?p=56457#p56457

>> 0x41258 83 FD 01 0F 83 CA 03 00 00 85 ED 75 04 66 8B 79 1A
<< 0x41258 0F B7 79 1A 85 ED 74 09 8B 06 E8 09 1C 00 00 8B F8

#00441E58     0FB779 1A     MOVZX EDI, WORD[ECX+1A] // set food consumption = current pop
#00441E5C     85ED          TEST EBP, EBP  // can grow marker
#00441E5E     74 09         JE SHORT 441E69  // if max pop use current pop
#00441E60     8B06          MOV EAX, [ESI] // system ID
#00441E62     E8 091C0000   CALL 443A70 // GetCurrentSytemPopCap
#00441E67     8BF8          MOV EDI,EAX  // set REAL required food for maximum growth
Ignore conflict when overwriting outdated patch (deleted in above "Automatic" Build function & AI posts).


thunderchero wrote: Mon Jun 27, 2016 8:20 amfrom my tests it does not consider special energy/food structures in system's consumption?
Tech level bonus hotfix is from May 04, 2018: viewtopic.php?p=49015#p49015

So if tests were done with a tech level bonus factor mod, all above features couldn't read the right system bonuses?


Also by default the features use 'preview mode' (ok for player displays and GUI warnings), but this could be an issue for some AI codes?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7936
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: 'Required Food' fix for "Automatic" Build function and AI

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue May 10, 2022 9:28 am
thunderchero wrote: Mon Jun 27, 2016 8:20 amfrom my tests it does not consider special energy/food structures in system's consumption?
Tech level bonus hotfix is from May 04, 2018: viewtopic.php?p=49015#p49015

So if tests were done with a tech level bonus factor mod, all above features couldn't read the right system bonuses?


Also by default the features use 'preview mode' (ok for player displays and GUI warnings), but this could be an issue for some AI codes?
I would guess not since that question was asked before that Tech level bonus hotfix was created.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1928
Joined: Sun Apr 27, 2008 2:00 am

Re: "Automatic" Build function test

Post by Spocks-cuddly-tribble »

Sorry, my question was unclear. Do you recall whether the test subject was vanilla or a mod (no hint in main post)?

But anyways, there is still more unclear issues e.g. above foreign upgrade fix and this:
Deimos wrote: Sun Oct 17, 2021 11:31 pmone of the annoyances I find about the auto build is it continues to build and upgrade research stations despite reaching the end of tech (level 9).
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7936
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: "Automatic" Build function test

Post by thunderchero »

Spocks-cuddly-tribble wrote: Wed May 11, 2022 9:35 am Sorry, my question was unclear. Do you recall whether the test subject was vanilla or a mod (no hint in main post)?
it was 6 years ago lol

I do not recall, my guess would be it was NBU mod (without AI building behavior fix). But it might have been vanilla.

when I saw your post yesterday I was mid game on MUM so I switched races to look at AI population allocations. Allocation was good,
Post Reply

Return to “General Chat”