home / skills / bbeierle12 / skill-mcp-claude / structural-physics

structural-physics skill

/skills/structural-physics

This skill validates structural stability and handles damage propagation for building systems in Three.js games, supporting arcade, heuristic, and realistic

npx playbooks add skill bbeierle12/skill-mcp-claude --skill structural-physics

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
1.8 KB
---
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

```javascript
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 structures
- `scripts/damage-propagation.js` - Damage states, fire spread, cascading collapse
- `scripts/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

Overview

This skill provides structural validation and damage systems tailored for Three.js building games. It supports arcade, heuristic, and realistic physics modes to balance performance and realism for combat, survival, and engineering scenarios. Use it to determine placement validity, compute stability percentages, and simulate damage propagation and cascading collapse.

How this skill works

The system inspects piece connectivity, support relationships, and material properties to produce placement validation and a stability score. In arcade mode it uses connectivity rules for instant collapse behavior; in heuristic mode it computes stability percentages and predictable failure rules; in realistic mode it runs stress/strain simulations for detailed structural response. A damage subsystem maps hits, explosions, and fire into damage states and triggers cascade or collapse based on thresholds.

When to use it

  • Implementing building stability for survival games (Rust/Valheim style).
  • Fast, combat-oriented collapse behavior (Fortnite-style arcade mode).
  • Engineering or sandbox simulations that need realistic stress calculations.
  • Adding damage propagation, fire spread, or explosive radius effects to structures.
  • Optimizing large structures with caching and batch stability updates.

Best practices

  • Choose physics mode by gameplay need: arcade for responsiveness, heuristic for predictability, realistic for accuracy.
  • Use the stability optimizer or caching layer for large or frequently updated structures.
  • Tune material decay rates and damage thresholds to match desired fragility and repair mechanics.
  • Run heuristic validation on placement to provide player feedback before committing new pieces.
  • Limit realistic-mode calculations to crucial components or run them asynchronously to avoid frame spikes.

Example use cases

  • A survival base builder that requires support checks and a stability percent to determine when parts fall.
  • A battle royale game where destructive builds collapse instantly when critical connections break.
  • A simulation tool that evaluates bridge or tower designs with stress/strain analysis on demand.
  • A game feature where explosions propagate damage through connected pieces and cause cascading failures.
  • Server-side batch validation to quickly verify many simultaneous placements during large raids or edits.

FAQ

Which mode should I pick for a multiplayer survival game?

Use heuristic mode for predictable, player-friendly stability while keeping CPU costs moderate.

Can I combine modes for different parts of a structure?

Yes — run realistic simulations for critical components and fall back to heuristic or arcade rules for the rest to balance fidelity and performance.