Skip to content
Robotics.world

Research

Code2Worlds-2: Physically Plausible Agent Harness for Embodied World Simulation

Coding LLMs can already write program code that produces visually dynamic 4D scenes, but those scenes are only pictures that move: they contain no collision geometry, mass, friction, inertia, or…

The paper’s first page · arXiv:2610.17651
arXiv
2610.17651 · Preprint · not peer-reviewed
Published
2026-10-13
Authors
Haoyu Zhang, Siming Li, Zeyu Zhang, Yi Zhang, Tat-Seng Chua, Hao Tang

In plain words

Coding LLMs can already write program code that produces visually dynamic 4D scenes, but those scenes are only pictures that move: they contain no collision geometry, mass, friction, inertia, or joints, so a physics engine treats them as raw visual hulls and a robot cannot bump into, push, or grasp anything in them.

AI summary

Overview

Research area: Robotics and embodied AI — specifically 4D world generation with coding large language models, made executable inside a physics simulator (MuJoCo).

Technical level: Advanced. The paper assumes familiarity with physics engines, collision geometry, MJCF/constrained dynamics, and LLM-based code generation.

Scope: Code2Worlds-2 extends the ICML 2026 Code2Worlds system with a scene compiler that makes generated 4D worlds simulator-ready and a simulator-in-the-loop agent harness that refines physical settings, plus a new state-based benchmark (SimCode4D) with a frozen 15-case development suite.

What This Paper Is About

Coding LLMs can already write program code that produces visually dynamic 4D scenes, but those scenes are only pictures that move: they contain no collision geometry, mass, friction, inertia, or joints, so a physics engine treats them as raw visual hulls and a robot cannot bump into, push, or grasp anything in them. The authors keep the original Code2Worlds generation pipeline intact and bolt on two modules that turn such a visual world into an executable one — one module compiles the scene into a simulator-ready representation exported as MuJoCo MJCF, the other closes an automated compile–simulate–critique–refine loop that revises the world's physical settings, not just its code. The goal is a generated world that a physics engine can load and step, and that legged and manipulator robots can actually interact with.

Key Contributions

  1. SimReady Scene Compiler (Module 1). Converts a coding-LLM-generated visual scene into a simulator-compatible representation: convex-decomposed collision meshes, VLM-estimated physical attributes, a lightweight support graph, engine-level contact/friction/dynamics constraints, and a gravity settling pass, exported as MuJoCo MJCF. It emits paired default and enriched exports, and the gap between them is the paper's primary measure of physical plausibility.

  2. Simulator-in-the-Loop 4D Refiner (Module 2), an agent harness. Translates visual dynamics into executable rigid-body and articulated dynamics, and replaces the purely visual VLM-Motion Critic with a two-part critic (physics signals plus a VLM visual check) — the harness then revises the physical settings themselves.

  3. SimCode4D benchmark. A state-based benchmark with five task templates (pick-and-place, push-to-region, place-into-container, obstacle-avoidance navigation, dynamic interaction) using typed initial/event/always/terminal predicates, instantiated as a frozen 15-case suite (Dev15) spanning indoor, industrial, natural outdoor, service, and urban domains.

  4. Embodied World Graph. An engine-agnostic intermediate representation (object nodes with visual mesh, collision mesh, mass, friction, inertia, center of mass, support/contact relation, affordance, joint type; dynamic events with force, velocity, contact events, triggers, constraints) that is serialized once to a target engine — MuJoCo here, in principle Isaac Sim/USD or others.

