You are an elite real-time 3D game engineer and soft-body physics specialist. Your task…
- User
You are an elite real-time 3D game engineer and soft-body physics specialist. Your task is to build a complete, playable, browser-based BeamNG.drive-inspired soft-body physics driving game from scratch.
Core Vision
Ultra-realistic soft-body vehicle physics with real-time body meshing, permanent deformation, and visceral damage. Players can drag-and-drop any car model and immediately drive it with realistic handling and crash behavior. Physics parameters are automatically tuned by an LLM based on the car’s make/model extracted from the filename.
Technical Requirements (strict)
Preferred stack (use this unless you have a strong reason not to):
- Vite + React + TypeScript
- Three.js + @react-three/fiber + @react-three/drei
- Ammo.js (WASM preferred) for physics — use soft-body volume / cloth + rigid chassis hybrid, or a simplified but high-quality node-beam approximation if soft-body volume is too heavy
- GLB as the primary model format (best web support, single-file, PBR materials, animations). Also accept .gltf. Reject or convert USDZ if necessary.
- OpenRouter API (user will supply their key) for AI parameter generation
Model Upload & Auto-Detection
- Drag-and-drop or file picker that accepts .glb / .gltf
- On load:
- Parse filename (e.g. “ferrari_f40_1987.glb”, “porsche_911_gt3_rs.glb”, “toyota_supra_mk4.glb”) to extract make + model + optional year
- Load the visual mesh with full PBR materials, correct scale, and center of mass estimation
- Automatically generate a soft-body / node-beam structure from the mesh (sample nodes from vertices or use voxelization / surface sampling + connectivity based on proximity and original topology). Attach the visual mesh so it deforms with the nodes (skinning or per-vertex displacement).
- Create a driveable vehicle: rigid or semi-rigid chassis + 4 wheels with suspension, realistic tire friction, engine, transmission, steering, brakes, differential.
Soft-Body / Damage Physics (BeamNG-inspired)
- Nodes = mass points
- Beams = springs with stiffness, damping, deform threshold, break threshold
- Permanent plastic deformation and beam breaking
- Visual mesh follows the deformed nodes in real time (body meshing)
- Different material strengths (body panels vs frame vs glass vs plastic) if possible
- Realistic crumpling, folding, and parts that can tear off
- High enough simulation rate for stability (aim for 200–1000 Hz substeps if performance allows)
- Ground collision, self-collision, and dynamic object interaction
Assistant
I'll build this ambitious soft-body physics driving game step by step. Let me start by exploring the project structure and then scaffold everything needed.
Let me install all the necessary dependencies for this 3D physics game:
Now let me create the comprehensive game structure. I'll start with the TypeScript types and core utilities:
Now let me create the OpenRouter API client for AI parameter tuning:
Now let me create the core physics engine with Ammo.js integration:
Let me fix the TypeScript errors:
Now let me create the vehicle controller for driving mechanics:
Now let me create the main React components. First, the SoftBodyVehicle component:
Now let me create the test environment:
Now let me create the UI components:
Now let me create the main Game component that ties everything together:
Let me create the ParticleSystem component and fix the errors:
Files built:
src/types.ts,src/store/gameStore.ts,src/utils/openrouter/OpenRouterClient.ts,src/utils/physics/PhysicsEngine.ts,src/types/ammo.d.ts,src/utils/physics/VehicleController.ts, , , , , ,
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.