The project

This project demonstrates that it is possible to run a 2D Physics engine made from scratch in Ada on a STM32, with some very cool results !

Basically, the project is split in two independent parts:

The Physics engine, with its API, available for you to download and use for your own projects: https://github.com/Kidev/AdaPhysics2D It is of course open, and a tutorial to easily use it is available on the Github page of the engine. With it, you will be able to create awesome physics projects (like games) really quickly, efficiently (remember that it runs smoothly on a STM32), and without any actual knowledge in physics !

https://github.com/Kidev/AdaPhysics2D The STM32 wrapper, made with the help of Adacore's Ada_Drivers_Library, that provides an easy and fun way to discover all the features of the engine: https://github.com/Kidev/DemoAdaPhysics2D

Video

The engine's features

So, what are the physics engine features ? Well, it does :

Multiple 2D worlds, with layering

Real time collision detection and impulse resolution

Multiple entities (Circles and Rectangles) with custom initial position, speed, gravity and material (wood, steel...)

Multiple environments with custom area and material (water, air...)

Custom forces impulsions

Solid (static and dynamic) friction: objects don't keep sliding forever, and it takes work to make them move when they are still

Liquid friction: the environment affects objects speed

Archimedes's principle: objects float in environments with a higher density

Ropes and springs to link entities: to make pendulums and use springs !

And an easy to use open source API !

The STM32 wrapper

The STM32 makes it very fun to play with, and you can shake the board to affect the entities with the gyroscope ! But the menus can be difficult to understand. So, to make it easier:

When you load the app you are greeted with a menu. Chose "START". You are now facing one world. By pressing the blue button, you can change the current mode. The modes rotate. Here are the modes: