2D Physics Engine
A small simulation project connecting collision calculations in Go to a browser interface for changing object parameters and watching the resulting motion.
36 commits1,690 source lines
Counting scope & snapshot
All commits reachable from this default-branch revision, including merges and all authors. Physical source lines counted in each physical file, including native Astro components, tests, examples and parsed notebook code cells; excluding blanks, comments, dependencies, generated files, documentation and notebook outputs.
Counted with cloc 2.10. Revision dd6d149781, observed . These are repository totals, not individually authored lines.
- Role
- To be supplied
- Technologies
- Go, JavaScript, Canvas, WebSocket
- Impact
- To be supplied
Architecture
The Go physics package represents objects with position, velocity and mass, and supports circles and squares. The browser interface uses JavaScript and Canvas; the backend exposes a WebSocket route to deliver simulation states.
Event-based simulation
Each step searches for the earliest future wall or object collision, advances all objects to that time, resolves the event, and continues through the remaining interval. Wall and object collision calculations are separated from the simulation loop.
The continuous mode uses a 60 Hz ticker as a scheduling interval. That is an implementation setting, not a measured performance result. Render-state snapshots are copied before delivery to the connection, and a full state channel can skip a frame rather than block the physics loop.
Interaction and boundaries
The browser provides mass, velocity and shape controls, along with start/reset behavior. The repository includes collision and route tests, but these have not been run as part of this portfolio update. This is a focused simulation, not a claim of a general-purpose or production-validated physics engine.