Work

Bark Physics Engine

C++
Physics
Quadtree
Optimisation

I developed a 2D physics engine from scratch with triggers, collisions and space subdivision. Later I upgraded it to a 3D version.

Image of the collision scene

Overview

This physics engine was developed as part of a module covering physics, mathematics, optimization, CPU architecture, and profiling during the second year of a Bachelor’s degree in Games Programming at SAE Institute Geneva.

The primary objective was to design the engine as a user-friendly API while optimizing its performance. A key requirement was ensuring that the engine could run a sample scene with 1,000 colliders in trigger mode at a minimum of 60 FPS.

To achieve this, I implemented a custom mathematics library (done with the help of my classmates) and developed essential C++ utilities, including smart pointers, allowing me to integrate custom memory allocators for profiling and optimizing memory management.

Later, I extended the engine to support 3D physics and rendering, transitioning from my custom math library to DirectXMath for better performance and SIMD-optimized vector operations.

How it looks like

Here is video of both 2D and 3D physics engine

Here is demo of the 2D physics engine you can test.

What did I learn

  • Basics of Calculus
  • Basics of Linear Algebra
  • Basics of Physics
  • Choose and use the right C++ data structures in a given context
  • Low level C++ API programming
  • Template programming
  • Writing custom allocators
  • Profiling code and memory management
  • Optimisation tricks
    • Padding
    • Memory layout
    • Cache hit
    • Quadtree then Octree
  • How a modern CPU works

Source Code & Download


description: Modifications đźź 

🏄 Ajustements

{% hint style=“info” %} Certaines fonctionnalités de Minecraft ont besoin d’ajustements pour rester agréable pour tous :

  • Les pommes d’or sont dĂ©sactivĂ©es. (RemplacĂ© par la Pastèque Divine et l’Acide Ascorbique).
  • Les potions sont dĂ©sactivĂ©es. (Certains effets sont remplacĂ©s par la nouriture personnalisĂ©e).
  • Les pommes de Notch sont dĂ©sactivĂ©es.
  • Les sceaux de lait sont dĂ©sactivĂ©s.
  • La canne Ă  pĂŞche, les enderpearls possèdent un temps de recharge.
  • La CitĂ© est chargĂ©e en permanence.
  • Il n’est pas possible de faire apparaitre des animaux Ă  l’étage 1 (RDC) de la CitĂ©.
  • Ajout du Killer Bunny.
  • Les Fermes Ă  Raid sont interdites.
  • Les machines volantes sont interdites.
  • Le craft des shulkers vanilla est dĂ©sactivĂ© (remplacĂ© par les shulkers).
  • La Smithing Table (table de forge) est dĂ©sactivĂ©e.
  • Les Elytras sont dĂ©sactivĂ©es dans la CitĂ©.
  • Vous ne pouvez pas poser la Glazed Terracota (terre cuite Ă©maillĂ©e)
  • L’enchantement Mending est dĂ©sactivĂ© sauf pour les Super Elytras.
  • Les fermes 0 ticks sont interdites. {% endhint %}