How to add buildings

Adding Buildings to edifice.bst; support/discussion/questions

Moderator: thunderchero

How helpful/useful did you find this topic?

Poll ended at Thu Jul 14, 2011 3:35 pm

1 - I don't read English so was hard to understand the British sence of humour.
0
No votes
2 - I have no interest in trying to understand this!
1
10%
3 - I can read but FTLOG seriouly what does it all mean?
1
10%
4 - It made sence to me but I don't do Hexadecimal Modding.
2
20%
5 - I tried this and it failed so I gave up.
0
No votes
6 - Got to say it was hard work but i enjoyed doing this.
1
10%
7 - I got it to work and I am now trying some of my own ideas...I'll let you know how I get on.
3
30%
8 - Don't Know.
0
No votes
9 - Great work easy to understand and implement even though i've never used Hexadecimal Editor or got an education :)
2
20%
 
Total votes: 10

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

How to add buildings

Post by Peter1981 »

How To Add Buildings

Buildings can now be added or removed using the latest version of UE only read the following article if you want to understand the process by which buildings are added to BotF.

I hope some of you still like to understand the how part as it is a hope of mine that by laying these how-to's out for everyone to read some of you may get inspired to tackle similar problems in BotF modding. Less than a year ago I would never have attempted adding building to BotF as i considered it 'too hard' but i applied myself to various stepping stone tasks until I gained a better understanding of the tools that help analyse and ultimately mod BotF.

Peter1981 - 8th September 2010.

PART 1:- Adding Buildings to edifice.bst:


This is the first part of how to add the data for a new structure to edifice.bst

1. Extract 'edifice.bst', 'edifdesc.bst' and 'edifbnft.bst' from the STBOF.res file (you can do this in UE!) and make a copy of each so you have a backup.

