Skip to content

NtokozoMkhwanazi/RTT-engine-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

144 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ RTT-Engine

A simple C++ game engine

C++ OpenGL Platform Tests FPS


๐Ÿ“– Overview

Welcome to RTTEngine a simple approach at a 3D Game Engine with a strong focus on Learning the complex field of computer graphics, applications of Mathematics and software engineering princples & optimization techniques.


โšก Performance

Metric Value
Frame Time 8ms (125 FPS)
Draw Calls ~50
Triangles ~50K
Bone Upload 0.007ms
Motion Search 0.02ms

๐Ÿ—๏ธ Architecture

arch

๐ŸŽฎ Features

Core Systems

Motion Matching

  • SAH-optimized KD-Tree (12 bins)
  • 10,980 pose database
  • 0.02ms search time
  • Continuous pose searching

Bone Matrix Buffer

  • Auto UBO/SSBO selection

World Rendering

  • Frustum culling
  • Distance LOD
  • Instanced rendering
  • Occlusion culling
  • Texture atlasing

Memory Management

  • Memory arenas (O(1) allocation)
  • Object pools (O(1) alloc/free)
  • Asset manager with reference counting

Foot IK System

  • Dynamic terrain height tracking
  • Enhanced foot planting detection
  • Real-time floor height updates

Rendering

  • OpenGL 3.3+ pipeline
  • GPU skinning with bone buffer
  • Batch rendering with instancing
  • Multiple light types
  • Normal mapping and PBR materials
  • Skybox with cube mapping
  • Atmospheric fog

World Streaming

  • Procedural terrain (Perlin noise)
  • Chunk-based LOD (4 levels)
  • 800m ร— 800m explorable areas
  • Height-based biomes
  • Water system with waves
  • Vegetation placement

Animation

  • Skeletal animation with GPU skinning
  • Animation blending and layering
  • Root motion extraction
  • Foot IK
  • State machines
  • Mixamo compatibility
  • FBX import via Assimp

Physics

  • Collision detection (boxes, spheres, capsules)
  • Rigid body dynamics
  • Continuous collision detection
  • Raycasting
  • Constraints (hinge, slider, springs)
  • Character controller

Character Controller

  • Third-person movement with root motion
  • WASD locomotion
  • Jump, Sprint, Crouch
  • Smooth rotation
  • Camera modes: Fixed, Orbit, Follow
  • Smooth zoom (8-30m)

Debug Tools

  • GPU Profiler (OpenGL timestamp queries)
  • Foot IK Debug (Press G)
  • Motion Matching Debug (Press H)
  • Performance Stats (Press F1)

๐Ÿ“ Project Structure

3D GAME ENGINE/
โ”œโ”€โ”€ world/                      # Terrain, chunks, vegetation
โ”œโ”€โ”€ animationSystem/            # Animation, bone buffer, foot IK
โ”œโ”€โ”€ motionMatching/             # Motion matcher, KD-Tree, database
โ”œโ”€โ”€ boneSystem/                 # Skeleton, bone naming
โ”œโ”€โ”€ physicsSystem/              # Physics, rigid bodies, constraints
โ”œโ”€โ”€ modelSystem/                # Model loading, meshes
โ”œโ”€โ”€ playerSystem/               # Character controller
โ”œโ”€โ”€ cameraSystem/               # Camera management
โ”œโ”€โ”€ shaderSystem/               # Shaders, skybox
โ”œโ”€โ”€ renderer/                   # Renderer, texture atlas, GPU profiler
โ”œโ”€โ”€ lighting/                   # Light management
โ”œโ”€โ”€ memory/                     # Arenas, asset manager
โ”œโ”€โ”€ components/                 # ECS components
โ”œโ”€โ”€ tests/                      # Unit tests (235 total)
โ”œโ”€โ”€ assets/                     # FBX models, animations, skybox
โ”œโ”€โ”€ include/                    # GLAD, GLM, KHR
โ”œโ”€โ”€ Makefile                    # Build configuration
โ”œโ”€โ”€ test.cpp                    # Main entry point
โ””โ”€โ”€ bin/                        # Executables

๐ŸŽฎ Controls

Key Action
W / S Move forward / backward
A / D Strafe left / right
SPACE Jump
LEFT SHIFT Sprint
LEFT CTRL Crouch
C Toggle camera mode
Mouse Orbit camera
Scroll Zoom (8-30m)
Q / E Camera pivot
R Reset camera
F Toggle wireframe
B Bone debug
G Foot IK status
H Motion matching debug
F1 GPU stats
ESC Exit

