Difference between revisions of "Shipyard.plist"

From Elite Wiki
(Initial documentation of shipyard.plist)
 
(Updating BB links)
 
(14 intermediate revisions by 9 users not shown)
Line 1: Line 1:
'''shipyard.plist''' provides Oolite with the information necessary to equip a player-purchaseable ship.
+
'''shipyard.[[plist]]''' provides Oolite with the information necessary to equip a player-purchaseable ship.
  
 +
 +
== Overview ==
 +
How the selection of ships for the F3F3 shipyard actually works:
 +
 +
It's long, and takes a bizarre way around - basically, to avoid having to store the shipyard anywhere persistent, it randomly generates it to a fixed seed algorithm every time it's looked at, but it's conceptually relatively simple.
 +
 +
The shipyard has 256 potential slots. For each slot:
 +
* pick a random entry from the entire list of player available ships (excluding those which fail condition scripts)
 +
* determine an "on sale date" for that slot based on a long loop
 +
* if the slot isn't on sale in its 30-day window based on the current time, leave it blank - so the shipyard will gradually rotate stock as you leave and return. This is on a roughly 200-day cycle, so only about 40 slots are actually active at any time.
 +
* if the ship which would fill the slot is higher tech than the station (or system if the station doesn't have a tech level defined), leave it blank
 +
* if the ship's "chance" in shipyard.plist is <1, roll against that for another chance to leave the slot blank
 +
* if all of the above allows the slot to be filled, potentially give the ship some random weapon upgrades and bonus equipment
 +
 +
Having established which of the slots contain ships, remove all the duplicates in ship+equipment from the list so it doesn't contain 5 identical stock Adders.
 +
 +
It works pretty well for strict Oolite - with only 10 player-buyable ships, that's plenty of chances for each to come up, and higher-tech systems have fuller shipyards.
 +
 +
If you add tens or hundreds of OXP player-flyable ships, the chances of any particular ship being there are minimal. It's easy to stop a ship showing up - condition script, low chance value, high tech level - but impossible to guarantee its appearance. ([https://bb.oolite.space/viewtopic.php?p=289424#p289424 Cim (2023)])
  
 
== chance ==
 
== chance ==
The likelihood that the ship is available for purchase at a station. (See also [[Shipyard.plist#techlevel|techlevel]].)
+
Affects the likelihood of the ship appearing in the shipyard, and also the likelihood of extra equipment being fitted. The difference between the local tech level and the ship’s tech level also factor into this.
  
'''Example:'''
+
Example:
  <key>chance</key>
+
  chance = 0.25;
  <real>0.25</real>
+
 
 +
==condition_script==
 +
{{oolite-prop-added|1.77}}
 +
 
 +
This option specifies a Javascript file which controls the addition of this ship. The <code>allowOfferShip</code> function in that [[Oolite_JavaScript_Reference:_Condition_scripts|condition script]] will then be tested before the ship is offered for sale. Several ship types can share a condition script.
 +
 
 +
Example:
 +
  "condition_script" = "myoxp_conditions.js";
  
 
== optional_equipment ==
 
== optional_equipment ==
This section lists equipment that the ship may be sold with. Oolite will offer variants of basic ship models with a selection of the optional equipment added, and the cost increased accordingly. Do not list equipment in both this section and the [[Shipyard.plist#standard_equipment|standard_equipment]] section, or you will be ripping your customers off.
+
This section lists equipment that the ship can be fitted with. Note that Oolite will offer variants of basic ship models with a selection of the optional equipment added, and the cost increased accordingly. Do not list equipment in both this section and the [[Shipyard.plist#standard_equipment|standard_equipment]] section, or you will be ripping your customers off.
  
'''Example: '''
+
Example:  
 
   <key>optional_equipment</key>
 
   <key>optional_equipment</key>
 
   <array>
 
   <array>
Line 19: Line 45:
 
     <string>EQ_ESCAPE_POD</string>
 
     <string>EQ_ESCAPE_POD</string>
 
   </array>
 
   </array>
 +
 +
'''Note:''' Some equipment is universally available. For example all ships can buy fuel and equip a [[Galactic Hyperdrive|galactic hyperdrive]]. Refer to [[equipment.plist]] for specifics.
 +
  
 
== price ==
 
== price ==
 
How much the ship costs to purchase. Be sure to consider [[Shipyard.plist#standard_equipment|standard_equipment]] when you determine ship price.
 
How much the ship costs to purchase. Be sure to consider [[Shipyard.plist#standard_equipment|standard_equipment]] when you determine ship price.
  
'''Example:'''
+
Example:
 
   <key>price</key>
 
   <key>price</key>
 
   <integer>65000</integer>
 
   <integer>65000</integer>
 +
 +
== renovation_multiplier ==
 +
{{oolite-prop-added|1.79}}
 +
 +
This number may be used to make the ship more expensive or cheaper to maintain. The usual cost of purchasing ship maintenance is approximately 1% of the ship's total value (including equipment) though this varies a little with the amount of maintenance needed. The maintenance price will be multiplied by this number (if omitted, default 1)
 +
 +
Example:
 +
  // prototype technology is hard to maintain
 +
  renovation_multiplier = "3.5";
  
 
== standard_equipment ==
 
== standard_equipment ==
 
Equipment that comes fitted as standard with your ship. Any extras included in this section are ''free'', and should not appear in the [[Shipyard.plist#optional_equipment|optional_equipment]] section, or the station sales screen may offer a model of the ship with equipment it already has. Be sure to factor in the cost of equipment that comes as standard when pricing your ships.
 
Equipment that comes fitted as standard with your ship. Any extras included in this section are ''free'', and should not appear in the [[Shipyard.plist#optional_equipment|optional_equipment]] section, or the station sales screen may offer a model of the ship with equipment it already has. Be sure to factor in the cost of equipment that comes as standard when pricing your ships.
  
'''Example:''' ''all models of this ship come with a heat shield, pulse laser and a single missile.''
+
Example: <br />
 +
All models of this ship come with a heat shield, pulse laser and a single missile.
 +
 
 
   <key>standard_equipment</key>
 
   <key>standard_equipment</key>
 
   <dict>
 
   <dict>
Line 43: Line 83:
 
   </dict>
 
   </dict>
  
'''Example:''' ''all models of this ship come with a military laser, but nothing else as standard. If you have equipment listed as optional, the system may offer a tricked-out variant at a greater cost.''
+
Example: <br />
 +
All models of this ship come with a military laser, but nothing else as standard. If you have equipment listed as optional, the system may offer a tricked-out variant at a greater cost.
 +
 
 
   <key>standard_equipment</key>
 
   <key>standard_equipment</key>
 
   <dict>
 
   <dict>
Line 53: Line 95:
 
     <integer>0</integer>
 
     <integer>0</integer>
 
   </dict>
 
   </dict>
 +
  
 
== techlevel ==
 
== techlevel ==
Minimum tech. level of a system for the ship to be on sale. (See also [[Shipyard.plist#chance|chance]].)
+
Minimum tech level (TL) of a system for the ship to be on sale.  
  
'''Example:'''
+
Example:
 
   <key>techlevel</key>
 
   <key>techlevel</key>
 
   <integer>4</integer>
 
   <integer>4</integer>
 +
 +
In future versions it will be possible to set a maximum tech level with this
 +
  <key>conditions</key>
 +
  <array>
 +
  <string>dockedTechLevel_number lessthan 11</string>
 +
  </array>
  
 
== weapon_facings ==
 
== weapon_facings ==
 
What weapon mounts are available on the ship. This is a bit-mask, so pick the mounts and add the numbers:
 
What weapon mounts are available on the ship. This is a bit-mask, so pick the mounts and add the numbers:
1 - Forward
 
2 - Aft
 
4 - Port
 
8 - Starboard
 
  
'''Example:''' ''fore and aft weapon mounts only.''
+
1 - Forward<br />
 +
2 - Aft<br />
 +
4 - Port<br />
 +
8 - Starboard<br />
 +
 
 +
 
 +
Example: <br />
 +
Fore and aft weapon mounts only.
 
   <key>weapon_facings</key>
 
   <key>weapon_facings</key>
 
   <integer>3</integer>
 
   <integer>3</integer>
  
'''Example:''' all weapon mounts.''
+
Example: <br />
 +
All weapon mounts.
 
   <key>weapon_facings</key>
 
   <key>weapon_facings</key>
 
   <integer>15</integer>
 
   <integer>15</integer>
  
  
'''Note:''' ''does something bad happen if the [[Shipdata.plist#weapon_position_..|shipdata weapon positions]] and the weapon_facings don't match?''
+
== Links ==
 +
*[https://bb.oolite.space/viewtopic.php?f=4&t=17126 Where's my ship?] (2014)
 +
*[https://bb.oolite.space/viewtopic.php?f=6&t=17131 Shipyard generation] (2014)
 +
*[https://bb.oolite.space/viewtopic.php?p=256148#p256148 How to restrict sales to govt types, economy types, etc.] (Redspear, 2017). Doneon  through a ''script.js file'', not the Shipyard.plist!
 +
*[https://bb.oolite.space/viewtopic.php?f=4&t=16337&start=255 Forcing a sale] ''script.js file'', Montana05, 2020 (there is more further in various Nov 6th posts)
 +
*[https://bb.oolite.space/viewtopic.php?p=272280#p272280 Forcing a sale at Lave at the game start] ''script.js file'', Dybal, 2020
  
--------------------------------------------------------------------------------
+
----
 
[[Category:Oolite]]
 
[[Category:Oolite]]
 +
[[Category:Oolite scripting]]

Latest revision as of 03:25, 29 February 2024

shipyard.plist provides Oolite with the information necessary to equip a player-purchaseable ship.


Overview

How the selection of ships for the F3F3 shipyard actually works:

It's long, and takes a bizarre way around - basically, to avoid having to store the shipyard anywhere persistent, it randomly generates it to a fixed seed algorithm every time it's looked at, but it's conceptually relatively simple.

The shipyard has 256 potential slots. For each slot:

  • pick a random entry from the entire list of player available ships (excluding those which fail condition scripts)
  • determine an "on sale date" for that slot based on a long loop
  • if the slot isn't on sale in its 30-day window based on the current time, leave it blank - so the shipyard will gradually rotate stock as you leave and return. This is on a roughly 200-day cycle, so only about 40 slots are actually active at any time.
  • if the ship which would fill the slot is higher tech than the station (or system if the station doesn't have a tech level defined), leave it blank
  • if the ship's "chance" in shipyard.plist is <1, roll against that for another chance to leave the slot blank
  • if all of the above allows the slot to be filled, potentially give the ship some random weapon upgrades and bonus equipment

Having established which of the slots contain ships, remove all the duplicates in ship+equipment from the list so it doesn't contain 5 identical stock Adders.

It works pretty well for strict Oolite - with only 10 player-buyable ships, that's plenty of chances for each to come up, and higher-tech systems have fuller shipyards.

If you add tens or hundreds of OXP player-flyable ships, the chances of any particular ship being there are minimal. It's easy to stop a ship showing up - condition script, low chance value, high tech level - but impossible to guarantee its appearance. (Cim (2023))

chance

Affects the likelihood of the ship appearing in the shipyard, and also the likelihood of extra equipment being fitted. The difference between the local tech level and the ship’s tech level also factor into this.

Example:

chance = 0.25;

condition_script

This property was added in Oolite test release 1.77.

This option specifies a Javascript file which controls the addition of this ship. The allowOfferShip function in that condition script will then be tested before the ship is offered for sale. Several ship types can share a condition script.

Example:

"condition_script" = "myoxp_conditions.js";

optional_equipment

This section lists equipment that the ship can be fitted with. Note that Oolite will offer variants of basic ship models with a selection of the optional equipment added, and the cost increased accordingly. Do not list equipment in both this section and the standard_equipment section, or you will be ripping your customers off.

Example:

 <key>optional_equipment</key>
 <array>
   <string>EQ_ECM</string>
   <string>EQ_FUEL_SCOOPS</string>
   <string>EQ_ESCAPE_POD</string>
 </array>

Note: Some equipment is universally available. For example all ships can buy fuel and equip a galactic hyperdrive. Refer to equipment.plist for specifics.


price

How much the ship costs to purchase. Be sure to consider standard_equipment when you determine ship price.

Example:

 <key>price</key>
 <integer>65000</integer>

renovation_multiplier

This property was added in Oolite test release 1.79.

This number may be used to make the ship more expensive or cheaper to maintain. The usual cost of purchasing ship maintenance is approximately 1% of the ship's total value (including equipment) though this varies a little with the amount of maintenance needed. The maintenance price will be multiplied by this number (if omitted, default 1)

Example:

 // prototype technology is hard to maintain
 renovation_multiplier = "3.5";

standard_equipment

Equipment that comes fitted as standard with your ship. Any extras included in this section are free, and should not appear in the optional_equipment section, or the station sales screen may offer a model of the ship with equipment it already has. Be sure to factor in the cost of equipment that comes as standard when pricing your ships.

Example:
All models of this ship come with a heat shield, pulse laser and a single missile.

 <key>standard_equipment</key>
 <dict>
   <key>extras</key>
   <array>
     <string>EQ_HEAT_SHIELD</string>
   </array>
   <key>forward_weapon_type</key>
   <string>EQ_WEAPON_PULSE_LASER</string>
   <key>missiles</key>
   <integer>1</integer>
 </dict>

Example:
All models of this ship come with a military laser, but nothing else as standard. If you have equipment listed as optional, the system may offer a tricked-out variant at a greater cost.

 <key>standard_equipment</key>
 <dict>
   <key>extras</key>
   <array/>
   <key>forward_weapon_type</key>
   <string>EQ_WEAPON_MILITARY_LASER</string>
   <key>missiles</key>
   <integer>0</integer>
 </dict>


techlevel

Minimum tech level (TL) of a system for the ship to be on sale.

Example:

 <key>techlevel</key>
 <integer>4</integer>

In future versions it will be possible to set a maximum tech level with this

 <key>conditions</key>
 <array>
 <string>dockedTechLevel_number lessthan 11</string>
 </array> 

weapon_facings

What weapon mounts are available on the ship. This is a bit-mask, so pick the mounts and add the numbers:

1 - Forward
2 - Aft
4 - Port
8 - Starboard


Example:
Fore and aft weapon mounts only.

 <key>weapon_facings</key>
 <integer>3</integer>

Example:
All weapon mounts.

 <key>weapon_facings</key>
 <integer>15</integer>


Links