# art-of-the-art/code-salvage-game architecture

> Architecture diagram of the GitHub repository art-of-the-art/code-salvage-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/art-of-the-art/code-salvage-game
- Repository: https://github.com/art-of-the-art/code-salvage-game

## Overview

#### Purpose and Scope
Unity gameplay prototype for a third-person human player confronting large robots. The implemented code concentrates on locomotion, climbing/attachment, camera control, animation integration, and debugging—not yet the README’s damage, dismantling, or enemy-combat systems.

#### Runtime Entry Points
Unity invokes MonoBehaviour lifecycle methods on scene-attached components. The player is assembled from cooperating scripts, while the robot has a separate movement controller:
- `PlayerMovement.cs`
- `PlayerClimbMotor.cs`
- `RobotMovement.cs`

#### Player Input and Locomotion
`PlayerInputReader.cs` is the input boundary, translating Unity player controls into movement/action state consumed by player systems. `PlayerMovement.cs` is the primary grounded locomotion controller and likely owns ordinary movement-state decisions. This separates device/input concerns from physical motion:
- `PlayerInputReader.cs`
- `PlayerMovement.cs`
- `PlayerGroundProbe.cs`

#### Environmental Sensing and Movement Modes
Player movement is driven by probes rather than assuming a flat ground plane. `PlayerGroundProbe.cs` determines grounded/surface information; `PlayerFrontDetector.cs` detects climbable or blocking geometry ahead. `PlayerClimbMotor.cs` uses those contacts to control the attached/climbing mode, forming the key boundary for climbing robots or level geometry:
- `PlayerGroundProbe.cs`
- `PlayerFrontDetector.cs`
- `PlayerClimbMotor.cs`

#### Animation and Presentation
`PlayerAnimationBridge.cs` maps gameplay/movement state into the Unity animation layer, avoiding direct animation ownership inside locomotion controllers. `ThirdPersonCamera.cs` supplies player-following third-person camera behavior, independent from movement and climbing logic:
- `PlayerAnimationBridge.cs`
- `ThirdPersonCamera.cs`
- `PlayerMovement.cs`

#### Robot Actor
`RobotMovement.cs` is the present robot-side runtime behavior. It is architecturally separate from player climbing, meaning interaction with a moving robot must occur through scene physics/transforms and detector/probe contacts rather than a dedicated player–robot orchestration layer:
- `RobotMovement.cs`
- `PlayerClimbMotor.cs`
- `PlayerFrontDetector.cs`

#### Observability and Current Boundaries
`PlayerDebugHud.cs` exposes runtime player state for tuning movement, detection, and climbing behavior. The repository contains no visible systems for combat, destructible robot parts, weapons, persistence, networking, backend services, or non-Unity infrastructure. Unity physics, animation, input, and scene/component composition are the material platform dependencies:
- `PlayerDebugHud.cs`
- `PlayerMovement.cs`
- `PlayerClimbMotor.cs`

