Skip to content

Sodas0/phys-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phys-engine

A 2D physics engine written in C with SDL2 rendering.

My goal with this project is to use this as a very simple physics engine for elementary RL training as a learning exercise. Future projects will leverage this engine as a sandbox for training agents on classic control tasks like ball balancing, target hitting, and multi-body coordination.

Note: The RL interface is a work in progress.

Demos

2026-01-30.02-54-16.mp4
2026-01-30.03-04-51.mp4

Features

  • Circle and rectangle rigid body simulation with rotation
  • Collision detection and impulse-based response (SAT for rectangles)
  • Configurable gravity and world boundaries
  • Adjustable body properties (mass, restitution/bounciness)
  • Debug visualization for velocity vectors and contact points
  • JSON scene loading system
  • Deterministic RNG for reproducible simulations
  • Uint system where 100 pixels = 1 meter

Requirements

  • C compiler (clang or gcc)
  • SDL2

Building

make

Running

make run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published