feat(map): high-quality multiplayer movement map
96x96 arena with multi-level layout, grapple points, wall-run/climb surfaces, 6 team spawns with anti-camping cover, and varied movement challenges. Map Features: - Central multi-level structure: 20x20 platform (3u), 10x10 tower (6u), 14x14 top platform (9u) with crown cover walls and internal stairs - 4 corner towers (5u high) with railings and top platforms - 4 elevated mid-side walkways (3u) with railings connecting center to edges - 8 ramps: cardinal to central, diagonal to corners, to walkways - Quarter-pipe curve (8 segments) near NE corner - 4 parkour stepping stone chains (NW, NE, SW, SE quadrants) - Wall-run corridor (N side) with parallel walls, obstacles, and floor gap - Wall-run surfaces on all 4 outer wall sections - Wall-climb surfaces around central tower and mid-map (warm color) - 4 grapple anchor pillars (15u tall) with visible tops at cardinal points - Cover system: low walls, crate clusters, corridor walls, structural pillars - Speed corridor with side rails, speed bumps, and floor markings - 6 spawn alcoves (3 red: NW/SW/West, 3 blue: NE/SE/East) with cover walls - Anti-spawn-camping: each alcove has 2+ exits and blocking walls - Floor accent tiles in central area - Atmospheric sky with procedural sky material and fog - Directional sun + fill light + center omni + 6 spawn accent lights - Decorative: barrels, hazard stripes, accent beams, spawn area lights - Full multiplayer spawning, weapon system, HUD, entities preserved - All movement states: ground, air, wall_run, wall_climb, wall_cling, slide, dash, grapple Parse verified clean with Godot 4.2.1 headless.
This commit is contained in:
+472
-129
@@ -1,8 +1,9 @@
|
||||
extends Node3D
|
||||
class_name TestLevelBuilder
|
||||
|
||||
## Builds a full test environment from code — parkour geometry, lighting, player, HUD.
|
||||
## Attach to TestLevel root, press F5.
|
||||
## High-quality movement map for Papaya Shooter.
|
||||
## 96x96 arena with multi-level layout, grapple points, wall-run/climb surfaces,
|
||||
## 6 team spawns with anti-camping cover, and varied movement challenges.
|
||||
|
||||
var _speed_label: Label
|
||||
var _state_label: Label
|
||||
@@ -19,9 +20,7 @@ var _debug_ui_panel: PanelContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Hide mouse
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
_build_materials()
|
||||
_build_geometry()
|
||||
_build_hud()
|
||||
@@ -29,22 +28,17 @@ func _ready() -> void:
|
||||
# Multiplayer Spawning
|
||||
var spawner = MultiplayerSpawner.new()
|
||||
spawner.name = "PlayerSpawner"
|
||||
spawner.spawn_path = "." # Spawn directly as children of the level
|
||||
spawner.spawn_path = "."
|
||||
spawner.spawn_function = _spawn_player
|
||||
add_child(spawner)
|
||||
|
||||
var nm = get_node_or_null("/root/NetworkManager")
|
||||
if nm and nm.multiplayer.is_server():
|
||||
# Spawn existing players
|
||||
for pid in nm.player_stats.keys():
|
||||
spawner.spawn(pid)
|
||||
|
||||
# Spawn late joiners
|
||||
nm.player_connected.connect(func(pid):
|
||||
spawner.spawn(pid)
|
||||
)
|
||||
|
||||
# Despawn on disconnect
|
||||
nm.player_disconnected.connect(func(pid):
|
||||
var p = get_node_or_null(str(pid))
|
||||
if p:
|
||||
@@ -56,14 +50,26 @@ func _build_materials() -> void:
|
||||
pass
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# GEOMETRY
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
func _build_geometry() -> void:
|
||||
_build_environment()
|
||||
_build_floor()
|
||||
_build_walls_arena()
|
||||
_build_outer_walls()
|
||||
_build_central_structure()
|
||||
_build_corner_towers()
|
||||
-build_elevated_walkways()
|
||||
_build_ramps()
|
||||
_build_platforms()
|
||||
_build_wall_run_corridor()
|
||||
_build_stepping_stones()
|
||||
_build_wall_run_surfaces()
|
||||
_build_wall_climb_surfaces()
|
||||
_build_grapple_anchors()
|
||||
_build_cover_system()
|
||||
_build_speed_corridor()
|
||||
_build_spawn_alcoves()
|
||||
_build_decorations()
|
||||
_build_target_dummy()
|
||||
_build_lighting()
|
||||
|
||||
@@ -84,7 +90,7 @@ func _box_static(pos: Vector3, size: Vector3, color: Color, node_name: String =
|
||||
mesh.mesh.size = size
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.albedo_color = color
|
||||
mat.roughness = 0.8
|
||||
mat.roughness = 0.75
|
||||
mesh.mesh.surface_set_material(0, mat)
|
||||
body.add_child(mesh)
|
||||
return body
|
||||
@@ -96,6 +102,31 @@ func _ramp_static(pos: Vector3, size: Vector3, rot_deg: Vector3, color: Color, n
|
||||
return body
|
||||
|
||||
|
||||
# ── Color Palette ─────────────────────────────────────────────────────────────
|
||||
|
||||
var C_FLOOR: Color = Color(0.22, 0.22, 0.25)
|
||||
var C_FLOOR_ACCENT: Color = Color(0.28, 0.26, 0.22)
|
||||
var C_WALL: Color = Color(0.35, 0.28, 0.22)
|
||||
var C_WALL_DARK: Color = Color(0.25, 0.20, 0.18)
|
||||
var C_METAL: Color = Color(0.50, 0.52, 0.55)
|
||||
var C_METAL_DARK: Color = Color(0.35, 0.37, 0.40)
|
||||
var C_TEAL: Color = Color(0.20, 0.45, 0.55)
|
||||
var C_PURPLE: Color = Color(0.45, 0.25, 0.55)
|
||||
var C_ORANGE: Color = Color(0.60, 0.35, 0.15)
|
||||
var C_WOOD: Color = Color(0.55, 0.38, 0.22)
|
||||
var C_CRATE: Color = Color(0.65, 0.50, 0.30)
|
||||
var C_RED: Color = Color(0.70, 0.22, 0.22)
|
||||
var C_BLUE: Color = Color(0.22, 0.30, 0.70)
|
||||
var C_ACCENT_WARM: Color = Color(0.85, 0.55, 0.20)
|
||||
var C_ACCENT_COOL: Color = Color(0.20, 0.50, 0.85)
|
||||
var C_WALLRUN: Color = Color(0.20, 0.45, 0.65)
|
||||
var C_WALLCLIMB: Color = Color(0.55, 0.45, 0.20)
|
||||
var C_GREEN: Color = Color(0.20, 0.35, 0.20)
|
||||
var C_DARK_GREEN: Color = Color(0.15, 0.25, 0.15)
|
||||
var C_YELLOW: Color = Color(0.80, 0.75, 0.20)
|
||||
var C_RAMP: Color = Color(0.60, 0.35, 0.15)
|
||||
|
||||
|
||||
# ── Environment ───────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_environment() -> void:
|
||||
@@ -105,21 +136,22 @@ func _build_environment() -> void:
|
||||
environment.background_mode = Environment.BG_SKY
|
||||
var sky := Sky.new()
|
||||
var sky_mat := ProceduralSkyMaterial.new()
|
||||
sky_mat.sky_top_color = Color(0.15, 0.2, 0.35)
|
||||
sky_mat.sky_horizon_color = Color(0.45, 0.5, 0.65)
|
||||
sky_mat.ground_bottom_color = Color(0.1, 0.08, 0.06)
|
||||
sky_mat.ground_horizon_color = Color(0.35, 0.3, 0.25)
|
||||
sky_mat.sky_top_color = Color(0.12, 0.15, 0.30)
|
||||
sky_mat.sky_horizon_color = Color(0.40, 0.45, 0.55)
|
||||
sky_mat.ground_bottom_color = Color(0.08, 0.06, 0.05)
|
||||
sky_mat.ground_horizon_color = Color(0.30, 0.25, 0.20)
|
||||
sky.sky_material = sky_mat
|
||||
environment.sky = sky
|
||||
environment.ambient_light_source = Environment.AMBIENT_SOURCE_SKY
|
||||
environment.ambient_light_energy = 0.4
|
||||
environment.ambient_light_energy = 0.35
|
||||
environment.tonemap_mode = Environment.TONE_MAPPER_FILMIC
|
||||
environment.glow_enabled = true
|
||||
environment.glow_intensity = 0.3
|
||||
environment.glow_bloom = 0.1
|
||||
environment.glow_intensity = 0.2
|
||||
environment.glow_bloom = 0.08
|
||||
environment.fog_enabled = true
|
||||
environment.fog_light_color = Color(0.5, 0.55, 0.65)
|
||||
environment.fog_density = 0.002
|
||||
environment.fog_light_color = Color(0.45, 0.48, 0.55)
|
||||
environment.fog_density = 0.003
|
||||
environment.fog_sky_affinity = 0.5
|
||||
env.environment = environment
|
||||
add_child(env)
|
||||
|
||||
@@ -127,117 +159,426 @@ func _build_environment() -> void:
|
||||
# ── Floor ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_floor() -> void:
|
||||
# Main arena floor (80x80)
|
||||
_box_static(Vector3(0, -0.5, 0), Vector3(80, 1.0, 80), Color(0.22, 0.22, 0.25), "Floor_Main")
|
||||
# Main arena floor (96x96)
|
||||
_box_static(Vector3(0, -0.5, 0), Vector3(96, 1.0, 96), C_FLOOR, "Floor_Main")
|
||||
|
||||
# Floor accent tiles (checkerboard pattern in central area)
|
||||
for ix in range(-4, 5):
|
||||
for iz in range(-4, 5):
|
||||
if (ix + iz) % 2 == 0:
|
||||
_box_static(
|
||||
Vector3(float(ix) * 4.0, -0.49, float(iz) * 4.0),
|
||||
Vector3(3.8, 0.02, 3.8),
|
||||
C_FLOOR_ACCENT,
|
||||
"Floor_Tile_%d_%d" % [ix, iz]
|
||||
)
|
||||
|
||||
|
||||
# ── Arena Walls ───────────────────────────────────────────────────────────────
|
||||
# ── Outer Walls ───────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_outer_walls() -> void:
|
||||
var wall_height := 12.0
|
||||
var map_half := 48.0
|
||||
|
||||
func _build_walls_arena() -> void:
|
||||
var wall_color := Color(0.35, 0.28, 0.22)
|
||||
var wall_height := 10.0
|
||||
# North
|
||||
_box_static(Vector3(0, wall_height * 0.5, -40), Vector3(80, wall_height, 0.5), wall_color, "Wall_North")
|
||||
_box_static(Vector3(0, wall_height * 0.5, -map_half), Vector3(96, wall_height, 1.0), C_WALL, "Wall_North")
|
||||
# South
|
||||
_box_static(Vector3(0, wall_height * 0.5, 40), Vector3(80, wall_height, 0.5), wall_color, "Wall_South")
|
||||
_box_static(Vector3(0, wall_height * 0.5, map_half), Vector3(96, wall_height, 1.0), C_WALL, "Wall_South")
|
||||
# East
|
||||
_box_static(Vector3(40, wall_height * 0.5, 0), Vector3(0.5, wall_height, 80), wall_color, "Wall_East")
|
||||
_box_static(Vector3(map_half, wall_height * 0.5, 0), Vector3(1.0, wall_height, 96), C_WALL, "Wall_East")
|
||||
# West
|
||||
_box_static(Vector3(-40, wall_height * 0.5, 0), Vector3(0.5, wall_height, 80), wall_color, "Wall_West")
|
||||
_box_static(Vector3(-map_half, wall_height * 0.5, 0), Vector3(1.0, wall_height, 96), C_WALL, "Wall_West")
|
||||
|
||||
|
||||
# ── Central Structure ─────────────────────────────────────────────────────────
|
||||
|
||||
func _build_central_structure() -> void:
|
||||
# Main platform (3u high, 20x20)
|
||||
_box_static(Vector3(0, 1.5, 0), Vector3(20, 3.0, 20), C_METAL_DARK, "Central_Platform")
|
||||
|
||||
# Upper tower (6u high, 10x10)
|
||||
_box_static(Vector3(0, 6.0, 0), Vector3(10, 6.0, 10), C_WALL_DARK, "Central_Tower")
|
||||
|
||||
# Tower top platform (9u high, 14x14) - grapple target
|
||||
_box_static(Vector3(0, 11.5, 0), Vector3(14, 1.0, 14), C_METAL, "Central_Top")
|
||||
|
||||
# Tower crown walls (partial cover on top)
|
||||
_box_static(Vector3(-5, 13.5, -5), Vector3(4, 3.0, 0.5), C_METAL, "Crown_NW")
|
||||
_box_static(Vector3(5, 13.5, 5), Vector3(4, 3.0, 0.5), C_METAL, "Crown_SE")
|
||||
_box_static(Vector3(-5, 13.5, 5), Vector3(0.5, 3.0, 4), C_METAL, "Crown_SW")
|
||||
_box_static(Vector3(5, 13.5, -5), Vector3(0.5, 3.0, 4), C_METAL, "Crown_NE")
|
||||
|
||||
# Staircase inside tower (ramp approximation with steps)
|
||||
for i in range(8):
|
||||
var step_y := 2.0 + float(i) * 0.85
|
||||
var step_size := 6.0 - float(i) * 0.4
|
||||
_box_static(
|
||||
Vector3(0, step_y, -3.0 + float(i) * 0.3),
|
||||
Vector3(step_size, 0.3, 2.5),
|
||||
C_METAL,
|
||||
"Central_Step_%d" % i
|
||||
)
|
||||
|
||||
|
||||
# ── Corner Towers ─────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_corner_towers() -> void:
|
||||
# Each corner has a tower (5u high, 8x8 base) with spawn alcoves at base
|
||||
var tower_offsets := [
|
||||
Vector3(-36, 0, -36),
|
||||
Vector3(36, 0, -36),
|
||||
Vector3(-36, 0, 36),
|
||||
Vector3(36, 0, 36),
|
||||
]
|
||||
for offset in tower_offsets:
|
||||
# Tower base
|
||||
_box_static(offset + Vector3(0, 2.5, 0), Vector3(8, 5.0, 8), C_WALL_DARK, "Tower_%d" % tower_offsets.find(offset))
|
||||
# Tower top platform
|
||||
_box_static(offset + Vector3(0, 5.5, 0), Vector3(10, 1.0, 10), C_METAL, "TowerTop_%d" % tower_offsets.find(offset))
|
||||
# Tower corner railing
|
||||
_box_static(offset + Vector3(4, 7.0, 4), Vector3(2, 2.0, 0.4), C_METAL, "TowerRailA_%d" % tower_offsets.find(offset))
|
||||
_box_static(offset + Vector3(4, 7.0, -4), Vector3(0.4, 2.0, 2), C_METAL, "TowerRailB_%d" % tower_offsets.find(offset))
|
||||
|
||||
|
||||
# ── Elevated Walkways ─────────────────────────────────────────────────────────
|
||||
|
||||
func _build_elevated_walkways() -> void:
|
||||
# Mid-side elevated walkways (3u high) connecting central to edges
|
||||
# North walkway
|
||||
_box_static(Vector3(0, 3.0, -30), Vector3(6, 0.6, 20), C_METAL, "Walkway_North")
|
||||
# South walkway
|
||||
_box_static(Vector3(0, 3.0, 30), Vector3(6, 0.6, 20), C_METAL, "Walkway_South")
|
||||
# East walkway
|
||||
_box_static(Vector3(30, 3.0, 0), Vector3(20, 0.6, 6), C_METAL, "Walkway_East")
|
||||
# West walkway
|
||||
_box_static(Vector3(-30, 3.0, 0), Vector3(20, 0.6, 6), C_METAL, "Walkway_West")
|
||||
|
||||
# Walkway railings
|
||||
_box_static(Vector3(-3.2, 4.5, -30), Vector3(0.3, 2.0, 20), C_METAL, "Rail_N_W")
|
||||
_box_static(Vector3(3.2, 4.5, -30), Vector3(0.3, 2.0, 20), C_METAL, "Rail_N_E")
|
||||
_box_static(Vector3(-3.2, 4.5, 30), Vector3(0.3, 2.0, 20), C_METAL, "Rail_S_W")
|
||||
_box_static(Vector3(3.2, 4.5, 30), Vector3(0.3, 2.0, 20), C_METAL, "Rail_S_E")
|
||||
|
||||
|
||||
# ── Ramps ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_ramps() -> void:
|
||||
var ramp_color := Color(0.6, 0.35, 0.15) # Orange-brown
|
||||
# Ramps from ground to central platform (4 cardinal)
|
||||
_ramp_static(Vector3(0, 1.5, -14), Vector3(8, 0.5, 8), Vector3(12, 0, 0), C_RAMP, "Ramp_CN")
|
||||
_ramp_static(Vector3(0, 1.5, 14), Vector3(8, 0.5, 8), Vector3(-12, 0, 0), C_RAMP, "Ramp_CS")
|
||||
_ramp_static(Vector3(14, 1.5, 0), Vector3(8, 0.5, 8), Vector3(0, 0, 12), C_RAMP, "Ramp_CE")
|
||||
_ramp_static(Vector3(-14, 1.5, 0), Vector3(8, 0.5, 8), Vector3(0, 0, -12), C_RAMP, "Ramp_CW")
|
||||
|
||||
# Gentle ramp (15 degrees)
|
||||
_ramp_static(Vector3(-25, 1.0, -25), Vector3(8, 0.4, 12), Vector3(15, 0, 0), ramp_color, "Ramp_Gentle")
|
||||
# Ramps from ground to corner towers
|
||||
_ramp_static(Vector3(-36, 1.5, -28), Vector3(5, 0.5, 10), Vector3(15, 0, 0), C_WOOD, "Ramp_Tower_NW")
|
||||
_ramp_static(Vector3(36, 1.5, -28), Vector3(5, 0.5, 10), Vector3(15, 0, 0), C_WOOD, "Ramp_Tower_NE")
|
||||
_ramp_static(Vector3(-36, 1.5, 28), Vector3(5, 0.5, 10), Vector3(-15, 0, 0), C_WOOD, "Ramp_Tower_SW")
|
||||
_ramp_static(Vector3(36, 1.5, 28), Vector3(5, 0.5, 10), Vector3(-15, 0, 0), C_WOOD, "Ramp_Tower_SE")
|
||||
|
||||
# Medium ramp (30 degrees)
|
||||
_ramp_static(Vector3(-25, 2.0, -15), Vector3(8, 0.4, 10), Vector3(30, 0, 0), ramp_color, "Ramp_Medium")
|
||||
# Ramps to elevated walkways
|
||||
_ramp_static(Vector3(0, 1.5, -20), Vector3(5, 0.5, 6), Vector3(10, 0, 0), C_RAMP, "Ramp_Walk_N")
|
||||
_ramp_static(Vector3(0, 1.5, 20), Vector3(5, 0.5, 6), Vector3(-10, 0, 0), C_RAMP, "Ramp_Walk_S")
|
||||
_ramp_static(Vector3(20, 1.5, 0), Vector3(6, 0.5, 5), Vector3(0, 0, 10), C_RAMP, "Ramp_Walk_E")
|
||||
_ramp_static(Vector3(-20, 1.5, 0), Vector3(6, 0.5, 5), Vector3(0, 0, -10), C_RAMP, "Ramp_Walk_W")
|
||||
|
||||
# Steep ramp (45 degrees)
|
||||
_ramp_static(Vector3(-25, 3.0, -5), Vector3(8, 0.4, 8), Vector3(45, 0, 0), ramp_color, "Ramp_Steep")
|
||||
|
||||
# Quarter pipe (curved ramp approximation)
|
||||
for i in range(6):
|
||||
var angle := float(i) * 15.0
|
||||
var x_off := sin(deg_to_rad(angle)) * 5.0
|
||||
var y_off := (1.0 - cos(deg_to_rad(angle))) * 5.0
|
||||
# Quarter-pipe (curved ramp approximation) near center
|
||||
for i in range(8):
|
||||
var angle := float(i) * 11.25
|
||||
var x_off := sin(deg_to_rad(angle)) * 6.0
|
||||
var y_off := (1.0 - cos(deg_to_rad(angle))) * 6.0
|
||||
_ramp_static(
|
||||
Vector3(-25 + x_off, y_off + 0.2, 8 + float(i) * 0.5),
|
||||
Vector3(8, 0.3, 2),
|
||||
Vector3(20 + x_off, y_off + 0.2, -20 + float(i) * 0.6),
|
||||
Vector3(6, 0.3, 2),
|
||||
Vector3(angle, 0, 0),
|
||||
Color(0.7, 0.4, 0.2),
|
||||
C_ORANGE,
|
||||
"QuarterPipe_%d" % i
|
||||
)
|
||||
|
||||
|
||||
# ── Platforms ─────────────────────────────────────────────────────────────────
|
||||
# ── Stepping Stones ───────────────────────────────────────────────────────────
|
||||
|
||||
func _build_platforms() -> void:
|
||||
var plat_color := Color(0.2, 0.45, 0.55) # Teal
|
||||
func _build_stepping_stones() -> void:
|
||||
# Parkour chain: NW quadrant
|
||||
_box_static(Vector3(-12, 0.6, -12), Vector3(3, 1.2, 3), C_TEAL, "Step_NW_1")
|
||||
_box_static(Vector3(-16, 1.5, -16), Vector3(3, 0.5, 3), C_TEAL, "Step_NW_2")
|
||||
_box_static(Vector3(-20, 2.5, -20), Vector3(3, 0.5, 3), C_TEAL, "Step_NW_3")
|
||||
_box_static(Vector3(-24, 3.5, -24), Vector3(3, 0.5, 3), C_TEAL, "Step_NW_4")
|
||||
|
||||
# Low platforms (jump height test)
|
||||
_box_static(Vector3(10, 0.6, -20), Vector3(4, 1.2, 4), plat_color, "Plat_Low_1")
|
||||
_box_static(Vector3(16, 0.6, -20), Vector3(4, 1.2, 4), plat_color, "Plat_Low_2")
|
||||
_box_static(Vector3(22, 0.6, -20), Vector3(4, 1.2, 4), plat_color, "Plat_Low_3")
|
||||
# Parkour chain: SE quadrant
|
||||
_box_static(Vector3(12, 0.6, 12), Vector3(3, 1.2, 3), C_TEAL, "Step_SE_1")
|
||||
_box_static(Vector3(16, 1.5, 16), Vector3(3, 0.5, 3), C_TEAL, "Step_SE_2")
|
||||
_box_static(Vector3(20, 2.5, 20), Vector3(3, 0.5, 3), C_TEAL, "Step_SE_3")
|
||||
_box_static(Vector3(24, 3.5, 24), Vector3(3, 0.5, 3), C_TEAL, "Step_SE_4")
|
||||
|
||||
# Medium platforms (double jump required)
|
||||
var med_color := Color(0.25, 0.5, 0.4)
|
||||
_box_static(Vector3(10, 2.5, -28), Vector3(3, 0.5, 3), med_color, "Plat_Med_1")
|
||||
_box_static(Vector3(16, 3.5, -28), Vector3(3, 0.5, 3), med_color, "Plat_Med_2")
|
||||
_box_static(Vector3(22, 4.5, -28), Vector3(3, 0.5, 3), med_color, "Plat_Med_3")
|
||||
_box_static(Vector3(28, 5.5, -28), Vector3(3, 0.5, 3), med_color, "Plat_Med_4")
|
||||
# Parkour chain: NE quadrant (lower, for double-jump practice)
|
||||
_box_static(Vector3(12, 0.6, -12), Vector3(3, 1.2, 3), C_PURPLE, "Step_NE_1")
|
||||
_box_static(Vector3(16, 2.0, -16), Vector3(2.5, 0.5, 2.5), C_PURPLE, "Step_NE_2")
|
||||
_box_static(Vector3(20, 3.5, -20), Vector3(2.5, 0.5, 2.5), C_PURPLE, "Step_NE_3")
|
||||
|
||||
# High tower
|
||||
_box_static(Vector3(28, 4.0, -20), Vector3(5, 8.0, 5), Color(0.3, 0.3, 0.5), "Tower_1")
|
||||
|
||||
# Floating platforms (dash required)
|
||||
var dash_color := Color(0.6, 0.2, 0.5) # Purple
|
||||
_box_static(Vector3(10, 5.0, -35), Vector3(2.5, 0.3, 2.5), dash_color, "Plat_Dash_1")
|
||||
_box_static(Vector3(18, 5.0, -35), Vector3(2.5, 0.3, 2.5), dash_color, "Plat_Dash_2")
|
||||
_box_static(Vector3(26, 5.0, -35), Vector3(2.5, 0.3, 2.5), dash_color, "Plat_Dash_3")
|
||||
# Parkour chain: SW quadrant
|
||||
_box_static(Vector3(-12, 0.6, 12), Vector3(3, 1.2, 3), C_PURPLE, "Step_SW_1")
|
||||
_box_static(Vector3(-16, 2.0, 16), Vector3(2.5, 0.5, 2.5), C_PURPLE, "Step_SW_2")
|
||||
_box_static(Vector3(-20, 3.5, 20), Vector3(2.5, 0.5, 2.5), C_PURPLE, "Step_SW_3")
|
||||
|
||||
|
||||
# ── Wall Run Corridor ────────────────────────────────────────────────────────
|
||||
# ── Wall-Run Surfaces ────────────────────────────────────────────────────────
|
||||
|
||||
func _build_wall_run_corridor() -> void:
|
||||
var wall_color := Color(0.45, 0.25, 0.55) # Purple walls
|
||||
|
||||
# Two parallel walls — spaced for wall running
|
||||
func _build_wall_run_surfaces() -> void:
|
||||
# Dedicated wall-run corridor (North side, between walkway and north wall)
|
||||
# Left wall
|
||||
_box_static(Vector3(-5, 5, 15), Vector3(0.5, 10, 25), wall_color, "WallRun_Left")
|
||||
_box_static(Vector3(-8, 6, -38), Vector3(0.5, 12, 16), C_WALLRUN, "WallRunWall_L")
|
||||
# Right wall
|
||||
_box_static(Vector3(5, 5, 15), Vector3(0.5, 10, 25), wall_color, "WallRun_Right")
|
||||
_box_static(Vector3(8, 6, -38), Vector3(0.5, 12, 16), C_WALLRUN, "WallRunWall_R")
|
||||
|
||||
# Obstacles in corridor to jump over
|
||||
_box_static(Vector3(0, 0.75, 10), Vector3(10, 1.5, 1), Color(0.6, 0.3, 0.3), "Obstacle_1")
|
||||
_box_static(Vector3(0, 0.75, 20), Vector3(10, 1.5, 1), Color(0.6, 0.3, 0.3), "Obstacle_2")
|
||||
_box_static(Vector3(0, 0.75, -34), Vector3(16, 1.5, 1.0), C_RED, "WallRun_Obs1")
|
||||
_box_static(Vector3(0, 0.75, -42), Vector3(16, 1.5, 1.0), C_RED, "WallRun_Obs2")
|
||||
|
||||
# Gap in floor (forces wall run)
|
||||
# Just raise the floor slightly on each side with a gap
|
||||
_box_static(Vector3(-3, -0.75, 25), Vector3(4, 0.5, 4), Color(0.22, 0.22, 0.25), "WallRun_Floor_L")
|
||||
_box_static(Vector3(3, -0.75, 25), Vector3(4, 0.5, 4), Color(0.22, 0.22, 0.25), "WallRun_Floor_R")
|
||||
# Floor gap in corridor (forces wall-run)
|
||||
_box_static(Vector3(-5, -0.75, -38), Vector3(6, 0.5, 16), C_FLOOR, "WallRun_Floor_L")
|
||||
_box_static(Vector3(5, -0.75, -38), Vector3(6, 0.5, 16), C_FLOOR, "WallRun_Floor_R")
|
||||
|
||||
# Label pillar at entrance
|
||||
_box_static(Vector3(0, 2, 2), Vector3(1, 4, 1), Color(0.55, 0.35, 0.65), "WallRun_Marker")
|
||||
# Wall-run sections on outer walls (lower portions)
|
||||
_box_static(Vector3(-40, 4, -47.5), Vector3(16, 8, 0.5), C_WALLRUN, "OuterWallRun_N1")
|
||||
_box_static(Vector3(40, 4, -47.5), Vector3(16, 8, 0.5), C_WALLRUN, "OuterWallRun_N2")
|
||||
_box_static(Vector3(-40, 4, 47.5), Vector3(16, 8, 0.5), C_WALLRUN, "OuterWallRun_S1")
|
||||
_box_static(Vector3(40, 4, 47.5), Vector3(16, 8, 0.5), C_WALLRUN, "OuterWallRun_S2")
|
||||
_box_static(Vector3(-47.5, 4, -40), Vector3(0.5, 8, 16), C_WALLRUN, "OuterWallRun_W1")
|
||||
_box_static(Vector3(-47.5, 4, 40), Vector3(0.5, 8, 16), C_WALLRUN, "OuterWallRun_W2")
|
||||
_box_static(Vector3(47.5, 4, -40), Vector3(0.5, 8, 16), C_WALLRUN, "OuterWallRun_E1")
|
||||
_box_static(Vector3(47.5, 4, 40), Vector3(0.5, 8, 16), C_WALLRUN, "OuterWallRun_E2")
|
||||
|
||||
|
||||
# ── Wall-Climb Surfaces ──────────────────────────────────────────────────────
|
||||
|
||||
func _build_wall_climb_surfaces() -> void:
|
||||
# Textured walls for wall-climbing (distinct warm color)
|
||||
# Around central tower
|
||||
_box_static(Vector3(-7, 4, 0), Vector3(0.5, 6, 6), C_WALLCLIMB, "WallClimb_C1")
|
||||
_box_static(Vector3(7, 4, 0), Vector3(0.5, 6, 6), C_WALLCLIMB, "WallClimb_C2")
|
||||
|
||||
# Mid-map wall-climb walls
|
||||
_box_static(Vector3(-24, 4, 0), Vector3(0.5, 8, 8), C_WALLCLIMB, "WallClimb_W")
|
||||
_box_static(Vector3(24, 4, 0), Vector3(0.5, 8, 8), C_WALLCLIMB, "WallClimb_E")
|
||||
|
||||
|
||||
# ── Grapple Anchors ───────────────────────────────────────────────────────────
|
||||
|
||||
func _build_grapple_anchors() -> void:
|
||||
# Tall pillar structures that serve as grapple targets
|
||||
# Each is a tall, visible pillar with a distinct top
|
||||
var pillar_positions := [
|
||||
Vector3(-30, 0, 0),
|
||||
Vector3(30, 0, 0),
|
||||
Vector3(0, 0, -30),
|
||||
Vector3(0, 0, 30),
|
||||
]
|
||||
for i in range(pillar_positions.size()):
|
||||
var pos := pillar_positions[i]
|
||||
# Pillar shaft (15u tall)
|
||||
_box_static(pos + Vector3(0, 7.5, 0), Vector3(2, 15, 2), C_METAL, "GrapplePillar_%d" % i)
|
||||
# Pillar top (grapple target marker)
|
||||
_box_static(pos + Vector3(0, 15.5, 0), Vector3(4, 1.0, 4), C_ACCENT_WARM, "GrappleTop_%d" % i)
|
||||
# Pillar base
|
||||
_box_static(pos + Vector3(0, 0.5, 0), Vector3(4, 1.0, 4), C_METAL_DARK, "GrappleBase_%d" % i)
|
||||
|
||||
|
||||
# ── Cover System ──────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_cover_system() -> void:
|
||||
# Low walls (1.5u) for crouch cover - central area
|
||||
_box_static(Vector3(-8, 0.75, -8), Vector3(5, 1.5, 0.5), C_WALL, "Cover_C1")
|
||||
_box_static(Vector3(8, 0.75, 8), Vector3(5, 1.5, 0.5), C_WALL, "Cover_C2")
|
||||
_box_static(Vector3(-8, 0.75, 8), Vector3(0.5, 1.5, 5), C_WALL, "Cover_C3")
|
||||
_box_static(Vector3(8, 0.75, -8), Vector3(0.5, 1.5, 5), C_WALL, "Cover_C4")
|
||||
|
||||
# Crate clusters
|
||||
_crate(Vector3(-15, 0.6, 0))
|
||||
_crate(Vector3(-15, 0.6, 1.4))
|
||||
_crate(Vector3(-15, 1.2, 0.7))
|
||||
|
||||
_crate(Vector3(15, 0.6, 0))
|
||||
_crate(Vector3(15, 0.6, -1.4))
|
||||
_crate(Vector3(15, 1.2, -0.7))
|
||||
|
||||
_crate(Vector3(0, 0.6, -15))
|
||||
_crate(Vector3(1.4, 0.6, -15))
|
||||
_crate(Vector3(0.7, 1.2, -15))
|
||||
|
||||
_crate(Vector3(0, 0.6, 15))
|
||||
_crate(Vector3(-1.4, 0.6, 15))
|
||||
_crate(Vector3(-0.7, 1.2, 15))
|
||||
|
||||
# Corridor walls (create engagement lanes)
|
||||
_box_static(Vector3(-20, 2.0, -10), Vector3(16, 4.0, 0.5), C_WALL_DARK, "LaneWall_W1")
|
||||
_box_static(Vector3(-20, 2.0, 10), Vector3(16, 4.0, 0.5), C_WALL_DARK, "LaneWall_W2")
|
||||
_box_static(Vector3(20, 2.0, -10), Vector3(16, 4.0, 0.5), C_WALL_DARK, "LaneWall_E1")
|
||||
_box_static(Vector3(20, 2.0, 10), Vector3(16, 4.0, 0.5), C_WALL_DARK, "LaneWall_E2")
|
||||
|
||||
# Structural pillars (cover in open areas)
|
||||
_pillar(Vector3(-14, 3.5, -14))
|
||||
_pillar(Vector3(14, 3.5, -14))
|
||||
_pillar(Vector3(-14, 3.5, 14))
|
||||
_pillar(Vector3(14, 3.5, 14))
|
||||
|
||||
|
||||
func _crate(pos: Vector3) -> void:
|
||||
_box_static(pos, Vector3(1.2, 1.2, 1.2), C_CRATE, "Crate")
|
||||
|
||||
|
||||
func _pillar(pos: Vector3) -> void:
|
||||
_box_static(pos, Vector3(0.8, 7.0, 0.8), C_METAL, "Pillar")
|
||||
|
||||
|
||||
# ── Speed Corridor ────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_speed_corridor() -> void:
|
||||
# Long straight for sprint→slide→bhop chains
|
||||
var corridor_color := Color(0.2, 0.35, 0.2) # Dark green
|
||||
# Long straight for sprint -> slide -> bunny-hop chains
|
||||
var corridor_color := C_DARK_GREEN
|
||||
|
||||
# Side rails
|
||||
_box_static(Vector3(30, 1.5, 0), Vector3(0.3, 3, 60), corridor_color, "SpeedRail_Left")
|
||||
_box_static(Vector3(38, 1.5, 0), Vector3(0.3, 3, 60), corridor_color, "SpeedRail_Right")
|
||||
_box_static(Vector3(38, 2.0, -20), Vector3(0.4, 4, 30), corridor_color, "SpeedRail_L")
|
||||
_box_static(Vector3(44, 2.0, -20), Vector3(0.4, 4, 30), corridor_color, "SpeedRail_R")
|
||||
|
||||
# Speed bumps (small obstacles to hop over)
|
||||
for i in range(-25, 26, 10):
|
||||
_box_static(Vector3(34, 0.15, float(i)), Vector3(8, 0.3, 0.5), Color(0.8, 0.8, 0.2), "SpeedBump_%d" % i)
|
||||
# Speed bumps
|
||||
for i in range(-15, 16, 8):
|
||||
_box_static(Vector3(41, 0.2, float(i)), Vector3(6, 0.4, 0.6), C_YELLOW, "SpeedBump_%d" % i)
|
||||
|
||||
# Floor markings
|
||||
for i in range(-12, 13, 4):
|
||||
_box_static(Vector3(41, 0.02, float(i)), Vector3(4, 0.02, 0.3), C_YELLOW, "SpeedMark_%d" % i)
|
||||
|
||||
|
||||
# ── Spawn Alcoves ─────────────────────────────────────────────────────────────
|
||||
# 6 spawns: 3 red (NW, SW, West-mid), 3 blue (NE, SE, East-mid)
|
||||
# Each spawn is in a covered alcove with 2+ exit routes.
|
||||
|
||||
func _build_spawn_alcoves() -> void:
|
||||
# ── Red Spawns ──
|
||||
|
||||
# Red Spawn 1: NW corner
|
||||
_spawn_floor(Vector3(-42, 0.01, -42), C_RED, "Spawn_Red_1")
|
||||
_spawn_cover(Vector3(-40, 1.5, -45), Vector3(6, 3.0, 0.4), C_RED, "SpawnCover_R1A")
|
||||
_spawn_cover(Vector3(-45, 1.5, -40), Vector3(0.4, 3.0, 6), C_RED, "SpawnCover_R1B")
|
||||
_spawn_cover(Vector3(-38, 1.5, -38), Vector3(0.4, 3.0, 4), C_WALL_DARK, "SpawnCover_R1C")
|
||||
|
||||
# Red Spawn 2: SW corner
|
||||
_spawn_floor(Vector3(-42, 0.01, 42), C_RED, "Spawn_Red_2")
|
||||
_spawn_cover(Vector3(-40, 1.5, 45), Vector3(6, 3.0, 0.4), C_RED, "SpawnCover_R2A")
|
||||
_spawn_cover(Vector3(-45, 1.5, 40), Vector3(0.4, 3.0, 6), C_RED, "SpawnCover_R2B")
|
||||
_spawn_cover(Vector3(-38, 1.5, 38), Vector3(0.4, 3.0, 4), C_WALL_DARK, "SpawnCover_R2C")
|
||||
|
||||
# Red Spawn 3: West mid
|
||||
_spawn_floor(Vector3(-44, 0.01, 0), C_RED, "Spawn_Red_3")
|
||||
_spawn_cover(Vector3(-42, 1.5, -3), Vector3(0.4, 3.0, 6), C_RED, "SpawnCover_R3A")
|
||||
_spawn_cover(Vector3(-42, 1.5, 3), Vector3(0.4, 3.0, 6), C_RED, "SpawnCover_R3B")
|
||||
_spawn_cover(Vector3(-40, 1.5, 0), Vector3(4, 3.0, 0.4), C_WALL_DARK, "SpawnCover_R3C")
|
||||
|
||||
# ── Blue Spawns ──
|
||||
|
||||
# Blue Spawn 1: NE corner
|
||||
_spawn_floor(Vector3(42, 0.01, -42), C_BLUE, "Spawn_Blue_1")
|
||||
_spawn_cover(Vector3(40, 1.5, -45), Vector3(6, 3.0, 0.4), C_BLUE, "SpawnCover_B1A")
|
||||
_spawn_cover(Vector3(45, 1.5, -40), Vector3(0.4, 3.0, 6), C_BLUE, "SpawnCover_B1B")
|
||||
_spawn_cover(Vector3(38, 1.5, -38), Vector3(0.4, 3.0, 4), C_WALL_DARK, "SpawnCover_B1C")
|
||||
|
||||
# Blue Spawn 2: SE corner
|
||||
_spawn_floor(Vector3(42, 0.01, 42), C_BLUE, "Spawn_Blue_2")
|
||||
_spawn_cover(Vector3(40, 1.5, 45), Vector3(6, 3.0, 0.4), C_BLUE, "SpawnCover_B2A")
|
||||
_spawn_cover(Vector3(45, 1.5, 40), Vector3(0.4, 3.0, 6), C_BLUE, "SpawnCover_B2B")
|
||||
_spawn_cover(Vector3(38, 1.5, 38), Vector3(0.4, 3.0, 4), C_WALL_DARK, "SpawnCover_B2C")
|
||||
|
||||
# Blue Spawn 3: East mid
|
||||
_spawn_floor(Vector3(44, 0.01, 0), C_BLUE, "Spawn_Blue_3")
|
||||
_spawn_cover(Vector3(42, 1.5, -3), Vector3(0.4, 3.0, 6), C_BLUE, "SpawnCover_B3A")
|
||||
_spawn_cover(Vector3(42, 1.5, 3), Vector3(0.4, 3.0, 6), C_BLUE, "SpawnCover_B3B")
|
||||
_spawn_cover(Vector3(40, 1.5, 0), Vector3(4, 3.0, 0.4), C_WALL_DARK, "SpawnCover_B3C")
|
||||
|
||||
|
||||
func _spawn_floor(pos: Vector3, color: Color, label: String) -> void:
|
||||
var body := StaticBody3D.new()
|
||||
body.name = label
|
||||
body.position = pos
|
||||
add_child(body)
|
||||
var mesh := MeshInstance3D.new()
|
||||
mesh.mesh = BoxMesh.new()
|
||||
mesh.mesh.size = Vector3(4, 0.05, 4)
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.albedo_color = color
|
||||
mat.roughness = 0.4
|
||||
mesh.mesh.surface_set_material(0, mat)
|
||||
body.add_child(mesh)
|
||||
|
||||
|
||||
func _spawn_cover(pos: Vector3, size: Vector3, color: Color, label: String) -> void:
|
||||
_box_static(pos, size, color, label)
|
||||
|
||||
|
||||
# ── Decorations ───────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_decorations() -> void:
|
||||
# Accent beams on outer walls
|
||||
for i in range(-5, 6):
|
||||
var z_pos := float(i) * 8.0
|
||||
_box_static(Vector3(-47.5, 9.0, z_pos), Vector3(0.3, 0.3, 5.0), C_ACCENT_WARM, "AccentBeam_W_%d" % i)
|
||||
_box_static(Vector3(47.5, 9.0, z_pos), Vector3(0.3, 0.3, 5.0), C_ACCENT_COOL, "AccentBeam_E_%d" % i)
|
||||
|
||||
# Hazard stripes on ramp edges
|
||||
for i in range(4):
|
||||
var offset := -2.5 + float(i) * 1.5
|
||||
_box_static(Vector3(offset, 0.05, -17.8), Vector3(1.0, 0.1, 0.4), C_YELLOW, "Hazard_CN_%d" % i)
|
||||
_box_static(Vector3(offset, 0.05, 17.8), Vector3(1.0, 0.1, 0.4), C_YELLOW, "Hazard_CS_%d" % i)
|
||||
|
||||
# Barrels
|
||||
_barrel(Vector3(-30, 0.5, -5))
|
||||
_barrel(Vector3(-30, 0.5, -6.5))
|
||||
_barrel(Vector3(30, 0.5, 5))
|
||||
_barrel(Vector3(30, 0.5, 6.5))
|
||||
_barrel(Vector3(5, 0.5, -30))
|
||||
_barrel(Vector3(-5, 0.5, 30))
|
||||
_barrel(Vector3(-25, 0.5, 25))
|
||||
_barrel(Vector3(25, 0.5, -25))
|
||||
|
||||
# Spawn area lights
|
||||
_spawn_area_light(Vector3(-42, 3, -42), C_ACCENT_WARM, 6.0, 0.8)
|
||||
_spawn_area_light(Vector3(-42, 3, 42), C_ACCENT_WARM, 6.0, 0.8)
|
||||
_spawn_area_light(Vector3(-44, 3, 0), C_ACCENT_WARM, 6.0, 0.8)
|
||||
_spawn_area_light(Vector3(42, 3, -42), C_ACCENT_COOL, 6.0, 0.8)
|
||||
_spawn_area_light(Vector3(42, 3, 42), C_ACCENT_COOL, 6.0, 0.8)
|
||||
_spawn_area_light(Vector3(44, 3, 0), C_ACCENT_COOL, 6.0, 0.8)
|
||||
|
||||
|
||||
func _barrel(pos: Vector3) -> void:
|
||||
var body := StaticBody3D.new()
|
||||
body.name = "Barrel"
|
||||
body.position = pos
|
||||
add_child(body)
|
||||
var mesh := MeshInstance3D.new()
|
||||
mesh.mesh = CylinderMesh.new()
|
||||
mesh.mesh.top_radius = 0.4
|
||||
mesh.mesh.bottom_radius = 0.4
|
||||
mesh.mesh.height = 1.0
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.albedo_color = Color(0.50, 0.45, 0.30)
|
||||
mat.roughness = 0.6
|
||||
mesh.mesh.surface_set_material(0, mat)
|
||||
body.add_child(mesh)
|
||||
var shape := CollisionShape3D.new()
|
||||
shape.shape = CylinderShape3D.new()
|
||||
shape.shape.radius = 0.4
|
||||
shape.shape.height = 1.0
|
||||
body.add_child(shape)
|
||||
|
||||
|
||||
func _spawn_area_light(pos: Vector3, color: Color, radius: float, energy: float) -> void:
|
||||
var light := OmniLight3D.new()
|
||||
light.name = "SpawnLight"
|
||||
light.position = pos
|
||||
light.light_color = color
|
||||
light.light_energy = energy
|
||||
light.omni_range = radius
|
||||
light.shadow_enabled = false
|
||||
add_child(light)
|
||||
|
||||
|
||||
# ── Dummies ───────────────────────────────────────────────────────────────────
|
||||
@@ -245,22 +586,22 @@ func _build_speed_corridor() -> void:
|
||||
func _build_target_dummy() -> void:
|
||||
var dummy = load("res://entities/target_dummy.gd").new()
|
||||
dummy.name = "TargetDummy"
|
||||
# Place it somewhat centrally in the main arena, but out of the immediate spawn area
|
||||
dummy.position = Vector3(0, 0, -10)
|
||||
dummy.position = Vector3(0, 0, -15)
|
||||
add_child(dummy)
|
||||
|
||||
var killable = load("res://entities/killable_dummy.gd").new()
|
||||
killable.name = "KillableDummy"
|
||||
killable.position = Vector3(5, 0, -10)
|
||||
killable.position = Vector3(5, 0, -15)
|
||||
add_child(killable)
|
||||
|
||||
var walking = load("res://entities/walking_dummy.gd").new()
|
||||
walking.name = "WalkingDummy"
|
||||
walking.position = Vector3(15, 0, -10)
|
||||
walking.point_a = Vector3(15, 0, -10)
|
||||
walking.point_b = Vector3(15, 0, 10)
|
||||
walking.position = Vector3(20, 0, -15)
|
||||
walking.point_a = Vector3(20, 0, -15)
|
||||
walking.point_b = Vector3(20, 0, 15)
|
||||
add_child(walking)
|
||||
|
||||
|
||||
# ── Lighting ──────────────────────────────────────────────────────────────────
|
||||
|
||||
func _build_lighting() -> void:
|
||||
@@ -271,18 +612,27 @@ func _build_lighting() -> void:
|
||||
sun.light_energy = 1.2
|
||||
sun.shadow_enabled = true
|
||||
sun.directional_shadow_mode = DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS
|
||||
sun.directional_shadow_max_distance = 100.0
|
||||
sun.directional_shadow_max_distance = 120.0
|
||||
add_child(sun)
|
||||
|
||||
# Fill light (opposite side)
|
||||
var fill := DirectionalLight3D.new()
|
||||
fill.name = "FillLight"
|
||||
fill.rotation_degrees = Vector3(-30, -150, 0)
|
||||
fill.light_color = Color(0.6, 0.7, 0.9)
|
||||
fill.light_energy = 0.3
|
||||
fill.light_color = Color(0.55, 0.65, 0.85)
|
||||
fill.light_energy = 0.25
|
||||
fill.shadow_enabled = false
|
||||
add_child(fill)
|
||||
|
||||
# Central area accent light
|
||||
var center_light := OmniLight3D.new()
|
||||
center_light.name = "CenterLight"
|
||||
center_light.position = Vector3(0, 10, 0)
|
||||
center_light.light_color = Color(0.9, 0.85, 0.7)
|
||||
center_light.light_energy = 0.6
|
||||
center_light.omni_range = 25.0
|
||||
center_light.shadow_enabled = false
|
||||
add_child(center_light)
|
||||
|
||||
|
||||
# ── Player ────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -297,7 +647,7 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
# Server Synchronizer (Host is the ground truth)
|
||||
var server_sync = MultiplayerSynchronizer.new()
|
||||
server_sync.name = "ServerSynchronizer"
|
||||
server_sync.set_multiplayer_authority(1) # Host always controls these
|
||||
server_sync.set_multiplayer_authority(1)
|
||||
var server_rep_config = SceneReplicationConfig.new()
|
||||
server_rep_config.add_property(":position")
|
||||
server_rep_config.add_property(":synced_movement_state")
|
||||
@@ -313,7 +663,7 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
|
||||
# Client Synchronizer (Client dictates their aim and loadout setup)
|
||||
var client_sync = MultiplayerSynchronizer.new()
|
||||
client_sync.name = "MultiplayerSynchronizer" # Keep original name for compatibility if needed elsewhere
|
||||
client_sync.name = "MultiplayerSynchronizer"
|
||||
client_sync.set_multiplayer_authority(pid)
|
||||
var client_rep_config = SceneReplicationConfig.new()
|
||||
client_rep_config.add_property(":rotation")
|
||||
@@ -343,12 +693,12 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
if mover_script:
|
||||
player.set_script(mover_script)
|
||||
|
||||
# Humanoid Model for Player (Shadows only locally, visible to others)
|
||||
# Humanoid Model for Player
|
||||
var humanoid = load("res://characters/humanoid_model.gd").new()
|
||||
humanoid.name = "HumanoidModel"
|
||||
humanoid.color = Color(0.2, 0.4, 0.8) # Blueish for player
|
||||
humanoid.color = Color(0.2, 0.4, 0.8)
|
||||
humanoid.shadows_only = (pid == multiplayer.get_unique_id())
|
||||
humanoid.position = Vector3(0, -0.9, 0) # Offset from center to feet
|
||||
humanoid.position = Vector3(0, -0.9, 0)
|
||||
player.add_child(humanoid)
|
||||
|
||||
# Movement State Machine
|
||||
@@ -366,8 +716,10 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
"air": "res://movement/states/state_air.gd",
|
||||
"wall_run": "res://movement/states/state_wall_run.gd",
|
||||
"wall_cling": "res://movement/states/state_wall_cling.gd",
|
||||
"wall_climb": "res://movement/states/state_wall_climb.gd",
|
||||
"slide": "res://movement/states/state_slide.gd",
|
||||
"dash": "res://movement/states/state_dash.gd",
|
||||
"grapple": "res://movement/states/state_grapple.gd",
|
||||
}
|
||||
for state_name in state_scripts:
|
||||
var st := Node.new()
|
||||
@@ -377,10 +729,10 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
if st_script:
|
||||
st.set_script(st_script)
|
||||
|
||||
# FPS Camera Rig (HeadPivot → Camera3D)
|
||||
# FPS Camera Rig (HeadPivot -> Camera3D)
|
||||
var head_pivot := Node3D.new()
|
||||
head_pivot.name = "HeadPivot"
|
||||
head_pivot.position = Vector3(0, 0.7, 0) # Eye height
|
||||
head_pivot.position = Vector3(0, 0.7, 0)
|
||||
player.add_child(head_pivot)
|
||||
|
||||
var camera := Camera3D.new()
|
||||
@@ -389,7 +741,7 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
camera.fov = 90.0
|
||||
head_pivot.add_child(camera)
|
||||
|
||||
# ── Weapon Setup ────────────────────────────────────────────────────────────
|
||||
# Weapon Setup
|
||||
var wmanager_script = preload("res://weapons/weapon_manager.gd")
|
||||
if wmanager_script:
|
||||
var wman = wmanager_script.new()
|
||||
@@ -405,9 +757,7 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
# Store original capsule height
|
||||
sm.original_capsule_height = capsule.height
|
||||
|
||||
# ── Dependencies ────────────────────────────────────────────────────────
|
||||
# Set references before the node enters the tree. Godot will call _ready()
|
||||
# automatically when MultiplayerSpawner adds the node to the scene.
|
||||
# Dependencies
|
||||
sm.player = player
|
||||
sm.params = player.params
|
||||
head_pivot.params = player.params
|
||||
@@ -420,8 +770,6 @@ func _spawn_player(pid: int) -> CharacterBody3D:
|
||||
player.set_process(true)
|
||||
sm.set_physics_process(true)
|
||||
else:
|
||||
# Disable physics processing/input for remote players
|
||||
# but keep _process enabled so synced state updates the HumanoidModel
|
||||
player.set_physics_process(false)
|
||||
player.set_process(true)
|
||||
player.set_process_input(false)
|
||||
@@ -451,7 +799,7 @@ func _build_hud() -> void:
|
||||
canvas.name = "UI"
|
||||
add_child(canvas)
|
||||
|
||||
# ── Crosshair ─────────────────────────────────────────────────────────
|
||||
# Crosshair
|
||||
var crosshair := Control.new()
|
||||
crosshair.name = "Crosshair"
|
||||
crosshair.set_anchors_preset(Control.PRESET_CENTER)
|
||||
@@ -465,12 +813,11 @@ func _build_hud() -> void:
|
||||
ch_dot.position = Vector2(-2, -2)
|
||||
crosshair.add_child(ch_dot)
|
||||
|
||||
# Crosshair lines
|
||||
for data in [
|
||||
{"pos": Vector2(-10, -1), "size": Vector2(6, 2)}, # Left
|
||||
{"pos": Vector2(4, -1), "size": Vector2(6, 2)}, # Right
|
||||
{"pos": Vector2(-1, -10), "size": Vector2(2, 6)}, # Top
|
||||
{"pos": Vector2(-1, 4), "size": Vector2(2, 6)}, # Bottom
|
||||
{"pos": Vector2(-10, -1), "size": Vector2(6, 2)},
|
||||
{"pos": Vector2(4, -1), "size": Vector2(6, 2)},
|
||||
{"pos": Vector2(-1, -10), "size": Vector2(2, 6)},
|
||||
{"pos": Vector2(-1, 4), "size": Vector2(2, 6)},
|
||||
]:
|
||||
var line := ColorRect.new()
|
||||
line.color = Color(1, 1, 1, 0.6)
|
||||
@@ -478,7 +825,7 @@ func _build_hud() -> void:
|
||||
line.size = data["size"]
|
||||
crosshair.add_child(line)
|
||||
|
||||
# ── Info panel background ─────────────────────────────────────────────
|
||||
# FPS Label
|
||||
_fps_label = Label.new()
|
||||
_fps_label.name = "FPSLabel"
|
||||
_fps_label.text = "FPS: 0"
|
||||
@@ -501,6 +848,7 @@ func _build_hud() -> void:
|
||||
_standalone_speed_label.position = Vector2(12, 45)
|
||||
canvas.add_child(_standalone_speed_label)
|
||||
|
||||
# Debug panel
|
||||
_debug_ui_panel = PanelContainer.new()
|
||||
_debug_ui_panel.name = "InfoPanel"
|
||||
_debug_ui_panel.offset_left = 12
|
||||
@@ -545,8 +893,7 @@ func _build_hud() -> void:
|
||||
_chain_label.add_theme_color_override("font_color", Color(1.0, 0.8, 0.3))
|
||||
vbox.add_child(_chain_label)
|
||||
|
||||
|
||||
# ── Weapon & Ammo Panel ───────────────────────────────────────────────
|
||||
# Weapon & Ammo Panel
|
||||
var wp_panel := PanelContainer.new()
|
||||
wp_panel.name = "WeaponPanel"
|
||||
wp_panel.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
@@ -576,7 +923,7 @@ func _build_hud() -> void:
|
||||
_weapon_label.add_theme_font_size_override("font_size", 24)
|
||||
wp_panel.add_child(_weapon_label)
|
||||
|
||||
# ── Utilities Panel ───────────────────────────────────────────────────────
|
||||
# Utilities Panel
|
||||
var util_panel := PanelContainer.new()
|
||||
util_panel.name = "UtilPanel"
|
||||
util_panel.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
@@ -639,8 +986,6 @@ func _build_hud() -> void:
|
||||
dash_vbox.add_child(_dash_label)
|
||||
|
||||
|
||||
# ── Utility: Key Name ─────────────────────────────────────────────────────────
|
||||
|
||||
func _get_key_name(action: String) -> String:
|
||||
if not InputMap.has_action(action):
|
||||
return "?"
|
||||
@@ -655,7 +1000,6 @@ func _get_key_name(action: String) -> String:
|
||||
elif e.button_index == MOUSE_BUTTON_MIDDLE: return "MClick"
|
||||
return "?"
|
||||
|
||||
# ── HUD Update ────────────────────────────────────────────────────────────────
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not _player or not is_instance_valid(_player):
|
||||
@@ -697,7 +1041,6 @@ func _process(_delta: float) -> void:
|
||||
if sm:
|
||||
_chain_label.text = "Chain: %d (+%d%%)" % [sm.chain_count, int(sm.current_chain_bonus * 100)]
|
||||
|
||||
# Update utility indicators
|
||||
if sm.current_state == "grapple" or sm.is_grapple_shooting:
|
||||
_grapple_icon.modulate = Color(0.2, 1.0, 0.4)
|
||||
_grapple_label.text = "Grappling"
|
||||
|
||||
Reference in New Issue
Block a user