๐Ÿ› ๏ธ Dependencies

Library Installation (Ubuntu)
GLFW sudo apt install libglfw3-dev
GLM sudo apt install libglm-dev
Assimp sudo apt install libassimp-dev
OpenAL sudo apt install libopenal-dev
zlib sudo apt install zlib1g-dev
Google Test sudo apt install libgtest-dev

GLAD is included in include/.


โš™๏ธ Building

# Debug build
make

# Release build
make release

# Run tests
make test

# Run engine
./bin/run

Build Status

โœ… Compilation: SUCCESS
โœ… Tests: 230/235 PASSING (98%)

๐Ÿงช Testing

Total Tests: 235
Passed: 230 (98%)
Disabled: 5 (2%)
Failed: 0 (0%)

Test Suites

Suite Tests Status
Animation 17 โœ…
Animation FSM 20 โœ…
Camera 77 โœ…
Character Controller 24 โœ…
Integration 19 โœ…
Math 19 โœ…
Memory Management 25 โœ… 22 passing
Motion Matching 14 โœ… 12 passing
Physics 13 โœ…
Terrain 7 โœ…

๐Ÿ“Š Metrics

Metric Value
World Size 800m ร— 800m
Active Chunks 45-70
Total Vertices ~50K (with LOD)
Max Trees/Chunk 80
Frame Time 8ms (125 FPS)
Motion Search 0.02ms
Bone Upload 0.007ms

โœ… Implementation Status

Complete

  • Procedural terrain generation
  • Chunk streaming & LOD
  • Frustum & occlusion culling
  • Animated water system
  • Vegetation instanced rendering
  • Skeletal animation
  • Motion matching system
  • Bone matrix buffer (UBO/SSBO)
  • Foot IK with terrain tracking
  • Physics collision detection
  • Rigid body dynamics
  • Character controller
  • Camera system
  • Texture atlasing
  • GPU profiling
  • Memory arenas & pools
  • Asset manager
  • Unit tests (235 tests)
  • NaN prevention

In Progress

  • Grass instanced rendering
  • Rock model rendering
  • Texture splatting
  • Water collision
  • Shadows
  • Full audio integration

Planned

  • Infinite terrain streaming
  • Day/night cycle
  • Weather system
  • Advanced lighting
  • Particle system
  • UI system
  • Scripting support

๐Ÿ”ง Configuration

Edit in test.cpp:

// Terrain
terrainConfig.chunkSize = 100.0f;
terrainConfig.viewDistance = 8;
terrainConfig.lodDistance = 50.0f;
terrainConfig.heightScale = 80.0f;

// Vegetation
vegConfig.treeDensity = 0.02f;
vegConfig.maxTreesPerChunk = 80;

// Camera
cameraDistance = 15.0f;
cameraHeight = 5.0f;
cameraZoomMin = 8.0f;
cameraZoomMax = 30.0f;
cameraFollowSmooth = 60.0f;

// Motion Matching
mmConfig.maxSearchResults = 10;
mmConfig.searchRadius = 2.0f;
mmConfig.blendDuration = 0.1f;


๐Ÿ› Known Issues

Minor

  • Grass instanced rendering not fully integrated
  • Some FBX animations need retargeting
  • Rock models need proper LOD

Workarounds

  • Press G to check foot IK status
  • Press H to check motion matching state
  • Press F1 to profile performance

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for new features
  4. Submit a pull request
  5. Open issues for bugs or features

๐Ÿ“„ License

MIT License โ€” See LICENSE file for details.


๐Ÿ™ Acknowledgments

Resource Purpose
Mixamo Character animations
Assimp Model loading
GLFW Windowing
OpenGL Graphics API
GLM Mathematics
Google Test Unit testing
Papers & textbooks techniques & experimentation

๐Ÿ“ž Support

Common Issues

Low FPS
Press F1 to see GPU stats, identify bottleneck

Character floating
Press G to check foot IK, verify floor height

NaN errors
Check character/terrain initialization order

Black screen
Check shader compilation, verify asset paths

Debug Workflow

  1. Press F1 - Check GPU stats
  2. Press G - Check foot IK
  3. Press H - Check motion matching
  4. Check console for errors
  5. Run tests: make test

(RTT-DEV)

GitHub

Version 2.0 | C++17 | OpenGL 3.3+ | Linux

Last Updated: February 2026

About

C/C++ 3D Game engine OpenGL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages