Offsets for AI Ship Design Tables

Information, How-to's, and discussion about mod'ing Master of Orion II.
Meson
Posts:4
Joined:Mon Jun 25, 2012 11:01 pm
Offsets for AI Ship Design Tables

Postby Meson » Mon Jun 25, 2012 11:43 pm

Greetings!

Well, I fired up MOO2 this past weekend after a long hiatus, and it wasn’t too long before I was vaporizing huge AI fleets with my 22 “Mongoose” battleships. After the fun of that wore off, I pulled out my MOO2 Official Strategy Guide and went looking for some better competition. It took a few hours, but I found it:

OFFSETS FOR AI SHIP DESIGN TABLES

Orion2.exe – 1F7904 thru 1F7D83
Orion95.exe – 155B70 thru 155FEF
1152 bytes

There are 8 ship tables, not 6 as shown in the guide, so there can be 8 different models for a given size ship. This may be the reason the AI ships often have numerals I – VIII in their name, but the numeral doesn’t always match the table used to build the ship, and varies by race. The ships may simply be numbered by which model was built first, or some other factor.

Each table has 144 bytes which are percentages of 12 categories of equipment to be installed in the available ship space. There are 24 bytes (12 words) for each of the 6 ship sizes, from smallest to largest.

Table 1 matches the “Standard Beam” model from figure 4-15 in the strategy guide, and looks thusly (from Orion95.exe, spaced for clarity):

(Frigate)
FF FF FF FF FF FF 0F 00 FF FF FF FF FF FF FF FF
FF FF 55 00 FF FF 00 00

(Destroyer)
                                     0A 00 00 00 FF FF 05 00
FF FF FF FF FF FF FF FF 2D 00 1E 00 FF FF 0A 00

(Cruiser)
0F 00 00 00 FF FF 00 00 FF FF FF FF FF FF 0A 00
1E 00 1E 00 FF FF 0F 00

(Battleship)
                                     0F 00 00 00 FF FF 05 00
FF FF FF FF FF FF 0F 00 19 00 19 00 FF FF 0F 00

(Titan)
0F 00 00 00 FF FF 0A 00 FF FF FF FF FF FF 0F 00
19 00 14 00 FF FF 0F 00

(Doom Star)
                                     0F 00 00 00 FF FF 0F 00
FF FF FF FF FF FF 0F 00 14 00 14 00 FF FF 0F 00

There are a few anomalies, but as near as I can figure, these are the 12 equipment categories:

Word 1    Theme Special -- specials based on one of 7 racially assigned themes (according to guide)
   a. Bio Weapons -- teleporter, augmented engines, death spores, etc
   b. Capture -- transporters, assault shuttles, tractor beam, troop pods, etc
   c. Cloaking -- cloaking device, stealth field, phasing cloak
   d. Beam Defense -- inertial stabilizer/nullifier, augmented engines
   e. Missile Defense -- jammers, lightning field, spatial compressor, anti-m rockets , etc
   f. Armor -- heavy armor, reinforced hull, automated repair
   g. Shield -- hard shields, multi-phased shields, shield capacitors
Word 2    Beam Special
Word 3    Missile Special
Word 4    Defense Special
Word 5    Special Weapon
Word 6    Special Device
More information on categories 1-6 can be found in this thread viewtopic.php?t=492
Word 7    Missile x5 or Torpedo
Word 8    Missile x2 or Torpedo
Word 9    Heavy Beams
Word 10   Beams
Word 11   Point Defense Beams
Word 12   Bombs


So using the battleship from table 1 above as an example, it would contain:
15% theme specials (word 1 - 0F 00)
0% beam specials (word 2 - 00 00)
5% defense specials (word 4 - 05 00)
15% missile x2 or torpedo (word 8 - 0F 00)
25% heavy beams (word 9 - 19 00)
25% beams (word 10 - 19 00)
15% bombs (word 12 - 0F 00)

I have tried changing some of the FF FF word values in the tables, but they seem to be ignored, so it probably indicates an invalid selection for that ship. The 00 00 values can be changed, and I suspect they are there so any unused/leftover percentages from previous categories will carry over into the next valid slot. I’m not certain that always happens.

Note that all the ships in table 1 have 0% beam specials, which explains why the AI never uses specials like the Achilles unit. This is the first setting I tested with and I got the AI to produce some rather potent ships bristling with heavy Plasma Cannons and the HEF/Achilles/Structural Analyzer beam trifecta. Unfortunately, the other 7 ship design tables have the FF FF in the beam specials slots, and changing it had no apparent effect.

The other 7 tables are formatted in the same fashion

Table 2 matches the “Hybrid” model from figure 4-17 in the guide. Heavy beams, beams, bombs and a decent complement of 5x missiles.

