Main buildings and AI

Main buildings and AI; support/discussion/questions

Moderator: thunderchero

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

Main buildings and AI

Post by DCER »

This will be a quick one :)

We all know there are major problems if you turn main buildings into special ones.

One symptom I've seen in my borg mod is that the Borg kept upgrading their research building mark 1 into implant recycle centers because the centers were occupying the spot of main research building mark 2. As a result their home planet was busy building research buildings and upgrading them all the time. Setting the right group in edifice.bst and changing bonus type didn't help.

This is now fixed in UE version 0.6.8dev12. It will set the correct values in trek.exe, thus solving those symptoms.

But before you try it, here's what you should know:


The values in trek.exe are first and last id of main building group, so:

Main buildings of a specific group and race need to be grouped together in edifice.bst. This means Cardassian main food buildings need to be placed one after the other. Same goes for the other groups of main buildings.

Main industry and food buildings of a race also need to be grouped together (industry first, food second).

UE does not yet test for these things so be careful. It takes the first group it finds (test for empire, pop req and group).

UE will now allow you to set building group yourself. It'll then translate that into race specific group code. I haven't tested if two empires can share main buildings, but UE was made to allow this - no idea how it affects botf.

The relevant values (too many to list them all) were found in these subroutines:

545008, // 0x000850F0 - main research buildings
545952, // 0x000854A0 - main intel buildings
547152, // 0x00085950 - main ind/food and en buildings
548944, // 0x00086050 - main research buildings
549824 // 0x000863C0 - main intel buildings

Have fun :)

EDIT:

The relevant values are moved to ecx in those subroutines.

EDIT2:

Cardassian main industry, food, energy and intel buildings have a maximum limit of 127 on last ID.
Last edited by DCER on Thu Jan 22, 2009 1:32 am, edited 2 times in total.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

Great work, DCER :)

So I guess it's time to think some new special buildings up ;)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

Well it seems to be working, hopefully it'll work for others too.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7930
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

DCER,

this will have many uses :wink:

I will be giving it a try soon but my plans are for more minor special stuctures maybe 2-3 each or more :lol:

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

Post by Gowron »

I tested this now. However, it does not seem to work (yet).

I replaced the first (type 1 assembly yard) and last (class 9 science center) Cardassian main building by special buildings, both accessible to any empire.

Problems:

1. No empire was able to build the new buildings in their starting systems at a tech 9 start.

2. The new building which had replaced the type 1 assembly yard was present in any new colony, being treated as a main industry building.

I did not test AI upgrading or aibld.req serviceability.

I used UE v0.6.9dev1a.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

I've found the starting building id's for the new colonies, it's already added to UE (but not uploaded) in the sense that it sets the right farm and industry ids.

I've tried setting farms to primitive farms, but that also broke upgrading.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7930
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

I also have had problems. I have left the first building and used next 4 for main structure for upgrades freeing up 4 building per area. Also I am leaving Primitive Farms unchanged in food area. so food uses 6 total and all others use 5 total.

main structure Upgrades are now working properly, and new structures that I have added are available to be built and AI is building them once aibldreq.bin was set up too.

but found one race trying to build a structure "N\A" not sure how it was displaying this but it was. to fix this I set all unused structures so nothing was selected for "can be built by" and "needed race on system". Then they stopped tring to build "N\A" structures also all unused structures were set to "other" type.

Note: N\A only happened after AI took over home system of another race. and in tool tips it showed upgrade for one of the new buildings when building had no upgrade? this was very strange behavior even for this AI. :wink:

also remember to set starting condition "starting buildings" and "starting technology" after each change.

So far this is being very tricky to keep everything setup correctly.

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

Post by Gowron »

DCER wrote:I've found the starting building id's for the new colonies, it's already added to UE (but not uploaded) in the sense that it sets the right farm and industry ids.
Thanks :)
But that first problem should be easy to work around, anyway; just leave low-level farms and low-level factories alone.

The 2nd problem seems to have been a problem with racetech.tec, not related to this topic and not related to UE :)
It's working now.
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

Good to hear you've fixed it.

I've uploaded dev2 now, it'll set the ids.
User avatar
Gowron
Code Master
Code Master
Posts: 304
Joined: Sat Apr 26, 2008 2:00 am
Location: 50° N, 11° E

Post by Gowron »

This info is already included in the UE, but has not been explicitly posted here.

These IDs determine the (two) types of buildings that are available to new colonies as initial buildings. The numbers of buildings can also be edited, see here.

First building (default: factories):

Code: Select all

Empire, default ID, asm offset, hex offset

Card., 0x058, 445070, 44470
Fedr., 0x086, 445095, 44495
Ferg., 0x0B4, 4450AB, 444AB
Klng., 0x0E2, 4450C1, 444C1
Roml., 0x110, 4450D7, 444D7
Second building (default: farms):

Code: Select all

Empire, default ID, asm offset, hex offset

Card., 0x062, 445130, 44530
Fedr., 0x090, 445195, 44555
Ferg., 0x0BE, 4451AB, 4456B
Klng., 0x0EC, 445181, 44581
Roml., 0x11A, 445197, 44597
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1925
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

Changing of the following values should allow to increase total amount of buildings in edifice.bst (in theory / untested !).


The max Structure ID differs due to the check (asm-offsets):

Code: Select all

jle -> 317 (dec)

4504E3   cmp     ax, 13D
4506D5   cmp     dx, 13D
453D02   cmp     bx, 13D
485DC1   cmp     ecx, 13D
485E94   cmp     ecx, 13D
485F43   cmp     ecx, 13D
485FCE   cmp     ecx, 13D
48604D   cmp     ecx, 13D
486072   cmp     cx, 13D
486523   cmp     bx, 13D
486B36   cmp     cx, 13D
486C28   cmp     bx, 13D
486E3E   cmp     ecx, 13D
486EE1   cmp     ecx, 13D
486F6C   cmp     ecx, 13D
486F91   cmp     bx, 13D
487352   cmp     bx, 13D
48740C   cmp     bx, 13D
4874E9   cmp     bx, 13D
4875CB   cmp     ecx, 13D
4876BB   cmp     ecx, 13D


jb  -> 318 (dec)

40B9DA   cmp     ax, 13E
40D752   cmp     bx, 13E
43AA62   cmp     bx, 13E
4F44C6   cmp     dx, 13E
So maybe its possible to add new special buildings without need of main building slots?


Building Groups in edifice.bst
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

this is now resolved see adding buildings part 1.
Post Reply

Return to “Main buildings and AI”