aibldreq.bin , AI building behaviour

AI building behaviour (aibldreq.bin); support/discussion/questions

Moderator: thunderchero

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

aibldreq.bin , AI building behaviour

Post by Gowron » Thu May 01, 2008 4:57 pm

Originally this was a reply to a very old topic where Joker had raised the question how the aibldreq.bin file worked.

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


I know I'm not topping the newest thread here, but "just because something's old doesn't mean you throw it away." (Geordi, "Relics") ;)


This file contains "AI Building Requirements" (hence the name). To prevent the AI from building a covert sensor array in that tiny pop 60 system that just can't make use of it, this file contains some minimum values that a system must provide for each building, before the AI can build it in that system.


In aibldreq.bin there are 77 data groups, each group contains the data for one building. Some buildings are left out (see below). Each group consists of 6 integer values (4 bytes per value), some of them are signed (see below).


1st value (not signed):
Building ID.
The file contains every building with an ID of 0x57 or less, except for shipyards and emergency morale programs. It does contain "Trade Goods".


2nd value (not signed):
Current population that the system must have before the AI can build the building there.


3rd value (not signed):
Maximum population that the system must provide before the AI can build the building there. Planets that have yet to be terraformed are not counted in.


4th value (signed):
Required enery for the building (quite obvious if you look at the values in the file). The AI is able to ignore this value, at least sometimes. At least 2 buildings don't have the correct value by default (Phoenix Facility and Obsidian Order).


5th value (signed):
Unknown.
If the value is set to +100 or less, the AI seems to be able to build the building everywhere (unless another restriction is not fulfilled, of course). If it's set to +101 or more, the building is not built at all.


6th value (signed):
Unknown.
This value does not seem to be used at all. By default, it's +1 for the labor camp, +2 for the forced labor farm and -10 for any other building. I gradually increased this value up to +1280 and also tried changing it to -256, with no effect at all.



As a "side effect" of the tests, I gained some insight into the building behaviour of the AI:
  • The AI will rush-buy most buildings. On the other hand systems will often just sit there producing nothing.
  • The AI ignores the "once per empire" restriction, instead the restriction is treated as "once per system". Thus, it can (and will) build multiple Great Halls or Genesis Labs, for example. And all of the buildings will have their full effects. To work around this, you could either restrict certain buildings to "home system only", or, if you're playing tech 5 and the respective building is already present in the AI player's home system, then you can use one of the two population-related values in aibldreq.bin and set it high enough that it can't be reached by any system.
  • The AI can build Isolinear Scanners without having to build Subspace Scanners or Listening Posts first.
  • Among the buildings that are available for a system (and included in aibldreq.bin), the AI will build the building with the lowest ID first, working its way down the list. When the ID 0x12 (trade goods) is reached, the system will explicitly build "trade goods" for one turn, then move on the next building. Other buildings (ID > 0x57) and shipyards can be built in-between when needed, also sometimes a system will just "have a break" and do nothing for one or more turns.
  • However, the AI will not build an Orbital Battery when it "reaches" the corresponding ID, instead the OB will just be ignored. The AI will, instead, build one OB per 50 millions of population (rounded down).

User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER » Sun Nov 09, 2008 7:46 pm

Just to add some info...

Exactly 7 buildings have energy requirement set in aibldreq.bin that is different from the one in edifice.bst

Those are:

Phoenix Facility (10/30)
Trade Center (10/20)
Obsidian Order (200/300)
Harvesting Complex (10/50)
Research Think Tank (250/200)
Research Committee (100/130)
Science Academy (150/170)

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

aibldreq.bin (24 bytes per row / building)

Post by Spocks-cuddly-tribble » Sun Mar 18, 2012 5:34 pm

The values 4 (required energy) and 6 (morale penalty marker?) are not used.

5th value = required % of the systems maximum population

Unterraformed planets do not count (cf. value 3), thus terraforming temporarily lowers the percentage.

NOTE: Some special codes (e.g. for strategic yard placement) ignore aibldreq.bin and other requirements (like planet-types or dilithium).

Gowron wrote:The file contains every building with an ID of 0x57 or less, except for shipyards and emergency morale programs.
Looking at the code, the AI wants to build more shipyards (and ships) but missing entries in aibldreq.bin prevent this, except for strategic yard placement.

I just did a quick test with promising result (vanilla T8, ferengi AI, 30 turns unmodded vs. 30 turns yard entry in aibldreq.bin). They built the yards and ships, many ships... More testing would be wise, of course. :wink:

Shipyards in aibldreq.bin also could be a key factor for AI expansion on larger maps, since the strategic yard placement checks only medium range and a max distance of 10 sectors for opponents.

Gowron wrote:Among the buildings that are available for a system (and included in aibldreq.bin), the AI will build the building with the lowest ID first, working its way down the list.
Due to trek.exe code, sorting of the aibldreq.bin entries doesn't matter.

Gowron wrote:the AI will not build an Orbital Battery when it "reaches" the corresponding ID, instead the OB will just be ignored. The AI will, instead, build one OB per 50 millions of population (rounded down).
Corresponding pop checks:

Code: Select all

0040AF37                 cmp     edx, 32h
0040AF44                 mov     ebx, 32h

0040BB63                 cmp     edx, 32h
0040BB7A                 mov     eax, 32h
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Re: aibldreq.bin , AI building behaviour

Post by Peter1981 » Tue Mar 20, 2012 7:21 am

Thanks SCT -- the seems to be no limits to your hard work. Ive just added the shipyards to AIbldreq.bin and seems to work great. I used the following:-

Code: Select all

0f 00 00 00  32 00 00 00  64 00 00 00  19 00 00 00  14 00 00 00  f6 ff ff ff
15 00 00 00  32 00 00 00  64 00 00 00  19 00 00 00  14 00 00 00  f6 ff ff ff
34 00 00 00  32 00 00 00  64 00 00 00  19 00 00 00  14 00 00 00  f6 ff ff ff
36 00 00 00  32 00 00 00  64 00 00 00  19 00 00 00  14 00 00 00  f6 ff ff ff
37 00 00 00  32 00 00 00  64 00 00 00  19 00 00 00  14 00 00 00  f6 ff ff ff
57 00 00 00  32 00 00 00  64 00 00 00  19 00 00 00  14 00 00 00  f6 ff ff ff
As you can see the values I chose were
  • pop. req. = 50
    max. pop. req. = 100
    energy req. = 25
    % pop. req. = 20
:arrow: did you use similar values?

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

Re: aibldreq.bin , AI building behaviour

Post by Spocks-cuddly-tribble » Thu Mar 22, 2012 2:57 pm

Yes, this works. But note that the minor race shipyard makes no sense in aibldreq.bin, the same goes for modifying the energy values (unused, just ignore them).
Peter1981 wrote: :arrow: did you use similar values?
All values =1 for testing purpose to enable the AI to build shipyards earlier on new colonies for faster exploration & expansion (could be too fast for small maps). One could also try race specific values e.g. higher for xenophobic races.
On the verge of a nervous breakdown? Try the relaxing tribble sounds.

Post Reply

Return to “AI building behaviour (aibldreq.bin)”

Who is online

Users browsing this forum: No registered users