8.9 KiB
8.9 KiB
Candy Survival: Complete Implementation & Architecture Log
This document serves as an exhaustive, technical record of all modifications, refactors, and features implemented during the transition from the legacy "Gauntlet" mode to the new "Candy Survival" mode.
1. Project-Wide Renaming & Metadata Scrubbing
- Global Find & Replace: Executed across
scripts/,scenes/,tests/, andaddons/.- Replaced
GAUNTLET,GauntletManager,gauntlet_manager, andis_gauntlet_mode(). - Replaced UI and enum display strings
"Gauntlet Arena"→"Candy Survival Arena".
- Replaced
- File System Refactoring:
git mv scripts/managers/gauntlet_manager.gd scripts/managers/candy_survival_manager.gdgit mv scripts/controllers/candy_cannon_controller.gd scripts/controllers/candy_survival_npc_controller.gdgit mv scenes/candy_cannon.tscn scenes/candy_survival_npc.tscngit mv scenes/gauntlet_hud.tscn scenes/candy_survival_hud.tscngit mv scenes/arena/gauntlet.tscn scenes/arena/candy_survival.tscn
- Asset Scrubbing (
assets/models/arena/candy_survival/):- Renamed the directory and all interior files (e.g.,
Gauntlet terrain.gltf→candy_survival_terrain.gltf). - Purged buried metadata: Modified
.importand.gltftext structures to remove cached"res://assets/models/arena/gauntlet/..."paths to prevent headless Godot build corruption. - Updated legacy entries in
version.jsonfor historical consistency.
- Renamed the directory and all interior files (e.g.,
2. Arena Layout & Sticky Collision Overhaul
- Grid Properties: Enforced strict
18x18playable bounds via_setup_arena(). - Sticky Mechanics Rewritten:
- Legacy: Sticky cells grew dynamically, gave telegraph warnings, and trapped players requiring a "cleanser".
- New:
TILE_STICKYnow acts exclusively as static, pure-collision boundary walls. Placed solely on the arena perimeter and the center 3x3 NPC zone to block entry. - Movement check in
player_movement_manager.gdstrictly evaluatesif gm.is_sticky_cell(grid_position)and rejects the move outright unless the player possesses theis_invisible(Ghost) buff.
- Spawn Point Correction: Shifted
get_spawn_points()coordinates fromrow 1torow 2androw 15torow 16((2,2), (16,2), (2,16), (16,16)) to prevent players from spawning inside stairs/geometry.
3. Mekton NPC (Center Boss Entity)
- Mesh Replacement: Scrapped the primitive Cylinder/Sphere tank meshes in
candy_survival_npc.tscn. Instancedstatic_tekton_mesh.tscnas the visual representation. - Face Color Cycling:
- Engineered
set_face_color_rpc(color_index: int)insidecandy_survival_npc_controller.gd. - Dynamically extracts the surface material from the
ted_bodyskeleton node. - Duplicates the material at runtime and applies emission glow and albedo tints corresponding to the
CandyColorenum (0: Heart/Red, 1: Diamond/Blue, 2: Star/Yellow, 3: Coin/Orange).
- Engineered
- Manager Authority:
candy_survival_manager.gdtracksface_timer. Every 5.0 seconds (COLOR_CYCLE_TIME), it incrementscurrent_face = CandyColor.values()[(current_face + 1) % CandyColor.size()]and fires the RPC to visually sync the Mekton across all clients.
4. Gameplay Loop: Blueprints & Stacks
- Auto-Pickup Integration:
- Hooked into
player_movement_manager.gd->_on_movement_finished(). - If
LobbyManager.game_mode == "Candy Survival", automatically callsplayer.grab_item(player.current_position)when stepping on a tile, assuming theplayerboard_managerhas an empty slot. Completely removes the need for manual button presses during high-speed building.
- Hooked into
- 3x3 Blueprint Detection Engine:
- Overhauled
_check_goal_completion()inplayerboard_manager.gd. - Scans the 5x5 player board for any contiguous, fully-populated 3x3 block.
- Calculates the majority color (
primary_color) within that block.
- Overhauled
- Off-Color Validation:
- If the 3x3 block is mixed (off-color), it queries the global
gridmapviaCandySurvivalManager._grid_has_color_tiles(primary_tile_id). - If the primary color is mathematically extinct on the physical arena floor, the blueprint is accepted for 50% points. Otherwise, it is rejected.
- If the 3x3 block is mixed (off-color), it queries the global
- Stacking Mechanics & Multipliers:
on_blueprint_completedinvokes_give_candy(pid, color).- Tracks
player_candies(height) andplayer_candy_color. - Multiplier scales dynamically:
1.0 + (Stack Count * MULTI_STEP [0.1]). Generates continuous passive points per second evaluated in_process.
5. Gameplay Loop: Delivery & Sugar Rush
- Proximity Delivery Trigger:
- Built into
player_movement_manager.gd. During movement, it evaluates Manhattan distance to the center NPC (abs(x - 8) + abs(y - 8)). - If distance is
<= 2, the client firesgm.try_deliver(pid)via RPC to the server.
- Built into
- Face Matching Logic:
- Server evaluates
if player_candy_color == current_face. - Rejects if the player has 0 candies or colors mismatch.
- Server evaluates
- Sugar Rush Global Event:
- Successful delivery adds to
player_sugar_rush[pid]with the formula:SR_BASE_TIME [2.0s] + (candies * SR_PER_CANDY [0.4s]). - While any player's rush timer is
> 0, the manager forcesEngine.time_scale = SR_SPEED [2.0]. When all timers reach 0, it restores to1.0.
- Successful delivery adds to
6. Sabotage: Knock & Ghost Dynamics
- Knock (Steal/Backfire):
- Input bound natively to
action_knock_tektoninsideplayer_input_manager.gd. - Fires
try_knock(attacker, target)when adjacent to an opponent. - Consumes 1 of 5 starting charges (
player_knocks). - Steal: If target has candies, attacker adopts target's full stack and color; target is zeroed.
- Backfire: If target has 0 candies, attacker loses a charge and both suffer the knock animation state (handled by caller).
- Input bound natively to
- Ghost (Phase-Through):
- Input bound natively to
action_grab_tektoninsideplayer_input_manager.gd(bypasses default grab behavior in this mode). - Consumes 1 of 5 starting charges (
player_ghosts). try_activate_ghostsets the coreplayer.is_invisible = trueandsync_modulate(Color(1, 1, 1, 0.4))for 4.0 seconds.- The
is_invisiblestate natively bypasses the sticky collision checks, allowing phase-through of boundaries/boss zones, and renders the player immune to incoming Knocks.
- Input bound natively to
7. Visuals, UI & 3D Stacking
- HUD De-Scripting:
- Legacy
gauntlet_managerinstantiated UI elements via GDScript. This was purged. - Created
candy_survival_hud.tscnusing pure Godot Control nodes (VBoxContainer, HBoxContainer, ProgressBar, Label). Exposes all UI to artists for layout/theme modifications without code risk. - Manager simply grabs node references (
hud_rush_bar,hud_stack_badge, etc.) on_ready().
- Legacy
- Dynamic Delivery Indicator:
sync_candy_badgeRPC was expanded to include aface_matchboolean.- When the Mekton's face color changes (every 5s), the server force-updates all clients.
- The HUD dynamically shifts
DeliveryIndicator.textto a Green"READY TO DELIVER!"or Red"Waiting for match..."based on their currently held candy stack.
- Physical 3D Candy Stacking:
- Implemented
sync_candy_stack(count, color_id)directly onplayer.gd. - Creates a generic
Node3Don the player'sVisualsnode. - Instantiates raw
MeshInstance3Dtiles (tile_heart.tres,tile_diamond.tres, etc.). - Visually stacks them vertically (
y = i * 0.4) and scales them down (0.5x) corresponding exactly to the player's internal candy count. Clears them instantly upon delivery or being knocked.
- Implemented
8. AI & Bot Behaviors
- Delivery Pathfinding (Priority 0.7):
- Injected specialized logic into
bot_controller.gd. - Bots actively check their held
player_candy_coloragainst the manager'scurrent_face. - When colors match, the Bot halts blueprint construction and immediately uses
find_pathtargetingVector2i(8,8)to execute a delivery and trigger Sugar Rush.
- Injected specialized logic into
- Ghost Survival Logic:
- Re-wrote
_bot_has_ghost_powerup()inbot_strategic_planner.gdto evaluate the new nativeplayer_ghostscharge counter instead of the legacySpecialTilesManagerinventory. - Bots correctly evaluate proximity to sticky walls and automatically fire
try_activate_ghostwhen cornered to phase out of traps.
- Re-wrote
9. Code Health & QA
- Orphan Code Purge: Deleted 8 specific
test_gauntlet_*.gdfiles that referenced non-existent legacy mechanics (growth algorithms, bubbles, floor highlights, old cleansers). - Compile Integrity: Fixed a trailing
_on_doors_update()call inlobby_room.gdleftover from a different branch. Verified flawless compilation viagodot --headless --build-solutions. - Gitea Documentation: Automated the closure and deep-technical documentation of Issues #54, 55, 56, 57, 65, 66, 67, 68, 69, and 70 directly to the tracking server.
- Wiki Accuracy: Overhauled
Game-Modes.-.mdto perfectly mirror the new Sabotage input maps, Blueprint rules, RPC structures, and Mekton behavior.