Table 3 is just like table 2 except uses 2x missiles instead of 5x.

Table 4 is very close to the “Standard Missile” model from figure 4-16 in the guide. The numbers in the guide show high percentages of bombs and low percentages of 10x missiles. The game code has lots of 2x missiles and only a few bombs. It may be a typo in the strategy guide, but needs verification.

Table 5 is close to the “Carrier” model from figure 4-18 in the guide. The guide shows high percentages of bomber bays, but in the code those numbers are in word 7, which was used for missile x5 in the Hybrid model. Perhaps word 7 is used for bomber bays, and word 8 is all missiles, with some other factor determining the ammo count. Or some tables could be interpreted differently than others. Lots of testing needed.

Table 6 matches the “Special Device” model from figure 4-20 in the guide. See Buddenbrook’s thread referred to in the equipment categories section above for details on special devices. This may be where the dreaded security stations come from.

Table 7 is similar to table 8 except the Doom Star has no beam weapons and a higher percentage of special weapons.

Table 8 matches the “Special Weapon” model from figure 4-19 in the guide. Again, see Buddenbrook’s thread for details.

Much of this was taken from the strategy guide, so is subject to verification. Any insights, additions, corrections or comments are most welcome. Among other things, I am curious to see if more than 100% of the ship space can be allocated.

Apologies if this is already posted elsewhere, but I could not find it among all the excellent info posted here. Happy modding!

Meson

User avatar
Overlord2
Posts:661
Joined:Wed Jun 13, 2007 5:25 pm

Postby Overlord2 » Sat Jul 28, 2012 5:54 am

Hi,
Very nice work from you, thanks. Few questions on the subject, though.
Do you have any ideas, or guesses how to overcome the ignored types problem? Or why is this problem?
Also, you were refering to the Strategy Guide, where AI behaviour is documented. Could you give a link for the Guide, please?
About space allocation for AI ships, it seems the space for AI ships is hardcoded elswhere, i.e. it takes other data than in 'Ships' table of the OCL. So it won't use more equipment than the hardcoded space allows. Any confirmation?

And one more question - there are 7 AI themes, but 8 groups of AI designs, how does they match?

Meson
Posts:4
Joined:Mon Jun 25, 2012 11:01 pm

Postby Meson » Sun Jul 29, 2012 7:05 pm

Thanks, Overlord2!

Do you have any ideas, or guesses how to overcome the ignored types problem? Or why is this problem?
If you mean the FF FF values, I believe the game code simply will not read any values placed into those slots. It hasn't worked for me, anyway. It's not really a problem, it just reduces the flexibility of modding the tables. There are some ways to compensate for that which I'll get to shortly...

Also, you were refering to the Strategy Guide, where AI behaviour is documented. Could you give a link for the Guide, please?
Sorry, I'm not aware of any site where the Strategy Guide is published online. I have the original book, ISBN 0-7615-0273-4. I still see cheap used copies on eBay.

About space allocation for AI ships, it seems the space for AI ships is hardcoded elswhere, i.e. it takes other data than in 'Ships' table of the OCL. So it won't use more equipment than the hardcoded space allows. Any confirmation?
Yes, the hull space for each ship class is hardcoded somewhere else, but the ship design tables can, in fact, be used to allocate much greater than 100% of that space by increasing the default percentages so they add up to more than 100%. I have used values up to 240% for just a single equipment category. Just this morning the AI send a fleet of Doom Stars at me each equipped with 441 Pulasrs, 55 Heavy Mauler Devices and 14 special devices installed (Achilles Unit, Augmented Engines, Battle Pods, Battle Scanner, Displacement Device, Heavy Armor, HEF, Hyper-X, Structual Analyzer, SS Teleporter, Reinforced Hull, Reflection Field, Rangemaster, Quantum Detonator). Also, by tweaking the various equipment lists for the themes and specials, it is possible to have the AI use the Time Warp Facilitator with a Phasing Cloak, or a Damper Field and a Class X Shield on the same ship, and other potent combinations.

And one more question - there are 7 AI themes, but 8 groups of AI designs, how does they match?
There is no real correlation; the 7 Theme Specials are just one of the 16 equipment categories. All of the 8 AI ship designs will use a percentage of hull space for one of the Theme Specials (whichever theme is assigned to the race building it). In the example from my original post, the battleship uses 15% of available space for Theme Specials. So if the Darloks are building it, the 15% of devices/weapons installed will come from whichever of the 7 themes is assigned to that race (Theme 3: Cloaking, I believe).

These are the 7 equipment lists for the themes. Items are installed in the order listed, if the given race has the tech. (starting offsets from orion95.exe):

