Skip to content

augustocesarperin/chaos-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An engine with some physics and a lot of optimizations. Made for educational and procrastinatory purposes in C++ & SFML.

Demonstration of the Final Version

Verlet Integration

This program uses Verlet integration for motion calculations. Unlike the Euler method (used in early versions), the Verlet method prevents particles from tunneling through each other at high speeds or when the FPS drops significantly. The system also simulates energy loss in collisions, preventing them from bouncing around ad infinitum.

Main Optimizations

  • Spatial Grid
  • Object Pooling
  • Structure of Arrays (SoA)

Controls

Mouse:

  • Left-click: creates a normal particle
  • Right-click: creates a large particle

Keyboard:

  • G: toggles gravity
  • R: toggles repulsion
  • M: toggles mouse force
  • N: switches between attract and repel
  • F: changes the mouse force style
  • +/-: adjusts force intensity
  • C: clears all particles
  • Space: creates random particles
  • ESC: bye

How to Compile

Windows

Run the file:

compile.bat

You need to have MSYS2 with MinGW tools (g++, make, cmake) and SFML installed and in the system's PATH.

Linux

sudo apt update && sudo apt install build-essential git cmake libsfml-dev

git clone https://github.com/augustocesarperin/chaos-engine.git
cd chaos-engine
mkdir build && cd build
cmake ..
make
./Chaos

Despite being optimized, performance may vary with many particles/interactions. Use at your own risk.

(Works on my machine)

Previous Versions

v0.5
Demonstration of Version 0.5

v0.1
Demonstration of Version 0.1

Augusto Cesar Perin | 2018-2019

About

An optimized 2D physics engine built with C++ and SFML

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published