Main entry points: [`PlayerClimbMotor.cs`](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerClimbMotor.cs) (Climb Motor), [`PlayerMovement.cs`](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerMovement.cs) (Player Movement), [`PlayerInputReader.cs`](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerInputReader.cs) (Player Input Reader), [`PlayerFrontDetector.cs`](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerFrontDetector.cs) (Front Detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_player["Player Runtime"]
  node_input["Player Input Reader<br/>input adapter"]
  node_movement["Player Movement<br/>locomotion controller<br/>[PlayerMovement.cs]"]
  node_ground_probe["Ground Probe<br/>surface sensor"]
  node_front_detector["Front Detector<br/>contact sensor"]
  node_climb_motor["Climb Motor<br/>climbing controller"]
  node_animation["Animation Bridge<br/>animation adapter"]
  node_camera["Third-Person Camera<br/>camera controller"]
  node_debug_hud["Player Debug HUD<br/>debug UI<br/>[PlayerDebugHud.cs]"]
end

subgraph group_robot["Robot Runtime"]
  node_robot_movement["Robot Movement<br/>robot controller<br/>[RobotMovement.cs]"]
end

subgraph group_unity["Unity Platform"]
  node_scene{{"Scene Components<br/>composition boundary"}}
  node_physics{{"Unity Physics<br/>engine service"}}
  node_unity_input{{"Unity Input<br/>engine service"}}
  node_unity_animation{{"Unity Animation<br/>engine service"}}
end

node_scene -->|"attaches"| node_input
node_scene -->|"attaches"| node_movement
node_scene -->|"attaches"| node_climb_motor
node_scene -->|"attaches"| node_robot_movement
node_unity_input -->|"controls"| node_input
node_input -->|"movement state"| node_movement
node_input -->|"action state"| node_climb_motor
node_physics -->|"surface contacts"| node_ground_probe
node_physics -->|"forward contacts"| node_front_detector
node_ground_probe -->|"grounded state"| node_movement
node_front_detector -->|"climb contacts"| node_climb_motor
node_ground_probe -->|"surface state"| node_climb_motor
node_movement -.->|"mode handoff"| node_climb_motor
node_movement -->|"movement state"| node_animation
node_climb_motor -->|"climb state"| node_animation
node_animation -->|"animation parameters"| node_unity_animation
node_scene -->|"player transform"| node_camera
node_movement -->|"locomotion state"| node_debug_hud
node_climb_motor -->|"climb state"| node_debug_hud
node_front_detector -->|"detection state"| node_debug_hud
node_robot_movement -->|"moves collider"| node_physics
node_physics -.->|"robot or level geometry"| node_front_detector

click node_input "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerInputReader.cs"
click node_movement "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerMovement.cs"
click node_ground_probe "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerGroundProbe.cs"
click node_front_detector "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerFrontDetector.cs"
click node_climb_motor "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerClimbMotor.cs"
click node_animation "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerAnimationBridge.cs"
click node_camera "https://github.com/art-of-the-art/code-salvage-game/blob/main/ThirdPersonCamera.cs"
click node_debug_hud "https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerDebugHud.cs"
click node_robot_movement "https://github.com/art-of-the-art/code-salvage-game/blob/main/RobotMovement.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_input,node_movement,node_ground_probe,node_front_detector,node_climb_motor,node_animation,node_camera,node_debug_hud toneBlue
class node_robot_movement toneAmber
class node_scene,node_physics,node_unity_input,node_unity_animation toneMint
```

## Components

### Player Runtime

Cooperating scene-attached player components.

- [Player Input Reader](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerInputReader.cs): input adapter · Translates Unity controls into player movement and action state. · `PlayerInputReader.cs`
- [Player Movement](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerMovement.cs): locomotion controller · Owns ordinary grounded movement-state decisions. · `PlayerMovement.cs`
- [Ground Probe](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerGroundProbe.cs): surface sensor · Determines grounded and surface information. · `PlayerGroundProbe.cs`
- [Front Detector](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerFrontDetector.cs): contact sensor · Detects climbable or blocking geometry ahead. · `PlayerFrontDetector.cs`
- [Climb Motor](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerClimbMotor.cs): climbing controller · Controls attached and climbing movement from contact data. · `PlayerClimbMotor.cs`
- [Animation Bridge](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerAnimationBridge.cs): animation adapter · Maps gameplay movement state into Unity animation. · `PlayerAnimationBridge.cs`
- [Third-Person Camera](https://github.com/art-of-the-art/code-salvage-game/blob/main/ThirdPersonCamera.cs): camera controller · Provides player-following camera behavior independently of movement. · `ThirdPersonCamera.cs`
- [Player Debug HUD](https://github.com/art-of-the-art/code-salvage-game/blob/main/PlayerDebugHud.cs): debug UI · Exposes runtime movement, detection, and climbing state. · `PlayerDebugHud.cs`

### Robot Runtime

- [Robot Movement](https://github.com/art-of-the-art/code-salvage-game/blob/main/RobotMovement.cs): robot controller · Current robot-side runtime behavior. · `RobotMovement.cs`

### Unity Platform

Engine services and scene composition.

- **Scene Components**: composition boundary · Attaches MonoBehaviours and provides actor transforms.
- **Unity Physics**: engine service · Provides collision, probe, and contact data.
- **Unity Input**: engine service
- **Unity Animation**: engine service

## Connections

- Scene Components → Player Input Reader: attaches
- Scene Components → Player Movement: attaches
- Scene Components → Climb Motor: attaches
- Scene Components → Robot Movement: attaches
- Unity Input → Player Input Reader: controls
- Player Input Reader → Player Movement: movement state
- Player Input Reader → Climb Motor: action state
- Unity Physics → Ground Probe: surface contacts
- Unity Physics → Front Detector: forward contacts
- Ground Probe → Player Movement: grounded state
- Front Detector → Climb Motor: climb contacts
- Ground Probe → Climb Motor: surface state
- Player Movement → Climb Motor: mode handoff
- Player Movement → Animation Bridge: movement state
- Climb Motor → Animation Bridge: climb state
- Animation Bridge → Unity Animation: animation parameters
- Scene Components → Third-Person Camera: player transform
- Player Movement → Player Debug HUD: locomotion state
- Climb Motor → Player Debug HUD: climb state
- Front Detector → Player Debug HUD: detection state
- Robot Movement → Unity Physics: moves collider
- Unity Physics → Front Detector: robot or level geometry