1. Bioweapons   :1559C0   (I suspect this theme is only used by Repulsive races)
Phase Shifter (not used)
Sub Space Teleporter
Augmented Engines
Bio Terminator
Death Spores

2. Capture   :1559D8   (Probably races with ground combat bonuses)
Transporters
Tractor Beam
Assault Shuttles
Troop Pods
Warp Dissipator

3. Cloaking   :1559F0
Phasing Cloak
Cloaking Device
Stealth Field

4. Beam Defense   :155A00
Inertial Nullifier
Displacement Device
Augmented Engines
Inertial Stabilizer

5. Missile Defense   :155A10
Wide Area Jammer
Multi-Wave ECM Jammer
Spatial Compressor
ECM Jammer
Pulsar
Displacement Device
Lightning Field
Anti-Missile Rockets

6. Armor   :155A30
Automated Repair Unit
Heavy Armor
Reinforced Hull

7. Shields   :155A40
Hard Shields
Multi-Phased Shields
Shield Capacitors

Each race will use only one of these themes on their ships as far as I know, but each of the 8 ship design tables does have an allocation for Theme Specials; it is the first of the 16 values for each shp (as shown in the original post).

So how does the AI decide which of the 8 ship design tables to use?

From information in the Strategy Guide and some initial testing, here's what I have so far...

Each race is assigned one of 4 "Design Themes" used to determine which ship design table to use when a new ship is built. A random number from 1-20 is generated, then the 20-byte Design Theme Map is checked to see which of the 8 designs to use. I believe these are the 4 Design Theme Maps (orion95.exe offsets)


Design Theme Map 1    :6B7BC
00 00 00 00 00 00 00 00 00 00 00 00 00 01 02 03 04 05 05 06

Design Theme Map 2    :6B7EC
00 01 02 02 02 02 02 02 02 02 02 02 02 02 02 03 03 03 04 05

Design Theme Map 3    :6B81C
00 01 01 01 01 01 01 01 01 01 01 01 01 01 02 03 03 03 04 05

Design Theme Map 4    :6B858
00 01 02 03 03 04 04 05 05 05 05 06 06 06 06 07 07 08 08 08


It appears that 00-07 correspond to the Ship Design Tables 1-8. I don't know what the 08 entries at the end of the fourth map are; when I change all the entries in that map to 08, the game crashes.

The Strategy Guide mentions that the Design Themes are assigned based on racial attributes, which I take to mean hardcoded, but I swear the Elerians used Map 1 in one game and Map 4 in a different game. more testing needed.

So if a race was assigned Design Theme Map 1, and the random number was from 1-13, it would build from the first ship design table (00), which are beam ships. I'm not sure how the ship size is chosen, it may just be the largest size that colony can complete within a certain amount of time.

So modifying these values along with the equipment lists is a way to minimize the limitations of all the FF FF values in the ship design tables which I can't find a way to change. For example, if you want a particular race to use Beam Specials (available only in Ship Design Table 1) or Special Weapons (available only in ship design table 6) on all their ships, you can either:

a) Set up the Ship Design Tables 1 and 6 with the percentages the way you want them and then change the Design Theme Map that race uses so that all 20 entries were either 00 or 05 in the proportion you want them, or

b) Add the devices/weapons you want the AI to use to one of the equipment tables that is used by all 8 ship designs and all races, like Defense Specials. Putting something first on the equipment list will ensure it is installed on the ship, so long as the race has that technology. So you could replace the first entry in the Defense Specials list (Security Stations) with one of the Beam Specials like High Energy Focus, and then change the Ship Design Tables so all 8 designs had a significant amount of beam weapons installed. Then you could put one of the Special Devices like Sub Space Teleporter second on the list of Defense Specials, and so on.

Anyway, there are lots of ways to tweak and customize the AI ship building process. I've been so caught up in the intense space battles that I haven't tested nearly as much as I would like. I also want to find a way to customize the Ship Initiative option in tactical combat. When two large fleets with similar technology meet, there should be losses on both sides, not a completely one-sided victory. The ship initiative should allow only a few consecutive ships from one side to fire before the other fleet gets at least one turn. I've been adjusting the AI to use more phasing cloaks to compensate, but it's not quite the same. If anyone has any insight how to adjust that, it sure would be appreciated.

Hope this helps...

Meson
 

User avatar
Overlord2
Posts:661
Joined:Wed Jun 13, 2007 5:25 pm

Postby Overlord2 » Mon Jul 30, 2012 5:44 am

Thanks for reply!

Thanks to Nirran who added those offsets to Ocl_Improved & GUI I could test some of those models, indeed theme is added to different ship designs based on certain criteria and I believe it's not race based. So for the models.
I have only one concern about these ship models that most of the models miss point defense beams, unfortunately, but maybe with some fine-tuning I will be able to overcome it.
I see you mentioned that AI adds more than 8 ship specials to one design...how is it possible? Isn't there a limit of 8? How does it display more than 8?

