Many of the tasks we want robots to learn mix materials: pouring water into a glass, folding a towel, scooping sand, routing a cable. In simulation those materials usually live in different tools, so a policy that has to pour and grasp ends up stitched across engines, or the liquid gets left out.
Alloy is an open-source (Apache-2.0) physics engine for robot learning that puts them in one scene. The paper is on arXiv: Alloy: A Multi-Material Physics Engine for Robot Learning.
Alloy is built on MuJoCo Warp and Newton and picks a solver for each object from its material:
| Object | Solver |
|---|---|
| Robots and rigid bodies | MuJoCo Warp (MuJoCo C on the CPU) |
| Cloth and soft bodies | Newton's VBD solver |
| Sand, granular material and pastes | Newton's implicit MPM solver |
| Liquids | Alloy's own DFSPH solver |
Objects from different solvers touch each other in the same scene. sim.routes() tells you which solver each object got. Here an MJCF arm sits beside a tub of water and a tray of sand:
import alloy
ARM = """<mujoco><compiler angle="radian"/><worldbody><body name="link1" pos="0 0 0.1">
<joint name="shoulder" type="hinge" axis="0 1 0" range="-2 2" damping="2"/>
<geom type="capsule" fromto="0 0 0 0.3 0 0" size="0.02" mass="1"/>
</body></worldbody>
<actuator><position joint="shoulder" kp="200" kv="10"/></actuator></mujoco>"""
scene = alloy.Scene(dt=0.01)
scene.add_ground()
scene.add_robot("arm", mjcf=ARM, pos=(0, 0, 0.1))
scene.add_open_box("tub", inner=(0.08, 0.08, 0.05), wall=0.01, pos=(0.5, 0, 0))
scene.add_liquid("water", size=(0.064, 0.064, 0.024), pos=(0.5, 0, 0.024))
scene.add_open_box("tray", inner=(0.1, 0.1, 0.05), wall=0.01, pos=(0.5, 0.4, 0))
scene.add_box("sand", size=(0.06, 0.06, 0.03), pos=(0.5, 0.4, 0.03), material="sand_silica_dry")
sim = alloy.build(scene, device="cpu")
print({n: sim.routes()[n]["solver"] for n in ("arm", "water", "sand")})
sim.run(0.3, targets={"shoulder": (0.0, 0.3)})
print(sim.state(world=0)["arm/shoulder.q"].round(2), sim.check()["ok"])
{'arm': 'mujoco', 'water': 'sph', 'sand': 'mpm'}
0.25 True
The MJCF string is the robot; a robot file such as a Franka loads the same way with add_robot. sim.check() grades the world, so you can catch a simulation that blew up instead of training on it.
Alloy ships an MCP server, so an agent such as Claude Code can build and run scenes itself:
pip install alloy-engine
claude mcp add alloy -- alloy mcp
pip install alloy-engine (Python 3.11 or 3.12)