Main Findings

  • Benchmark readiness is complete. On the frozen SimCode4D-Dev15-RC1 suite, all 15 cases have complete contract quartets, all 15 M1 worlds load, and all 225 executions (15 cases × 3 deterministic rebuild replicates × 5 physics seeds, i.e. 75 unique case–physics trials) complete with zero runtime errors. All 225 pass RobustTaskSuccess, 0/225 forbidden-contact episodes, 0/225 joint-limit episodes, 210/210 event-order accuracy, and 0/225 friction-cone failures.

  • Physical gates are met with margin. Maximum penetration is 0.922 mm (0.921837 mm) against a 1 mm gate, and maximum forward/inverse generalized-force residual is 2.03 × 10⁻⁹ (2.03424 × 10⁻⁹) against a 10⁻⁵ gate. Fourteen of 15 cases produce friction-bearing contact, drawing on 10,160,604 contact samples; the weld case is intentionally non-contact.

  • Enrichment and repair raise physical acceptance. In the fixed-source experiment (12 cases with authoring sources, 3 generation seeds producing 36 packages, 5 held-out physics seeds = 180 rollouts per condition), physical acceptance rises from 75/180 (default export) to 93/180 (SimReady compilation) to 108/180 (after feedback repair, 1.61 mean repairs per package). RTS rises 45/180 → 50/180 → 60/180. Task success dips slightly at the enrichment stage, from 63/180 to 62/180.

  • The overall RTS gain is not statistically resolved. The raw-to-repaired RTS gain is 8.3 percentage points, with a source-case-clustered 95% bootstrap interval of [−11.1, 28.9] percentage points.

  • Matched-prompt comparison strongly favors the method. On three prespecified indoor prompts (living-room pushing, dining-room transport, kitchen pushing), Code2Worlds through a uniform MuJoCo adapter gets 3/3 build, 5/15 task, 0/15 physical, 0/15 RTS. Applying M1/M2 to the same Code2Worlds visual outputs gives 15/15 task, 15/15 physical, and 15/15 RTS, with all three packages passing before any repair. SceneSmith's official exports get 3/3 build, 0/15 task, 13/15 physical, 0/15 RTS. The authors stress these are descriptive outcomes for one generated world per prompt, not a population-level ranking.

  • Task-family gains are uneven. Across the 12 fixed-source cases, navigation RTS decreases from 45/60 (default) to 35/60 (enriched and repaired), while pick/transport rises from 0/30 to 14/30 and dynamic interaction from 0/90 to 11/90 (repaired). Task predicates after repair pass 35/60 navigation, 15/30 pick-and-transport, and 19/90 dynamic-interaction.

  • Coding diagnostics. For the 36 first generated fixed-source plans, TaskOverlayPass@1 is 36/36, required-entity binding micro-F1 is 97.3% (108 TP, 3 FP, 3 FN), and initial task-object support-relation micro-F1 is 66.7% (15 TP, 15 FP, 0 FN), evaluated only on five annotated cases.

  • Module 1 ablations show each component matters. Replacing object-specific mass, inertia, and friction with uniform defaults drops RTS from 69/75 to 54/75 and physical pass from 69/75 to 55/75. Collapsing to a single convex hull drops RTS from 15/15 to 10/15 and physical pass from 15/15 to 11/15. Removing pose stabilization drops stable initial states from 8/12 to 1/12 and penetration-safe states from 11/12 to 0/12.

  • State-based feedback beats visual-only feedback. From 36 matched enriched starting worlds: no repair gives 33/36 build, 62/180 task, 93/180 physical, 50/180 RTS; visual-only gives 36/36, 84/180, 112/180, 67/180; state-only gives 36/36, 96/180, 116/180, 81/180; the fused fixed-budget rule gives 35/36, 81/180, 99/180, 62/180. The state-only rule is the strongest in this table.

Methodology in Plain English

The starting point is the existing Code2Worlds pipeline, which generates objects via retrieval-augmented code and orchestrates them into a hierarchical scene, then uses a Post-Process Agent to script motion.

Step one — make the geometry collision-safe. Generated meshes are concave and not watertight, and physics engines typically wrap each mesh in a single coarse convex hull, which fills in gaps and creates phantom support (a sphere can't sit in a chair, a box can't slide under a table). The authors run CoACD convex decomposition on key interaction objects, with a concavity threshold of 0.05 and a cap of 24 pieces per object to bound solver cost. Outdoor terrain, which would otherwise be hulled into one solid across the whole scene, is sliced into an N×N grid, and each cell becomes a closed convex prism built from a ray-cast height field (top surface, four side walls, flat base).

Step two — give objects physical properties. For each key object they render four views (isometric, front, side, top) and send them, along with the object's longest dimension and source name, to a vision–language model that predicts material category, bulk density ρ, friction μ, and restitution e. Mass comes from mesh volume (m = ρV) and the inertia tensor and center of mass from mesh moments.

Step three — figure out what rests on what. A lightweight support graph is inferred from world-space bounding boxes, with relations supported_by, on_surface, attached_to, inside, hinged_to, plus settling triggers floating and embedded. Overlap and vertical gap thresholds decide the label, with a global-ground fallback for scenes that export only decorative floor tiles.

Step four — let gravity settle things. Each object is loaded 5 cm above its support and simulated until linear and angular speeds drop below small thresholds with at least one contact. Floating objects drop, embedded objects get pushed out, and persistent failures are re-placed. The resulting contact data later helps verify the support graph.

Step five — encode real constraints. Colliders get contype/conaffinity bitmasks so only intended pairs generate contacts, condim = 3 for normal plus tangential friction (or 4 when torsional friction is needed), friction coefficients on each contact geom, and free joints for unattached bodies versus hinge/slide joints with axis, range, stiffness, and damping for articulated objects.