About ship initiative: if the ship initiative value is the same for your and enemy ships, they move in turns, i.e. there is no such situation, when all ships of one side move before the other. However, if the initiative is higher, the ships with higher initiative will move first, such is the property of initiative.

In the neighbouring topic I wrote about main problem of AI. Did you have a chance to look at it?

Meson
Posts:4
Joined:Mon Jun 25, 2012 11:01 pm

Postby Meson » Tue Jul 31, 2012 6:25 pm

Yes, I thought 8 specials was the limit, but I have seen as many as 15 so far. The extra ones show up right beneath the first 8 when you scan the ship in battle and the window with the ship's specs pops up. Specials 13 and 14 are hard to read because they are partly blocked by the bottom border of the window, but the 15th special appears directly below the window. I used to just scrap enemy ships I captured, but now many of them are better than anything I can build!

There seem to be many factors which affect ship initiative, so it always seems one fleet fires most or all weapons before the other, at least in my games. My impression is that initiative may be affected by ship size, computers, engines, crew experience, augmented engines, battle scanner, ship leaders, etc. I don't know exactly how it is calculated, but I have never seen two large fleets alternate one for one.

I did read your post about the AI research choices, and agree it is an issue. I don't know offhand how to modify it. My games tend to run quite long though, and eventually the AIs will acquire most of the techs through trade, spying, capture (and perhaps cheats in the game code). When I set up a new game I often give the other races some basic techs like automated factory and research lab to make sure they at least get off to a good start.

I look forward to hearing more about your testing with the AI ship designs!

Cheers!

Meson
 

User avatar
Overlord2
Posts:661
Joined:Wed Jun 13, 2007 5:25 pm

Postby Overlord2 » Thu Aug 02, 2012 4:03 pm

Thanks for reply again,

Q: So you just increased space for specials to 100% or how much?

The exact formula for ship initiative is: beam attack/10 + combat speed.
Hence its easy to see, what influences the initiative.

About AI research priority - it is a big problem because it puts the AI considerably behind from start compared to human, since the cheap techs it could research would help it to develop faster or to use better weapons early.
After all it gets to all branches, but very late to be competitive vs a player, who adheres to optimized tech path.
If you are interested in conducting research of AI functions, I could upload couple of files with the offsets. My team will be back to this issue sometime later after we finish other things.

More about AI ship designs: I encountered strange result, I nulled the heavy beams for ships models with 2-ammo missiles, but AI still builds designs with 2 ammo missiles and heavy beams. So I wondered where it could take this beams from....

Meson
Posts:4
Joined:Mon Jun 25, 2012 11:01 pm

Postby Meson » Sat Aug 04, 2012 7:15 pm

 
Thanks for the initiative formula Overlord2!

The AI ship I saw with 15 specials was built using the first table, with these modded values (total 275% of hull space):

Theme Specials - 50% (Missile Defense Theme, in this case)
Beam Specials - 60%
Defense Specials - 60%
Heavy Beams - 90%
Beams - 15%

I would be interested to see what you have on AI functions. I'll often trade the AI some tech like Holo Simulator or Robo Miners if they're lagging behind, but it would be great to have the AI make better decisions when researching techs and building colonies.

When the AI constructs ships from these tables, I believe it starts with Theme Specials and proceed through the other categories in order. Any unused percentage in one category seems to carry over. So whatever space was left over from 2x Missiles went to the next valid (not FF FF) category for that design, which would be Heavy Beams. Sometimes large percentages can carry over from the Device categories if the AI doesn't have the techs, but for weapons I would expect the AI to fill the allocated space with as many as possible (in your case missiles), so the leftover should be less than the space needed for one more missile. I've also seen a few PD Beams and Bombs appear on ships after I zeroed out those categories. Did you see more than a few Heavy Beams on your ship?

Meson
 

User avatar
Overlord2
Posts:661
Joined:Wed Jun 13, 2007 5:25 pm

Postby Overlord2 » Tue Aug 07, 2012 12:07 pm

Ok, I see. Well, this makes AI too much "cheater". Not sure if anyone will be interested in playing vs such AI.

About AI functions, I don't have separated AI functions yet, but here is the general list:
http://www.mediafire.com/file/fx2q2j4d79rnkmv/

About heavy beams - you say unused % is carried over or left over for next valid category. First if there are at least nuclear missiles at your disposal, why it should be left over for other things, which is nulled anyway...And carrying over unused space from other categories to the heavy beams sounds suspicious. I will investigate further about this problem. If any new information, I will let know.


Return to “Game Modifications”

Who is online

Users browsing this forum: No registered users and 27 guests