adding ships to commonwealth traffic

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Captain
Militia Captain
Posts: 817
Joined: Tue Nov 05, 2013 9:56 am

Mon Jul 22, 2019 1:56 am

George introduced a great feature in API 44 (1.8). It is the ability to override existing types using <???Override> types. From the API 44 Ministry topic (more info there too):
Starting in 1.8 Beta 5 you may create overrides of any type (not just <ShipClass> as in previous versions). You specify an override by creating a type definition that ends in Override. For example, <ShipClassOverride> or <StationTypeOverride>. An override must refer to an existing UNID of the same type.
Awesome. This makes it much easier to alter existing game types.
Also:
The <ShipTable> type has been enhanced to append elements in <Table> and <LevelTable> when inheriting (or overriding). This allows an extension to add new entries to an existing table.
Currently, only append is supported. You cannot delete or modify table elements without re-defining the entire ship table.
We can use this to add more ships to the "Commonwealth traffic". These are the random ships that fly around in the systems, gating in and out, docking with stations, looting and scuttling wrecks, etc. We will use a <ShipTableOverride> type to add Hammerhead-IIs to the system traffic. This is the code needed:

Code: Select all

<ShipTableOverride UNID="&tbCommTraffic;">
	<LevelTable>
		<Ship levelFrequency="uurr- -----" count="1" class="&scHammerhead-II;"/>
	</LevelTable>
</ShipTableOverride>
A bit of explanation about the 'levelFrequency' code.
There are 10 system levels in SOTP. Eridani is a level 1 system. The system level increases as you journey towards Heretic, a level 10 system. A few examples. Rigel is level 3, St Kats is 4, Eta Ceti is 7 and Point Juno is level 8. The system level can be found by using the (sysGetLevel) function or by checking the system code in HumanSpaceMap.xml in 'Transcendence_Source'.

The 'levelFrequency' code in the above example, "uurr- -----", has 10 values. The first five, then a space, then the last five. These are related to the system levels. The first "u" value is for level 1 systems, the second "u" value for level 2 systems, the next two values 'rr' are for level 3 and 4 systems. The dash values, "-", are for systems of level 5 to 10.
These values can be either:
c = common,
u = uncommon,
r = rare,
v = veryrare, or
- = none.
These values determine the likelihood of a ship being created to fly around in systems of that level. So in our example the Hammerhead-IIs are more likely to be created in level 1 and 2 systems (uncommon) than level 3 and 4 systems (rare). So we will generally see more Hammerhead-IIs flying around in Eridani (level 1 system) than Rigel (level 3 system). Hammerhead-IIs will never be created in systems of level 5 and above because of the "-" value.

Here are a few examples from the existing ShipTable in CommonwealthShips.xml

Code: Select all

<Ship levelFrequency="uuurr -----" count="1" class="&scBorer;"/>
<Ship levelFrequency="uurr- -----" count="1" class="&scRoninA;"/>
<Ship levelFrequency="ccrr- -----" count="1" class="&scSapphireYacht;"/>
<Ship levelFrequency="cccrr -----" count="1" class="&scIAVLight;"/>
The 'levelFrequency' code in our example above is a copy of the RoninA code. If we wanted more Hammerhead-IIs to appear we could change the "u" values to "c". Or to decrease their numbers we could use "r" or "v".


Although it is fun to have Aquilas and Corporate cruisers flying around in Eridani, it isn't really appropriate. Because of their high-level weapons, there is a real chance they will destroy stations by accident when they are firing on Centauri raiders!
As a rough guide, ships should be added to systems of about the same level. Ships also have a level value. This can be found using the (objGetLevel) function. Sometimes the level is set in the ShipClass UNID using "level=". If no level is set in this way then the game auto-sets the ship level as the level of the highest installed item (many thanks to NMS for that info).
The Hammerhead-IIs are level 2 ships. They have a level 2 dual recoilless cannon installed so the game auto-sets the level at 2. So we use 'levelFrequency' values for level 1 to 4 systems.

