Shipyard

Shipbuilding

The handle_build_ship function is at 0x0052A360.

Build Capabilities

A shipyard's current quality level of each ship type is stored in the town's current ship quality level array, indexed by the ship type. The u8 values range from 0 to 3.

HP and Capacity

A ship's HP and capacity depend on the respective quality level. At 0x00673838 there is a table that holds the structure base values for every ship type and quality level:

TypeQuality Level 0Quality Level 1Quality Level 2Quality Level 3
Snaikka15192325
Craier28313435
Cog45485255
Hulk55596570

To the structure base value an unknown value is added, which appears to be always zero. The resulting structure value is capped at the value of QL 3.

HP and Capacity scale linearly with the structure value:

capacity = 2000 * structure_base_value
health = 2800 * structure_base_value

For a QL 3 hulk, this yields the expected capacity of 140.000 (700 barrels).

Resources and Price

The calculate_ship_build_cost function is at 0x0052B2C0. The shipyard charges a utilization markup that increases when the shipyard is in use, and decreases if it is not. At 0x0066DEB0 there is a table that contains the requirements of every ship type and quality level, capped at QL 2 (QL 3 does not increase cost):

TypeQLTimberClothHempPitchIron GoodsUnknownBase PriceUnknown
Snaikka0733320177,65011,414
Snaikka1933320208,20012,074
Snaikka21133320248,80012,784
Craier012555302918,26024,450
Craier114555303218,72025,010
Craier216555303419,89026,290
Cog018344404616,56022,296
Cog120344405016,50022,346
Cog222344405317,49023,446
Hulk03016168505822,96834,442
Hulk13316168506423,04034,579
Hulk23616168506924,84036,664

Wares are consumed as listed in the table. The ship price is calculated as follows:

def structure_markup(structure):
    if structure < 20:
        return 900
    if structure < 30:
        return 840
    if structure < 40:
        return 780
    if structure < 50:
        return 720
    if structure < 60:
        return 660
    else:
        return 600

price = base_price
    + structure_markup(structure_base_value)
    + utilization_markup
    + resource_prices

Repairs

Upgrade Levels