Neko is a 3D game engine based on SDL2 and OpenGL ES 3.0 that works on Desktop, WebGL2 and Nintendo Switch (port to Android and iOS possible) used at SAE Institute Geneva.
Because we use C++17 filesystem, you will need Ubuntu 19.10 to compile with the latest libstdc++, Visual Studio 2019 is recommended on Windows. You also need to have python 3.8. Don't forget to add to the the variable PATH. You also need to have the VulkanSDK installed. After installing Vulkan you'll need to retart your computer.
This repos has been specifically made to create a custom 2D physics engine as a school project and is not intended for the development of a game.
- SDL2
- GLAD
- Box2D
- googletest
- taskflow
- imgui
- sole uuid
- xxhash
- std_image
- Clone the repos
- Launch CMake.
- Set the source code's path where you clone the project
- Set the build into a folder NekoEngine/Build
- Press "Configure" and select the version of visual studio you're using (Visual Studio 2019 is recommended). Click "Finish".
- Once the configuration is done, click on "Generate".
- When it's finish you can open the project
- To check that everything is working, select main/physics_engine2d as the launching project and start the project.
The physics engine must simulate a 2d rigid physics. Their must be:
- Different type of body (static, dynamic, kinematic)
- Collision/Trigger (box, circle, polygon)
- Bounding volume implementation (AABB)
- Space Partitioning (QuadTree)
- Position and velocity correction after a collision
- RayCasting
- Explosion effect
To do so, every files in externals/physics can and must be modified. You can also create your own files.
Every test in test_physics must succeed and a custom test must be created to display a specific feature of the physics engine.
You can find the google tests in test/test_physics.cpp, they cover vector, matrix and aabb.
Here is the list of individual test that can be access through the main project physics_engine.
This test instantiate one rigidbody in the center of the windows with a body. The expected result is that the body should fall down.
This test is here to visualize the use of the quadTree. The quadtree is drawn in grey.
The expected behavior is to see the circle fall, hit the box then completely stop moving. The box object should never move as it's a static object.
Their is 4 ball each with a given restitution (0, 0.33, 0.66, 1) falling on the same box collider with a restitution of 1. It's expected that the most right ball never stop bouncing while the ball to the left never bounce.
Their is 4 quad each with a given friction (0, 0.33, 0.66, 1) falling on a box collider with a friction of 0. You can change the friction of each platforms and their rotation. You can also reset the simulation.
In this simulation there is falling pentagon that collide with randomly placed platforms.
To update the repos you must add an upstream with this repos https://github.com/Surue/NekoEngine
$git remote add upstream https://github.com/Surue/NekoEngine.git
(this must be done only once)
Every time you wish to update the repos :
$git fetch upstream develop
$git pull upstream develop
It's possible to draw basics shapes on the screen using the following functions. Every one of them accept an optional to set a specific color.
DebugDrawer2dLocator::get().DrawLine(p1, p2);
DebugDrawer2dLocator::get().DrawVector(p1, direction, length);
DebugDrawer2dLocator::get().DrawAABB(bottomLeft, topRight);
DebugDrawer2dLocator::get().DrawBox(center, extent, angle);
DebugDrawer2dLocator::get().DrawCircle(center, radius);
DebugDrawer2dLocator::get().DrawPolygon(center, vertices, angle);
To add a new function:
- Add an abstract function in DebugDrawer2dInterface (in debug_drawer_2d.h)
- Override it in DebugDrawer2d and NullDebugDrawer2d (int debug_drawer_2d.h)
- Draw stuff only using line by calling
lineRenderer_.DrawLine(Line(p1, p2))
Q. How can I know my Python's version?
A. Open a console/terminal and enter python --version