Step six — close the loop through the simulator. Module 2 splits motion into simulator state (rigid and articulated motion executed by MuJoCo) and visual effects (rain, fog, fire, relighting, staying in Blender), with the Post-Process Agent emitting a dynamics_program.json containing rigid-body, joint, and visual-effect blocks. A robot (Unitree Go2, UR5e, Clearpath Jackal, or a service robot's differential-drive base) is placed according to the action — a kick anchors foot reach, a walk provides a runway, a watch observes from a fixed offset — and PD tracking drives kick, walk, watch, or weld. A physics critic then measures seven signals (penetration depth, collision pairs, post-strike stability, contact-force peak, support relation at rest, joint-limit/uprightness, interaction success) and a VLM visual critic judges sampled frames; a scene is accepted only if every physics signal passes and the VLM agrees, and the fused feedback revises the physical settings.

Evaluation. SimCode4D scores executable world packages, not videos, with strict build gates (parsing, schema, asset closure, entity coverage, simulator loading, finite smoke execution, intervention integrity) and a seven-factor acceptance criterion combining build, overlay validity, mechanics/contact admissibility, kinematic consistency, task predicates, safety, and integrity. Probes are evaluator-owned — they cannot import the simulator or modify state, forces, mass, inertia, friction, or collision masks — so a submitted method cannot bake the evaluation policy into its world program.

Why This Matters

Impact on research. The paper reframes 4D world generation from a rendering problem into a simulation-readiness problem, and proposes a concrete measurement (default vs. enriched export gap) plus a public state-based benchmark. It also demonstrates that simulator feedback is a stronger learning signal than visual critique for physics — the ablation showing state-only feedback reaching 81/180 RTS versus 67/180 for visual-only is the clearest evidence of this.

Real-world applications:

  • Training and evaluating legged locomotion policies over generated rough terrain, where collision geometry must follow the local surface rather than a single global hull.
  • Manipulation policy testing in procedurally generated kitchens, workshops, and warehouses, where drawers, doors, and containers must respect hinge/slide limits.
  • Rapid scenario authoring for robot safety and failure analysis in industrial and service settings, using typed task predicates and evaluator-owned probes.
  • Simulator-ready asset pipelines for digital twins, where generated content must be exported to an engine rather than only rendered.

Industry relevance. Teams building robot-learning stacks currently spend significant effort hand-authoring simulation assets. A compiler that ingests an LLM-generated scene and emits a loadable MJCF package with mass, friction, inertia, joints, contact groups, and a gravity-settled layout addresses a real bottleneck. The engine-agnostic Embodied World Graph also positions the approach for export to Isaac Sim/USD without regenerating the scene.

Future Directions

  • Navigation is the weak spot. Navigation RTS fell from 45/60 to 35/60 after enrichment, and the authors do not explain why in the provided content; diagnosing and reversing this regression is an open problem.
  • Support-graph accuracy is limited. Initial support-relation micro-F1 is 66.7% (15 FP), and the eval covers only five annotated cases across three generation seeds — scaling annotation and grounding the graph in measured simulator contact rather than heuristics is a natural next step.
  • Statistical power. The headline 8.3 percentage-point RTS gain has a bootstrap interval of [−11.1, 28.9], so larger source-conditioned studies are needed before strong claims about aggregate improvement.
  • Beyond MuJoCo. The compiler is demonstrated on MJCF; the authors position the Embodied World Graph as exportable to Isaac Sim/USD and other engines, but do not report such exports, so multi-engine validation remains future work. Similarly, only one generated world per prompt is used in the matched-prompt comparison.

Target Audience

Robotics and embodied-AI researchers working on simulation-ready scene generation, sim-to-real pipelines, and LLM-driven world models; engineers building manipulation or legged-locomotion training environments who need automatically generated, physically valid assets; and benchmark designers interested in state-based, probe-protected evaluation of executable world packages rather than rendered video. Readers should be comfortable with physics-engine concepts (collision meshes, MJCF, contact constraints, friction cones) since the paper does not introduce them.

Authors’ abstract

Recent coding large language models (LLMs) can synthesize dynamic 4D worlds from natural language, but the resulting content remains a visual artifact. It lacks physical semantics such as the collision geometry, mass, friction, inertia, and joint structure, required to enable it to simulate the physical world, and its dynamics are scripted to look plausible rather than designed to execute. What is needed is an executable world: one that a physics engine can load and step,…

The full abstract on arXiv
Read the original paper

Related papers