structural-physics
Structural validation and damage systems for Three.js building games. Use when implementing building stability (Fortnite/Rust/Valheim style), damage propagation, cascading collapse, or realistic physics simulation. Supports arcade, heuristic, and realistic physics modes.
When & Why to Use This Skill
This Claude skill provides a specialized framework for implementing structural validation and damage systems within Three.js building games. It solves the complexity of calculating building stability, damage propagation, and cascading collapses by offering multiple physics modes—Arcade, Heuristic, and Realistic—tailored for different gameplay styles like survival or combat.
Use Cases
- Survival Game Mechanics: Implementing stability-based building systems where structures require foundational support to remain standing, similar to mechanics in Rust or Valheim.
- Destructible Environments: Creating dynamic destruction effects in combat games where removing a support beam triggers a realistic cascading collapse of connected pieces.
- Physics-Based Simulations: Developing educational or engineering tools that require realistic stress and strain analysis on 3D architectural models within a web browser.
| name | structural-physics |
|---|---|
| description | Structural validation and damage systems for Three.js building games. Use when implementing building stability (Fortnite/Rust/Valheim style), damage propagation, cascading collapse, or realistic physics simulation. Supports arcade, heuristic, and realistic physics modes. |
Structural Physics
Stability validation and damage systems for building mechanics.
Quick Start
import { HeuristicValidator } from './scripts/heuristic-validator.js';
import { DamageSystem } from './scripts/damage-propagation.js';
// Rust/Valheim style stability
const validator = new HeuristicValidator({ mode: 'heuristic' });
validator.addPiece(piece);
const result = validator.validatePlacement(newPiece);
// result: { valid: true, stability: 0.85, supports: [...] }
// Damage and collapse
const damage = new DamageSystem(validator);
damage.applyDamage(piece, 50, 'physical');
damage.applyExplosiveDamage(position, 100, 10); // radius damage
Reference
See references/structural-physics-advanced.md for:
- Physics mode comparison (arcade vs heuristic vs realistic)
- Material properties and decay rates
- Damage state thresholds
- Cascade mechanics
Scripts
scripts/heuristic-validator.js- Fast validation (Fortnite/Rust/Valheim modes)scripts/stability-optimizer.js- Caching and batch updates for large structuresscripts/damage-propagation.js- Damage states, fire spread, cascading collapsescripts/physics-engine-lite.js- Optional realistic stress/strain simulation
Physics Modes
- Arcade (Fortnite): Connectivity only, instant collapse, best for combat
- Heuristic (Rust/Valheim): Stability %, predictable rules, best for survival
- Realistic: Full stress/strain, computationally expensive, best for engineering sims