How do I build a physics simulation with Claude?
Quick answer
A physics simulation is one of the most rewarding things to build with an AI assistant. It looks impressive, it teaches something real, and it fits neatly into a single HTML file. Here is how to get from an idea to a published, interactive simulation.
What makes a good first physics simulation?
Start with a system that has one or two variables and visible motion. A bouncing ball under gravity, a swinging pendulum, two bodies in orbit, a mass on a spring, a field of drifting particles. Each is simple enough to get right quickly and interesting enough to be worth sharing. Save the many-body, fluid, and soft-body simulations for later.
How do I prompt for a physics simulation?
Name the system and the format together: "Build a single self-contained HTML file that simulates a double pendulum on a canvas that resizes to the window." Describe what should move and how. Then ask for the variables to be adjustable. Keeping the request to one system gets a working result faster than asking for a physics playground all at once.
Should I use a physics library?
It depends on the system. For rigid bodies that collide and stack, Matter.js does the hard work — list it as a library in the ARCADELAB header and ArcadeLab injects it. For continuous systems like orbits, pendulums, and springs, the math is short and a plain canvas is lighter and easier to read. Tell the assistant which approach you want so it does not pull in a library you do not need.
How do I make it interactive?
A simulation becomes a teaching tool the moment a viewer can change it. Add sliders for the constants — gravity, mass, length, speed — and a reset button. Let the viewer drag a body to set its starting position. Each control is a small request to the assistant, and each one makes the simulation more worth sharing.
How do I publish the simulation?
Test the file in a browser, then paste it at arcadelab.ai/publish for a permanent URL. A simulation is a single self-contained HTML file, so it publishes exactly like a game. For the broader category, see where to publish an interactive visualization online.
Built a simulation? Publish it at arcadelab.ai/publish.
Ready to publish? Paste your HTML file and get a URL.
🚀Publish your thing