September 2025

Optimised Physics Simulation

OVERVIEW

Links

Project source is currently private.

Overview

A 3D physics simulation built to simulate tens of thousands of spheres. Utilises threading, parallelisable code, and spatial partitioning to achieve this.

Timeline

2 months


FEATURES

Project Features

1.0 15000 objects being pushed to one side. IMAGE

Threading

Through the use of a thread pool, many parts of the physics calculations are done on separate threads.

Spatial Partitioning

I found for this project that the best option was a uniform grid, which splits the world into equal sized cells on all axes. However a more data oriented approach is taken to allow parallelising.

1.1 A visualisation of the uniform grid. IMAGE

Fairly Stable Physics

Similar to my previous physics project, this one uses an iterative collision resolution process that decreases inter-penetration.

1.2 ImGui Windows IMAGE

ImGui Windows

There are many windows that allow modification of settings and viewing debug information.

1.3 ImGui Windows IMAGE

Custom Profiler

For this project, I built a custom profiler that uses start and end macros to create new timing nodes in a tree. This data can then be exported from the program as a .csv file.

1.4 Profiling Stats Window. IMAGE
1.5 An example document exported from the profiler. IMAGE

Allocation Tracking

Only when it is compiled in, allocations will be tracked and a linked list of all of them will be made. This allows walking the heap to check for corrupted data. I also have a custom new macro that lets me take in extra data of where the allocation was called from.

1.6 Profiling Stats Window. IMAGE
1.7 Example console output when walking the heap twice. IMAGE