Files
tidewall/src/sim/tuning.gd
T
claudeandClaude Opus 5.5 5d2a2bbc31 B7: Weapon roster and consumables
Eight slot weapons: the six from the design plus the rivet repeater (fast,
short-range automatic) and the harpoon gun (slow heavy bolt, 2.5x damage to
built pieces). Four quality tiers, Rusted to Captain's, scale damage and reload
time. The line thrower now yanks the shooter towards where its line lands,
through a data field (pull_speed) any weapon can use.

Four consumables: sailcloth bandage (heals to 75), brine tonic, cork vest and
the new tar patch. Fire with one held starts using it if it would help; it
takes effect after its use time. Changing slot, dropping, sprinting, swimming
or elimination interrupts it and uses nothing up. All checks run on the server.

A data-validation test covers every weapon, tier, consumable and ammunition
type, including unknown stat keys, name format and that every ammo type is
used. The GDD's weapons section lists the roster.

Closes #21

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:26:04 -05:00

344 lines
16 KiB
GDScript

## The one table of gameplay numbers. See docs/GDD.md for what they mean.
## Using constants means a typo is a parse error instead of a silent default.
class_name Tuning
extends RefCounted
# Simulation
const TICK_RATE_HZ: int = 30
## Commands further ahead of the current tick than this are rejected.
const MAX_COMMAND_LEAD_TICKS: int = 60
## Width and depth of the playable world. Positions are clamped inside it.
const WORLD_SIZE_METRES: float = 1024.0
# Match sizes
const SOLO_PLAYERS: int = 24
const DUO_TEAMS: int = 12
const DUO_TEAM_SIZE: int = 2
const REVIVE_SECONDS: float = 6.0
# Player
const PLAYER_MAX_HEALTH: int = 100
const PLAYER_MAX_ARMOR: int = 100
const BREATH_SECONDS: float = 12.0
const INVENTORY_SLOTS: int = 5
# Movement, in metres and seconds
const WALK_SPEED: float = 4.0
const SPRINT_SPEED: float = 6.5
const WADE_SPEED: float = 2.5
const SWIM_SPEED: float = 2.0
const CROUCH_SPEED: float = 2.0
const JUMP_VELOCITY: float = 7.5
const GRAVITY: float = 20.0
## Fraction of the gap between current and wanted horizontal velocity closed per tick
## while airborne.
const AIR_CONTROL: float = 0.08
## Ledges up to this height are stepped onto without jumping.
const STEP_HEIGHT: float = 0.45
## Walking keeps the feet on ground that drops away by up to this much per tick.
const GROUND_SNAP: float = 0.35
## Steeper ground can't be walked up or stood on; players slide down it.
const MAX_SLOPE_DEGREES: float = 46.0
## Top speed sliding down ground too steep to stand on.
const SLIDE_MAX_SPEED: float = 8.0
const PLAYER_RADIUS: float = 0.4
const PLAYER_HEIGHT: float = 1.8
const CROUCH_HEIGHT: float = 1.2
## Landing from a drop of this many metres or less does no damage. Measured from impact
## speed, so sliding down a slope is gentler than falling the same height.
const FALL_DAMAGE_SAFE_METRES: float = 6.0
const FALL_DAMAGE_PER_METRE: float = 8.0
# Water, in metres and seconds. Depths are water over the floor under the player.
## The sea level a match starts at. The tide raises it from here.
const SEA_LEVEL_START: float = 0.0
## Deeper than this, walkers wade at WADE_SPEED and can't sprint.
const WADE_DEPTH: float = 0.4
## Water this deep over the floor lifts a player off it to swim.
const SWIM_DEPTH: float = 1.35
## A swimmer stands again where the water over the floor is shallower than this.
const SWIM_EXIT_DEPTH: float = 1.2
## A swimmer floats with the feet this far under the surface, head out.
const SWIM_FLOAT_DEPTH: float = 1.3
## With no stamina left a swimmer sinks until the feet are this far under: head under.
const SWIM_EXHAUSTED_DEPTH: float = 2.2
const SWIM_SPRINT_SPEED: float = 3.2
## Fraction of SWIM_SPEED left to an exhausted swimmer.
const SWIM_EXHAUSTED_FACTOR: float = 0.6
## Diving and rising speed, and how fast vertical speed changes in the water.
const SWIM_VERTICAL_SPEED: float = 2.0
const SWIM_VERTICAL_ACCEL: float = 12.0
## Fraction of downward speed kept on hitting deep water.
const WATER_ENTRY_DAMP: float = 0.25
## Seconds of paddling a full stamina bar allows. Sprint-swimming spends it faster.
const SWIM_STAMINA_SECONDS: float = 45.0
const SWIM_SPRINT_STAMINA_COST: int = 3
## Ticks of stamina and breath regained per tick out of the water or above it.
const STAMINA_RECOVERY_RATE: int = 3
const BREATH_RECOVERY_RATE: int = 4
# The drop, in metres and seconds. The sky barge crosses the island on a straight
# seeded route through a point within BARGE_CENTRE_JITTER of the middle.
const BARGE_ALTITUDE: float = 150.0
const BARGE_SPEED: float = 24.0
## The route starts and ends this far inside the world's edge.
const BARGE_ROUTE_MARGIN: float = 40.0
const BARGE_CENTRE_JITTER: float = 140.0
## Every route crosses at least this much dry land.
const BARGE_MIN_LAND_METRES: float = 250.0
## Fraction of the barge's speed a leaping player keeps.
const LEAP_CARRY: float = 0.4
const FREEFALL_MAX_SPEED: float = 32.0
## Horizontal speed a falling player can steer to, before and after the sail opens.
const FREEFALL_STEER_SPEED: float = 9.0
const GLIDE_SPEED: float = 13.0
## How fast horizontal speed changes while steering a fall, in metres per second squared.
const DROP_STEER_ACCEL: float = 20.0
## Sink rate under an open wing-sail, and how hard opening it brakes the fall.
const GLIDE_FALL_SPEED: float = 5.5
const GLIDE_BRAKE: float = 60.0
## The sail opens by itself this high above the ground or water.
const WING_AUTO_DEPLOY_HEIGHT: float = 40.0
## Within this height of the ground or water, the sail folds and the player drops the rest.
const DROP_LAND_HANDOFF: float = 1.0
# The island. Worldgen fills the whole world square; the island is about a kilometre
# across, sized for 24 players. Heights are metres above the starting sea level.
## Spacing of the terrain heightfield, in metres. The grid covers WORLD_SIZE_METRES.
const ISLAND_GRID_METRES: float = 2.0
## Mean distance from the world centre to the coast, before the coastline is warped.
const ISLAND_RADIUS_METRES: float = 400.0
const ISLAND_MIN_SUMMITS: int = 2
const ISLAND_MAX_SUMMITS: int = 4
## Summits are at least this far apart, so each one is a separate fight.
const ISLAND_SUMMIT_SPACING_METRES: float = 220.0
## The tallest summit lands between these heights. Both stay under ISLAND_MAX_HEIGHT.
const ISLAND_PEAK_MIN: float = 58.0
const ISLAND_PEAK_MAX: float = 67.0
## The open sea floor, in metres below the starting sea.
const ISLAND_SEA_DEPTH: float = 12.0
## Elevation bands, by height above the starting sea. Marsh is wet flat ground below
## ISLAND_MARSH_TOP; land from there up to ISLAND_FOREST_TOP is forest, then highland,
## and anything at or above ISLAND_SUMMIT_BAND is summit ground.
const ISLAND_BEACH_TOP: float = 2.5
const ISLAND_MARSH_TOP: float = 7.0
const ISLAND_FOREST_TOP: float = 32.0
const ISLAND_SUMMIT_BAND: float = 50.0
# Points of interest. Each kind places between its min and max on every island, and the
# total always lands between POI_MIN_TOTAL and POI_MAX_TOTAL.
const POI_KINDS: Dictionary = {
"shrine": {"min": 2, "max": 3},
"lighthouse": {"min": 1, "max": 2},
"dock": {"min": 2, "max": 3},
"salt_works": {"min": 1, "max": 2},
"quarry": {"min": 1, "max": 2},
"hamlet": {"min": 3, "max": 4},
}
const POI_MIN_TOTAL: int = 10
const POI_MAX_TOTAL: int = 16
## No two points of interest are closer than this, centre to centre.
const POI_SPACING_METRES: float = 85.0
# Props: trees, scrub, boulders, wrecks and crates scattered over the island. Each kind
# has health, the material it gives when harvested, and a collision footprint range in
# metres (`width` x `height`; wrecks are `length` long). Density is props per hectare
# in each elevation band; groves and clearings modulate it.
const PROP_KINDS: Dictionary = {
"pine": {"health": 200, "material": "driftwood", "width": [0.5, 0.7], "height": [7.0, 12.0]},
"scrub": {"health": 60, "material": "driftwood", "width": [1.1, 1.8], "height": [0.8, 1.3]},
"boulder": {"health": 400, "material": "stone", "width": [1.6, 3.4], "height": [1.0, 2.4]},
"wreck": {"health": 500, "material": "salvage_iron", "width": [2.2, 2.8], "height": [1.4, 2.0], "length": [5.5, 8.0]},
"crate": {"health": 80, "material": "driftwood", "width": [0.9, 1.2], "height": [0.9, 1.2]},
}
const PROP_DENSITY: Dictionary = {
"beach": {"wreck": 5.0, "crate": 6.0, "scrub": 2.0},
"marsh": {"scrub": 30.0, "crate": 1.0, "boulder": 1.0},
"forest": {"pine": 70.0, "scrub": 16.0, "boulder": 4.0, "crate": 0.3},
"highland": {"pine": 14.0, "boulder": 16.0, "scrub": 10.0},
"summit": {"boulder": 10.0, "scrub": 3.0},
}
## Props keep this far from any point-of-interest solid, loot marker or walking route.
const PROP_POI_CLEARANCE: float = 3.0
# The tide. `hold` and `rise` are seconds, `level` is metres above the starting sea,
# `drown_dps` is damage per second underwater once breath runs out. The last level
# must exceed ISLAND_MAX_HEIGHT, so that every match ends.
const ISLAND_MAX_HEIGHT: float = 70.0
const TIDE_PHASES: Array[Dictionary] = [
{"hold": 150.0, "rise": 60.0, "level": 8.0, "drown_dps": 2},
{"hold": 100.0, "rise": 50.0, "level": 18.0, "drown_dps": 4},
{"hold": 80.0, "rise": 45.0, "level": 30.0, "drown_dps": 6},
{"hold": 60.0, "rise": 40.0, "level": 42.0, "drown_dps": 8},
{"hold": 45.0, "rise": 35.0, "level": 54.0, "drown_dps": 12},
{"hold": 30.0, "rise": 30.0, "level": 64.0, "drown_dps": 16},
{"hold": 20.0, "rise": 40.0, "level": 75.0, "drown_dps": 25},
]
# Building
const GRID_CELL_METRES: float = 4.0
## The most of each material a player can carry.
const MATERIAL_CAP: int = 500
## Material gained per boathook hit on a prop, whatever the prop.
const HARVEST_PER_HIT: int = 15
## Damage a boathook hit does to a prop or a built piece. Players take the boathook's
## `damage` instead.
const HARVEST_DAMAGE: int = 50
## A swing reaches this far past the boathook's range, from the eye, so a prop the body
## is touching is always in reach.
const HARVEST_REACH_SLACK: float = 0.4
## Props are hit if the swing passes within this distance of their box.
const HARVEST_AIM_SLACK: float = 0.25
## Material units each piece costs. Health and build time come from MATERIALS.
const BUILD_PIECES: Dictionary = {
"wall": {"cost": 10},
"floor": {"cost": 10},
"ramp": {"cost": 10},
"roof": {"cost": 10},
"breakwater": {"cost": 30},
}
const MATERIALS: Dictionary = {
"driftwood": {"health": 150, "build_seconds": 2.0},
"stone": {"health": 300, "build_seconds": 5.0},
"salvage_iron": {"health": 500, "build_seconds": 9.0},
}
## Pieces are GRID_CELL_METRES on a side and tall, and snap across to the grid. Up and
## down they snap to levels BUILD_LEVEL_METRES apart, half a cell, so a piece built on
## the ground is never more than a metre above or below the builder's feet. Level 0 is
## the starting sea level; levels run from BUILD_MIN_LEVEL to BUILD_MAX_LEVEL.
const BUILD_LEVEL_METRES: float = 2.0
const BUILD_MIN_LEVEL: int = -8
const BUILD_MAX_LEVEL: int = 63
## A piece's centre must be within this distance of the builder's eye.
const BUILD_RANGE: float = 9.5
## Ticks between placements while fire is held: 10 pieces a second.
const BUILD_INTERVAL_TICKS: int = 3
## Looking further up than this, in degrees, targets the level above.
const BUILD_LOOK_UP_DEGREES: float = 35.0
## Looking further down than this puts floors, ramps and roofs in the builder's own cell.
const BUILD_LOOK_DOWN_DEGREES: float = 40.0
const WALL_THICKNESS: float = 0.3
const BREAKWATER_THICKNESS: float = 0.6
const FLOOR_THICKNESS: float = 0.2
## Ramps are stairs of this many steps, so each riser can be stepped up.
const RAMP_STEPS: int = 10
## A new piece starts at this fraction of its material's health and reaches full health
## after the material's `build_seconds`.
const BUILD_START_HEALTH_FRACTION: float = 0.1
## Damage per second to a piece other than a breakwater whose base is under the sea.
const TIDE_STRUCTURE_DPS: int = 4
## A breakwater holds this much water above its base. Deeper, it fails at once.
const BREAKWATER_MAX_HEAD: float = 6.0
const BREAKWATER_WEAR_PER_METRE: float = 2.0
const BREACH_FLOW_METRES_PER_SECOND: float = 1.5
# Inventory and pickups
## Items picked up or dropped must be within this distance of the player's feet.
const PICKUP_RANGE: float = 2.5
## Changing the held slot takes this long before the new item can be used.
const SWAP_SECONDS: float = 0.25
## Dropped items land on a ring this far from the player's feet.
const DROP_SCATTER_METRES: float = 1.2
## Ammunition, carried apart from the five slots. `cap` is the most a player carries,
## `pickup` how much one ammunition pickup holds.
const AMMO: Dictionary = {
"birdshot": {"cap": 60, "pickup": 12},
"cartridges": {"cap": 300, "pickup": 30},
"heavy_balls": {"cap": 30, "pickup": 6},
"lines": {"cap": 12, "pickup": 3},
"harpoons": {"cap": 10, "pickup": 3},
}
# Weapons. Falloff is linear from full damage at `range_full` to `falloff_min`
# (a fraction of damage) at `range_max`. `spread` is the cone half-angle in degrees
# from the hip; aiming multiplies it by AIM_SPREAD_FACTOR. Each shot adds `bloom`
# degrees, which decays at BLOOM_DECAY_DEGREES_PER_SECOND while the weapon is ready. `projectile_speed` 0 means
# hitscan; otherwise shots fly at that speed under `projectile_gravity`. `ammo` names
# an AMMO type; a weapon with `stack` above 1 is thrown and is its own ammunition.
# `pull_speed` yanks the shooter towards where the shot lands, at that speed.
# `structure_factor` scales damage to built pieces and props (default 1).
const WEAPONS: Dictionary = {
"boathook": {
"damage": 20, "fire_rate": 1.5, "magazine": 0, "reload": 0.0,
"range_full": 2.5, "range_max": 2.5, "falloff_min": 1.0, "rarity": 0,
"spread": 0.0, "bloom": 0.0,
},
"fowling_piece": {
"damage": 9, "pellets": 9, "fire_rate": 1.1, "magazine": 6, "reload": 4.0,
"range_full": 6.0, "range_max": 25.0, "falloff_min": 0.2, "rarity": 1,
"spread": 5.0, "bloom": 0.0, "ammo": "birdshot", "headshot": 1.5,
},
"dock_carbine": {
"damage": 27, "fire_rate": 6.0, "magazine": 30, "reload": 2.4,
"range_full": 40.0, "range_max": 120.0, "falloff_min": 0.5, "rarity": 1,
"spread": 1.2, "bloom": 0.35, "ammo": "cartridges", "headshot": 1.75,
},
"signal_revolver": {
"damage": 38, "fire_rate": 2.2, "magazine": 6, "reload": 2.0,
"range_full": 30.0, "range_max": 80.0, "falloff_min": 0.5, "rarity": 0,
"spread": 0.8, "bloom": 0.6, "ammo": "cartridges", "headshot": 2.0,
},
"rivet_repeater": {
"damage": 17, "fire_rate": 11.0, "magazine": 35, "reload": 2.0,
"range_full": 12.0, "range_max": 45.0, "falloff_min": 0.4, "rarity": 0,
"spread": 2.4, "bloom": 0.25, "ammo": "cartridges", "headshot": 1.5,
},
"whalers_longgun": {
"damage": 105, "fire_rate": 0.5, "magazine": 1, "reload": 2.6,
"range_full": 120.0, "range_max": 350.0, "falloff_min": 0.7, "rarity": 2,
"spread": 3.0, "bloom": 0.0, "ammo": "heavy_balls", "headshot": 2.5,
"aim_spread": 0.0, "projectile_speed": 300.0, "projectile_gravity": 9.0,
},
"line_thrower": {
"damage": 0, "fire_rate": 0.6, "magazine": 3, "reload": 3.0,
"range_full": 45.0, "range_max": 45.0, "falloff_min": 1.0, "rarity": 2,
"spread": 0.0, "bloom": 0.0, "ammo": "lines",
"projectile_speed": 90.0, "projectile_gravity": 4.0, "pull_speed": 18.0,
},
"harpoon_gun": {
"damage": 70, "fire_rate": 0.9, "magazine": 1, "reload": 1.8,
"range_full": 25.0, "range_max": 70.0, "falloff_min": 0.6, "rarity": 1,
"spread": 0.6, "bloom": 0.0, "ammo": "harpoons", "headshot": 1.5,
"projectile_speed": 120.0, "projectile_gravity": 6.0, "structure_factor": 2.5,
},
"powder_keg": {
"damage": 80, "structure_damage": 400, "blast_radius": 6.0, "fuse": 3.0,
"fire_rate": 0.8, "magazine": 1, "reload": 0.0, "stack": 3,
"range_full": 0.0, "range_max": 30.0, "falloff_min": 1.0, "rarity": 2,
"spread": 0.0, "bloom": 0.0,
},
}
## Spread multiplier while aiming, unless a weapon sets its own `aim_spread`.
const AIM_SPREAD_FACTOR: float = 0.4
## Extra spread while moving, and while airborne or swimming, in degrees.
const MOVING_SPREAD_DEGREES: float = 1.5
const AIRBORNE_SPREAD_DEGREES: float = 4.0
const MAX_BLOOM_DEGREES: float = 6.0
const BLOOM_DECAY_DEGREES_PER_SECOND: float = 6.0
## Default damage multiplier for a hit on the head, unless a weapon sets `headshot`.
const HEADSHOT_MULTIPLIER: float = 1.5
## The top of a player's body this tall counts as the head.
const HEAD_HEIGHT: float = 0.35
## Shots against built pieces and props do this fraction of their player damage.
const WEAPON_STRUCTURE_FACTOR: float = 1.0
## Quality tiers, lowest first. Loot rolls a tier for each weapon it spawns. `damage`
## multiplies every hit and `reload` multiplies the reload time.
const WEAPON_TIERS: Array[Dictionary] = [
{"name": "rusted", "damage": 1.0, "reload": 1.0},
{"name": "seaworthy", "damage": 1.08, "reload": 0.95},
{"name": "brass_fitted", "damage": 1.16, "reload": 0.9},
{"name": "captains", "damage": 1.25, "reload": 0.85},
]
## A line pull also lifts the puller this fast, so it clears the ground.
const LINE_PULL_LIFT: float = 4.0
# Consumables. Fire with one held starts using it; it takes effect after `use_seconds`
# unless interrupted. `heal` restores health up to `heal_cap` (default full), `armor`
# adds armor up to PLAYER_MAX_ARMOR. An item that would do nothing can't be started.
const ITEMS: Dictionary = {
"sailcloth_bandage": {"heal": 25, "heal_cap": 75, "use_seconds": 3.0, "stack": 6, "rarity": 0},
"brine_tonic": {"heal": 60, "use_seconds": 8.0, "stack": 3, "rarity": 1},
"cork_vest": {"armor": 50, "use_seconds": 5.0, "stack": 2, "rarity": 1},
"tar_patch": {"armor": 20, "use_seconds": 2.0, "stack": 5, "rarity": 0},
}