Aquilas are set at level 10 in their ship code. Corporate cruisers are level 9 due to having hexacarbide armor installed (a level 9 item).
So to add Aquilas to the random traffic we could use 'levelFrequency' values of "----- --vvu". They would then only occur in level 8 or higher systems and more frequently in level 10 systems than level 8 or 9 systems.

You may also add more entries to this code, perhaps to add your favorite custom playership to the game as well. Just cut and paste the line of code, set appropriate 'levelFrequency' values and change the ship class.

A complete mod is attached. Add it to your Extensions folder, select it (Hammerhead-II Traffic) at game start, and within a couple of minutes you should see a Hammerhead or two zipping around Eridani.


I have assumed a basic level of modding knowledge. If you have problems or would like more info, add a post detailing what you would like to know.
Attachments
HammerheadIITraffic.xml
(899 Bytes) Downloaded 13 times
Stupid code. Do what I want, not what I typed in!

User avatar
Song
Fleet Admiral
Fleet Admiral
Posts: 2769
Joined: Mon Aug 17, 2009 4:27 am

Mon Jul 22, 2019 6:14 am

A good guide to an interesting system. I considered swapping to this approach for Elemental Shift, but because I reduce the appearances of some of the stock ships (to make them level-appropriate) I ultimately had to stay with the old way and just redefine the entire table (which introduces problems with compatibility with other mods, so I'm looking forward to the feature being extended).
Although it is fun to have Aquilas and Corporate cruisers flying around in Eridani, it isn't really appropriate. Because of their high-level weapons, there is a real chance they will destroy stations by accident when they are firing on Centauri raiders!
As a rough guide, ships should be added to systems of about the same level. Ships also have a level value. This can be found using the (objGetLevel) function. Sometimes the level is set in the ShipClass UNID using "level=". If no level is set in this way then the game auto-sets the ship level as the level of the highest installed item (many thanks to NMS for that info).
The Hammerhead-IIs are level 2 ships. They have a level 2 dual recoilless cannon installed so the game auto-sets the level at 2. So we use 'levelFrequency' values for level 1 to 4 systems.

Aquilas are set at level 10 in their ship code. Corporate cruisers are level 9 due to having hexacarbide armor installed (a level 9 item).
So to add Aquilas to the random traffic we could use 'levelFrequency' values of "----- --vvu". They would then only occur in level 8 or higher systems and more frequently in level 10 systems than level 8 or 9 systems.
This is a somewhat simplistic approach (though perfectly valid). For things like military patrols, I advise looking up the system levels of the part of the game you want to have them in, then basing your criteria on that. It means they'll be more effective in some areas than others...but that's not necessarily a *bad* thing. Traffic isn't quite the same thing as an encounter or station. Cheap and cheerful ships being used as runabouts when they're technically obsolete can give life to areas. In addition, large capital ships (and similar vessels) should generally never be more than Rare or Very Rare: even at their appropriate level, these are large and uncommon vessels and they'll show up more often than you think. That's the only critique I'd have though, and this isn't a bad place to start at all. Traffic is a bit cumbersome to work with at the best of times (maybe one day we'll get some more options based around geographic areas of human space).


(You can also use this approach on the guard tables, however, you need to set the order in that case. "Guard" is almost always the correct one, "patrol" can be good for slow autons (like the TA3), but if the orbit is too wide then ships get stuck on the Arena walls and generally cause problems with aggressive behaviour elsewhere.)
Mischievous local moderator. She/Her pronouns.

Foxbat_25
Anarchist
Anarchist
Posts: 4
Joined: Fri Aug 23, 2019 2:39 pm

Sun Aug 25, 2019 3:00 pm

This sounds interesting, I'm sometimes mildly displeased (it's a minor annoyance, I still enjoy playing the game, don't worry!) at the low-ish number of other ships. Sure, it's better in terms of realism, but I'd still enjoy a more populated universe sometimes.
I'll try to go further into the game a little, and then I'll come back to this topic and check whether I still want to choose this and that, as so far, I'm not familiar enough with the game to mod it!

Post Reply