2. Open the extracted file 'edifice.bst' with a hex editor (I use Free Hex Editor Neo -- you can get that here http://www.hhdsoftware.com/Products/hom ... -free.html 8).)

3. Set the byte view to 176 columns (the width of one structure entry.)

4. Scroll in the text pane until you see the start of the structure entries (it's at Offset 0x02E4.)

5. In the byte pane highlight all 176 bytes of one of the structure entries (I recommend something all five empires build e.g. Wind Turbines.)

Code: Select all

UPDATE:- DO NOT COPY THIS USE AN ENTRY FROM YOUR EDIFICE.BST :-

57 69 6e 64 20 54 75 72 62 69 6e 65 73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 57 69 6e 64 20 54 75 72 62 69 6e 65 73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 ff 7f a8 fb 5a 00 67 73 70 31 00 00 00 00 70 fb 5a 00 00 03 02 00 ff ff ff ff 07 00 00 00 09 01 26 01 22 03 00 00 c8 00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 32 00 32 00 32 00 32 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 10 00 00
6. Scroll in the text pane until you see the end of the structure entries (it's initially 0x84DD.) Select this byte and go to insert and insert the copied data here.

7. The new structure will need a new Structure ID Offset 0x0050 to 0x0051 (2 bytes) of the 176 that you've just added this need to be set one higher than the previous. (Initially it is 317 (3D 01) so the next on is 318 (3E 01).) You'll need to remember the maximum ID as the file is not in structure ID order (see 8.).

8. Now look at the first 4 bytes of the file (Offset 0x0000 to 0x0003), these show the number of structures in the file (its 3E 01 00 00 (318) remember the structure ID starts with 00 00!) so we need to increase this as well (initially its 3E 01 00 00 so next is 3F 01 00 00) This can be used to remember the next structure ID (see 7).

9. Take a look at the next 4 bytes (Offset 0x0004 to 0x0007) this is the address of the buildings address map (file offset) that come after the structure entries, since you've add one you'll need to increase this as well by 176. (Initially it's 84 DD 00 00 and will change to 34 DE 00 00).

10. You don't need to do anything else with the Hex editor to this file, so save it and add it back into STBOF.res (you can do this in UE!)

11. Open UE and open STBOF.res (if not already open), go to EDIT -> BUILDINGS -> BUILDING STATS and scroll to the bottom of the list of structures, (you should find your new structure awaiting you there) select the new structure.

12. Edit the new structure as you like (DO NOT MOVE IT! (Unless you understand what you are doing!)).

13. When you are happy with your new structures new attributes save STBOF.res and update trek.exe.

=========================================================

PART 2:- making trek.exe work with additional structures:


1. Open 'trek.exe' in a hex editor.

2. You will need to change the following values to the new maximum structure ID value, (this is the same as the value used in PART 1 step 7.) Change the bytes to the new value. (E.g. for one extra building 3D 01 becomes 3E 01).

Code: Select all

Trek.exe Assembly                   Hex Code
offset   Offset  
0x4f8e3  4504E3   cmp  ax,  13D     66 3D 3D 01
0x4fad5  4506D5   cmp  dx,  13D     66 81 FA 3D 01
0x53102  453D02   cmp  bx,  13D     66 81 FB 3D 01
0x85472  486072   cmp  cx,  13D     66 81 F9 3D 01
0x85923  486523   cmp  bx,  13D     66 81 FB 3D 01
0x85f36  486B36   cmp  cx,  13D     66 81 F9 3D 01
0x86028  486C28   cmp  bx,  13D     66 81 FB 3D 01
0x86391  486F91   cmp  bx,  13D     66 81 FB 3D 01
0x86752  487352   cmp  bx,  13D     66 81 FB 3D 01
0x8680c  48740C   cmp  bx,  13D     66 81 FB 3D 01
0x868e9  4874E9   cmp  bx,  13D     66 81 FB 3D 01
0x869cb  4875CB   cmp  ecx, 13D     81 F9 3D 01 00 00
0x86abb  4876BB   cmp  ecx, 13D     81 F9 3D 01 00 00
3. You will also need to change the following values to the new number of structures. (This is one more than the values use in 2. for the maximum structure ID value.) Change the bytes to the new value. (E.g. for one extra building 3E 01 becomes 3F 01).

Code: Select all

 
Trek.exe Assembly                   Hex Code
offset   Offset  
0xadda   40B9DA   cmp  ax,  13E     66 3D 3E 01
0xcb52   40D752   cmp  bx,  13E     66 81 FB 3E 01
0x39e62  43AA62   cmp  bx,  13E     66 81 FB 3E 01
0xf38c6  4F44C6   cmp  dx,  13E     66 81 FA 3E 01
=========================================================

Thanks to DCER, Tethys and SCT for help, support and information on solving this.
Last edited by Peter1981 on Wed Sep 08, 2010 12:38 pm, edited 11 times in total.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

Part 3 :- Making the AI use new additional structures.


1. Open UE and load STBOF.res.

2. select EDIT -> AI -> AI BUILDING REQUIREMENTS.

3. click the 'Add' button a pop up menu listing un used buildings will appear.

4. Select a building to add and either press return or select 'OK'

5. The energy requirement will be entered by UE automatically to the buildings energy requirments. (This can be adjusted if desired?)

6. Enter the Population requirement. This is the required population the system must have before the AI will build the sturcture.

7. Enter the Max.(imum) pop.(ulation) requirement. This is the number of population a system can sustain before the AI will build the structure. (i.e. the total population of all habitable & terraformed worlds.)

8. Repeat steps 3. to 7. for each new building.

9. Save STBOF.res if asked to update trek.exe select 'yes' and then close UE.

N.B. There may be structures that you wish for human players (i.e non AI) only to use. in this case remove or do not add these to this list.

=================================================

Part 4 :- Making Player & AI additional structures avaliable at the correct technology level.


1. Open UE and load STBOF.res.

2. Select EDIT -> STARTING CONDITIONS -> STARING TECHNOLOGY

3. Click the button marked 'Auto-Set All'

4. Save STBOF.res if asked to update trek.exe select 'yes' and then close UE.

N.B. This can be done manually in UE if any structures need to be remove/included at earlier/later technology levels (don't change this unless you know what you are doing).

=================================================

Part 5 :- Buildings with technology requirements over 9.


1. Open UE (0.7.1dev8 or above) and load STBOF.res.

2. Select EDIT -> SETTINGS.

3. Check the box for 'Enable experimental (not working) features'.

4. Select EDIT -> BUILDINGS -> BUILDING STATS

5. The values in 'Tech Level:' can now be set above 9.

N.B. Part 5 is experimental please remember to back up your files before you use this.

EDIT: - UPDATE
Testing has revealed that 'Tech Level:' above 10 are treated as 'Tech Level:' 10 so there is no point in seting this value above 10.

=================================================

Thanks Tethys & DCER
Last edited by Peter1981 on Mon Mar 14, 2011 4:14 pm, edited 6 times in total.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

I've added a poll to this topic which will run for one year if you've read the artical I would like a little feedback on how the How to helped you or killed your enthusiasm. Feel free to PM with any questions about this topic.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

I really thought there would be more enthusiasm to this topic. THE BUILDINGS HAVE BEEN CRACKED PEOPLE!

And its all thanks to Peter1981's hard work and determination, and several pages of DCER's, SCT's, and the other Code Masters' analysis!

Sorry for not saying this sooner Peter, but great job! This is definitely the best improvement of 2010 :D

Btw I voted #7 lol
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
jigalypuff
Past Administrator
Past Administrator
Posts: 238
Joined: Sat Apr 26, 2008 2:00 am

Post by jigalypuff »

This is great, now new minors can actually be added without replaceing old ones, well done man
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

You can do this Jig? ;)

Peter and I took a look at minors, at most we might be able to get 1-2 extra ones in without major code rewrite, Ive already got one extra to show up in UE but has no minor race attitude and crashes on load. Lots of things need to be changed i think..
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

I've split the discussion of minors off to this topic:-
viewtopic.php?name=Forums&file=viewtopic&p=21926#21926
User avatar
DOT
Lieutenant-Commander
Lieutenant-Commander
Posts: 100
Joined: Tue Dec 23, 2008 3:00 am
Location: 49°N, 8°E

Post by DOT »

Helllo Peter1981,

I added two new buildings and checked at round 209, if AI had build the new buildings, when criteria were meet.

It works wonderful! Thank you for your great work! :D
life long and prosper
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

Great news what were your building dot?
User avatar
DOT
Lieutenant-Commander
Lieutenant-Commander
Posts: 100
Joined: Tue Dec 23, 2008 3:00 am
Location: 49°N, 8°E

Post by DOT »

Uh, since I have only the german version on pc at the moment I have to translate the building names...

science:
- elite university
- elite learning hall
- elite laboratory
- elite center for science
- elite research laboratory
(=> all once per system)

energy
- biogasconverter (jungle planet)
- geothermal power plant (volcanic planet)
- solar collectors (desert)
- tidal power plant (oceanic planet)
=> for every planet type one energy building

morale
- local goverment
- local embassy

intel
- communication monitoring
- observation services
- espionage prevention

production
- industry replicator

farms
- privat hunting grounds
- soyburger generator (lol, sr's greeting)

these are some ideas or were introduced by others.
life long and prosper
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

A suggestion for Gas Giant energy structure could be Deuterium Plant or Station, since Giants contain Hydrogen sometimes heavy hydrogen aka deuterium, could be converted to energy (instead of in normal cases starship fuel)
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

interesting idea tethys :) - I myself am tweaking the extra building that I've added :p
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 is great work :)

Seems like there's no limitation that is safe from the AFC community ;)
A discovery consists in seeing something everybody has seen and at the same time thinking something nobody has thought yet.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

Gowron Said:
This is great work :)

Seems like there's no limitation that is safe from the AFC community ;)
thanks for the kind comments Gowron :D How unbalancing does 60 more building make Bop?
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

Also, we still have a problem with Buildings not being available (requirements) above Tech 9 with the Tech Level extension viewtopic.php?name=Forums&file=viewtopic&t=1452

I dont suppose there is an easy way around this? ;)
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
Post Reply

Return to “Adding Buildings to edifice.bst”