arXiv(opens in a new tab)cs.ROOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.17651

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

Haoyu Zhang, Siming Li, Zeyu Zhang, Yi Zhang, Tat-Seng Chua, Hao Tang

Haoyu Zhang*, Siming Li*, Zeyu Zhang*†, Yi Zhang, Tat-Seng Chua, Hao Tang‡

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, resolving contact physically. We present Code2Worlds-2, an extension of Code2Worlds that turns 4D world generation into an embodied world simulation. We keep the original dual-stream generation pipeline intact and append two modules. First, a SimReady Scene Compiler that turns a generated visual scene into a simulator-compatible representation: it assigns collision meshes via convex decomposition, estimates physical attributes with a vision-language model, infers a lightweight support graph, instantiates the engine's contact, friction, and dynamics constraints, and applies a gravity settling pass, before exporting the scene as MuJoCo MJCF. Second, a Simulator-in-the-Loop 4D Refiner that implements an automated agent harness—a compile, simulate, critique and refine loop—that converts visual dynamics into executable rigid and articulated dynamics and evolves the physical settings rather than only the code, replacing the purely visual motion critic with a simulator critic that inspects penetration depth, collision pairs, stability, contact forces, joint limits, and robot reachability. We further propose SimCode4D, a state-based benchmark with five task templates for evaluating embodied simulation. Experiments on SimCode4D and across natural, indoor, industrial, urban, and service scenes demonstrate that Code2Worlds-2 produces scenes that are physically plausible, simulator-compatible, and interactable by legged and manipulator robots. Code: https://github.com/AIGeeksGroup/Code2Worlds-2. Website: https://aigeeksgroup.github.io/Code2Worlds-2.

Index Terms—4D world generation, embodied world simulation, coding LLM, physics simulation, robot manipulation, MuJoCo.

1 INTRODUCTION

Spatial intelligence requires more than visually convincing pictures; it demands world models that obey the laws of physics. Coding large language models (LLMs) have recently been shown to generate static 3D scenes and, more ambitiously, dynamic 4D worlds by writing programmatic scene code. Code2Worlds [1] advanced this line by proposing a dual-stream architecture that disentangles retrieval-augmented object generation from hierarchical environmental orchestration, and by narrowing the semantic-physical gap with a Post-Process Agent that scripts dynamics and a VLM-Motion Critic that self-reflects to refine the generated code. The result is a 4D world that is visually dynamic and semantically physical.

Yet for an embodied agent—a quadruped that must walk across a rocky field, a manipulator that must open a drawer—a visually plausible world is not enough. Two gaps separate Code2Worlds from a usable embodied simulator. First, a semantic-physical execution gap: generated meshes carry no collision geometry, mass, friction, inertia, or joint structure, so a physics engine such as MuJoCo [2] or Isaac Sim [3] accepts them only as raw visual hulls, where contact, support, and manipulation carry no physical meaning. Second, a simulation-fidelity gap: the dynamics are scripted to appear physically reasonable but are never

(a) Code2Worlds

Visual 4D generation

Figure

(b) Code2Worlds-2

Embodied world simulation

M1 · Compiler

M2 · Refiner

Figure

Revise physics + dynamics

Interactive simulation

Fig. 1. The feedback loops of the two systems. (a) Code2Worlds [1] corrects a scene by rewriting its code from rendered images—a visual loop, which cannot guarantee physical validity. (b) Code2Worlds-2 instead closes the loop through the simulator: Module 1 compiles a SimReady scene, Module 2 critiques the rollout, and simulator feedback guides the revisions to the physical settings and dynamics.

• *Equal contribution. †Project lead.

• †\daggerCorresponding author, E-mail: bjdxtanghao@gmail.com.

  • Haoyu Zhang, Siming Li, Zeyu Zhang, Yi Zhang, and Hao Tang are with the School of Computer Science, Peking University, Beijing 100871, China.

  • Tat-Seng Chua is with the School of Computing, National University of Singapore, Singapore.

executed, so an agent cannot collide with, push, grasp, or otherwise interact with them. Fig. 1 contrasts the two loops: Code2Worlds rewrites the entire scene code, whereas Code2Worlds-2 revises the physical settings themselves.

Figure

generalizes across five domains · real robot rollouts

nature · Go2

indoor · vacuum

industrial · UR5e

urban · Go2

service · robot

Fig. 2. Overview of Code2Worlds-2. Two modules are appended to the original Code2Worlds pipeline to produce a simulator-compatible, interactable 4D world, and the illustrated scenes span five domains.

This paper extends Code2Worlds into Code2Worlds-2, an embodied world simulation framework. We keep the original pipeline unchanged and append two modules that bridge these gaps (Fig. 2). The first, a SimReady Scene Compiler (Module 1), wraps each visual scene with a physical compilation layer: it decomposes concave meshes into convex pieces, estimates physical attributes with a vision-language model and geometry, infers a support graph, and settles objects under gravity before exporting MJCF. The second, a Simulator-in-the-Loop 4D Refiner (Module 2), translates visual dynamics into executable dynamics and replaces the purely visual motion critic with a simulator critic that reasons over physical signals rather than pixels alone. We additionally propose SimCode4D, a state-based benchmark with five task templates, and validate the framework across natural, indoor, industrial, urban, and service scenes.

Extension over the conference version. This paper extends our ICML 2026 conference paper, Code2Worlds [1]. The original generation streams are retained; the journal version adds (i) physical scene compilation and MuJoCo export (Sec. 3.1), (ii) simulator-in-the-loop dynamics refinement and physical validation (Sec. 3.2), and (iii) the state-based SimCode4D protocol and embodied-interaction evaluation (Secs. 4 and 5).

In summary, this paper makes the following contributions:

  • We propose a SimReady Scene Compiler that converts coding-LLM-generated visual scenes into simulator-compatible representations with collision geometry, physical attributes, a support graph, physical constraints, and a settling pass, while emitting paired default and enriched scene exports whose comparison is our primary measure of physical plausibility.

• We propose an agent harness—an automated compile–simulate–critique–refine loop that evolves the physical settings of a generated world—realized by a Simulator-in-the-Loop 4D Refiner that compiles visual dynamics into executable rigid and articulated dynamics and replaces visual-only critique with simulator-signal critique (penetration, contact, stability, joint limits, reachability).

  • We introduce SimCode4D, a state-based benchmark with five task templates for embodied world simulation, and demonstrate physical plausibility, simulator compatibility, and robot interactability across five scene categories.

References (57)