Skip to content

Ship size classes

X4 ships come in 5 size classesclass.ship_xs through class.ship_xl. These are not separate datatypes; all five share the Ship datatype. The size class is a class label used by find_* filters and game mechanics (boardable vs not, fits-in-dock-size, etc.).

This page collects size-specific guidance that doesn’t belong on the parent Ship page.

ClassTypical examplesBoardableCommon purposes
ship_xsDrones, mining drones, combat dronesNoAuxiliary (carried by larger ships)
ship_sFighters, scouts, interceptorsVia signalleakFight, scout
ship_mCorvettes, miners, transportsVia signalleakFight, mine, trade, salvage
ship_lDestroyers, freighters, buildersVia marinesFight, trade, build, salvage
ship_xlCarriers, resupplier, buildersVia marinesFight, auxiliary, build
<find_ship_by_true_owner name="$DestroyersAndCarriers"
space="player.galaxy"
faction="$Faction"
class="[class.ship_l, class.ship_xl]"
multiple="true"/>

class= accepts a single class OR a list of classes. Multi-class filter matches any.

<find_ship_by_true_owner name="$Miners"
space="$Sector"
faction="$Faction"
class="class.ship_m"
primarypurpose="purpose.mine"
multiple="true"/>

Combine class= and primarypurpose= for narrow matches (“M-class miners”).

<do_if value="$ship.class == class.ship_l">
<!-- a destroyer / large ship -->
</do_if>
<do_if value="$ship.isclass.[class.ship_l, class.ship_xl]">
<!-- a capital ship (L or XL) -->
</do_if>

$ship.iscapitalship is a vanilla shortcut for “ship_l OR ship_xl”:

<do_if value="$ship.iscapitalship">
<!-- equivalent to the .isclass.[ship_l, ship_xl] check -->
</do_if>

Use .iscapitalship when you want clarity; use the list form when you need other size combinations.

SizeBoardable by marines?Notes
ship_xsNoDrones are not boardable
ship_sVia signal leakMarines insert through signal leak instead of pods
ship_mVia signal leakSame as ship_s
ship_lVia marines + podsStandard boarding
ship_xlVia marines + podsStandard boarding (high resistance)

See Boarding for the full lifecycle.

Ships dock at docking bays of matching size:

Ship sizeRequired docksize tag
ship_xstag.dock_xs
ship_stag.dock_s
ship_mtag.dock_m
ship_ltag.dock_l or pier_l
ship_xltag.dock_xl or pier_xl

L and XL ships dock at piers (Pier) rather than ordinary dock areas.

<find_dockingbay name="$dock"
object="$Station"
checkoperational="true"
docksize="tag.dock_l"
multiple="false"/>

docksize= accepts a tag value. Engine matches ship size to compatible dock.

Vanilla scales build cost and time across sizes:

ClassRelative build costRelative build time
ship_xs
ship_s~10×~3×
ship_m~50×~10×
ship_l~500×~30×
ship_xl~5000×~120×

These are approximate — actual numbers depend on the specific ship macro. Modders adding new ships should follow vanilla’s scale to avoid economic imbalance.

  • class.ship matches ALL sizes. $obj.isclass.ship is true for all of xs/s/m/l/xl. For specific size, use .isclass.ship_l etc.
  • ship_xs (drones) are NOT free agents. They’re carried inside larger ships. find_object may not return them at top-level; query the carrier’s .units.
  • Build cost across sizes is steep. A ship_xl costs 5000× a ship_xs. Mods adjusting costs should consider economic ripple effects.
  • Boardable threshold is at ship_l. Don’t expect a player to board your custom ship_m via marines — they’ll need a signal leak.
  • Lasertower is class.ship despite looking deployable. See Lasertower.