Files
client/spacewar/autoload/game_config.gd
T
anekdotin 7b44b2f2dc Add real server pool, race roster overhaul, and ship energy system
Server browsing & matchmaking:
- HL2-style main menu (QUICK PLAY/SERVER SELECT/OPTIONS/PROFILE/QUIT)
  replaces the old CASUAL/RANKED tiles; RANKED removed end-to-end
  (menu, matchmaking-api's Mode.ranked queue path, MMR matching) until
  ranked is real.
- New menu/server_select.gd lists real servers from the matchmaking
  API's GET /servers and connects directly, retiring the old
  unreachable menu/server_browser.gd.
- Real game-server pool: NetworkManager.host_server() self-registers on
  boot and heartbeats every 8s with live player counts; API computes
  available/full status from player_count, and a background sweep marks
  any server offline once its heartbeat goes stale (catches a crashed
  server that never deregistered).
- Server-select rows get a live UDP ping probe (query port = game port
  + 10000) instead of trusting stale DB numbers; post-connect HUD shows
  live RTT off ENet's own peer stats.

Race roster overhaul:
- Swapped Terran/Mechanos/Vorg for the pivoted roster — Apex Dynamics,
  Inner Sphere Navy, Outer Rim Collective — each with a 3-ship
  Fighter/Gunner/Tank lineup, art cropped from concept sheets with
  background removal + orientation fixes per sheet.
- Live headcount + roster + "TEAM FULL" lock on the race-select screen,
  shared between the initial pre-spawn pick and the pause menu's live
  SELECT TEAM swap.
- Bot personalities (bots/bot_personality.gd): aggression/caution/
  accuracy/reaction/awareness traits rolled per bot instead of one
  fixed AI profile.

HUD additions:
- Player list (roster, teammates white/enemies yellow, bots flagged),
  kill feed, minimap, and explosion VFX on death.
- Health and energy now render as bars (hud/stat_bar.gd) instead of
  text in the top-left HUD.

Ship energy system:
- Per-role max energy (Fighter 100 / Gunner 150 / Tank 250), 75 energy
  per shot, flat regen (100 per 2.5s), fully server-authoritative and
  piggybacked on the existing per-tick state broadcast alongside health.
- New blue "mirrored" bar top-middle of the screen (hud/energy_bar.gd)
  whose fill drains from both edges toward the center instead of
  left-to-right.

Ship handling tuning:
- Turn rate reduced (4.0 -> 1.0 rad/s) so a quick tap no longer
  over-rotates; holding past 0.15s ramps to double speed (2.0 rad/s) for
  fast full turns, gated the same way damage already is so replay during
  reconciliation can't double-count the hold timer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-15 17:56:33 -04:00

95 lines
4.8 KiB
GDScript

extends Node
# Ship movement
var ship_thrust: float = 250.0
var ship_max_speed: float = 300.0
var ship_rotation_speed: float = 1.0
# Continuing to hold left/right past this many seconds ramps to
# ship_rotation_speed_held (double the tap rate) — a quick tap stays precise,
# a held turn goes faster. See ship_movement.gd's _simulate_step().
var ship_rotation_ramp_delay: float = 0.15
var ship_rotation_speed_held: float = 2.0
# Shooting
var ship_fire_rate: float = 0.15
var bullet_speed: float = 450.0
# Health & respawn
var ship_max_health: int = 100
var ship_respawn_delay: float = 3.0
var ship_invincibility_time: float = 2.0
var bullet_damage: int = 40
# Energy (see ships/ship_movement.gd) — max energy scales by ship role
# (Fighter/Gunner/Tank, see menu/team_select.gd's RACES ship "role" field);
# regen is a flat rate regardless of role, so bigger ships take longer to
# top off from empty than smaller ones.
var ship_max_energy_by_role: Dictionary = {"Fighter": 100.0, "Gunner": 150.0, "Tank": 250.0}
var bullet_energy_cost: float = 75.0
var ship_energy_regen_rate: float = 100.0 / 2.5 # 100 energy per 2.5s
# Environment collision (asteroids only) — bounce-back and impact damage scale with impact speed
var ship_bounce_restitution: float = 0.45
var ship_collision_damage_scale: float = 0.064
# One shared knob to resize every ship's in-world sprite at once, applied on
# top of each ship's own per-role "scale" in team_select.gd's RACES (see
# ship_movement.gd's _init_player()) — doesn't touch those individually
# balanced per-role values, just scales the end result uniformly.
var ship_scale_factor: float = 0.75
# Explosion VFX (effects/explosion.gd) — one shared knob to resize every
# explosion in the game at once; explosion_fps controls playback speed of the
# 12-frame animation (see assets/images/effects/explosion/). Each frame is
# held for 5 ticks (explosion.tscn's SpriteFrames "duration": 5.0 per frame,
# so mostly-transparent/dark frames like the opening spark and the frame 6
# ember cloud have time to register instead of reading as a flicker-to-black
# gap between the brighter frames) — total time is (12 * 5) / explosion_fps.
var explosion_scale: float = 0.75
var explosion_fps: float = 24.0 # 60 ticks / 24.0 fps = 2.5s total
# Locally-remembered callsign, pre-fills the name field on the menu.
# Race/ship/speed are per-peer now — see PlayerRegistry.
var player_name: String = ""
# Current map's play area, in world coordinates. Set by world.gd on load.
var world_bounds: Rect2 = Rect2(0, 0, 1152, 648)
# Random offset applied around a chosen team_a_spawn/team_b_spawn marker
# (see ship_movement.gd's _get_spawn_position()) so multiple ships spawning
# off the same single marker -- e.g. a 7-bot casual-fill team -- don't stack
# exactly on top of each other.
var spawn_scatter_radius: float = 150.0
# True while the chat input box has keyboard focus — gates ship movement/fire
# input so typing (e.g. the letter "w") doesn't also move the ship.
var chat_focused: bool = false
# True while TeamSelect is reopened mid-match (pause menu "SELECT TEAM") —
# same purpose as chat_focused, so clicking ship rows doesn't also fly the
# ship underneath. Not needed for the initial pre-spawn pick since the ship
# has no physics processing yet at that point.
var team_select_focused: bool = false
# Bots (casual fill) — see bots/bot_manager.gd and overview/bots.md
var bot_min_team_size: int = 7 # mirrors matchmaking-api's CASUAL_TEAM_SIZE default
var bot_engage_range: float = 500.0
# Personality trait ranges (bots/bot_personality.gd) — each bot rolls all 5
# traits 0..1 independently once at spawn; these ranges convert that roll
# into the concrete numbers BotAI actually flies with.
var bot_stop_distance_min: float = 70.0 # aggression 1: dogfights up close
var bot_stop_distance_max: float = 260.0 # aggression 0: hangs back at range
var bot_retreat_health_frac_min: float = 0.10 # caution 0: fights to the death
var bot_retreat_health_frac_max: float = 0.65 # caution 1: breaks off early
var bot_aim_tolerance_best_deg: float = 3.0 # accuracy 1: pinpoint gate
var bot_aim_tolerance_worst_deg: float = 14.0 # accuracy 0: sloppy gate
var bot_aim_jitter_max_px: float = 220.0 # accuracy 0: aims this far off the real spot
var bot_reaction_update_best_sec: float = 0.05 # reaction 1: re-aims almost every tick
var bot_reaction_update_worst_sec: float = 0.6 # reaction 0: laggy, stale tracking
var bot_awareness_range_min: float = 900.0 # awareness 0: near-sighted
var bot_awareness_range_max: float = 16000.0 # awareness 1: sees across the whole map
# map_01 spawns the two teams ~10608 units apart (see world/maps/map_01.tscn),
# on a ~14016x6000 map (diagonal ~15247) — the max must clear that or every
# bot spawns permanently unable to detect the enemy team and never advances.