This directory contains comprehensive examples and tutorials for the Pyramid Engine. Each example is designed to demonstrate specific features and provide educational value for developers learning the engine.
Before running the examples, ensure you have:
- Built the Engine: Follow the Build Guide to compile the engine
- Working Environment: Visual Studio 2022 or compatible development environment
- Graphics Support: OpenGL 3.3+ compatible graphics card with updated drivers
Location: Examples/BasicGame/
Difficulty: Beginner
Concepts: Core engine usage, game loop, basic rendering
Description: The BasicGame example demonstrates the fundamental concepts of the Pyramid Engine. It showcases:
- Engine initialization and shutdown
- Basic game loop implementation
- Simple 3D rendering with shaders
- Camera system usage
- Input handling
- Resource management
What You'll Learn:
- How to create a
Gameclass and override core methods - Setting up graphics device and shaders
- Creating and managing 3D objects
- Basic camera controls and movement
- Event handling and user input
Code Highlights:
class BasicGame : public Pyramid::Game {
public:
void onCreate() override;
void onUpdate(float deltaTime) override;
void onRender() override;
};Running the Example:
cd build\bin\Debug
BasicGame.exeLocation: Examples/BasicRendering/
Difficulty: Beginner
Concepts: Advanced rendering, shaders, materials, lighting
Description: The BasicRendering example demonstrates modern rendering techniques:
- Advanced shader system with uniform buffers
- Physically-based material properties
- Dynamic lighting with multiple light types
- Orbital camera system
- Real-time material property animation
- Performance monitoring and statistics
What You'll Learn:
- Creating and compiling GLSL shaders
- Using uniform buffer objects (UBOs) for efficient data transfer
- Implementing basic lighting models (Phong, Blinn-Phong)
- Managing material properties and textures
- Camera mathematics and orbital movement
- Performance profiling and optimization
Key Features Demonstrated:
- Vertex and fragment shader compilation
- Uniform buffer object management
- Dynamic material property updates
- Multi-light rendering
- Camera orbital mechanics
- Frame rate monitoring
Running the Example:
cd build\bin\Debug
BasicRendering.exeLocation: Examples/SceneManagement/ (Planned)
Difficulty: Intermediate
Concepts: Scene graphs, spatial partitioning, culling
Description: Demonstrates the engine's scene management capabilities:
- Hierarchical scene graph organization
- Octree spatial partitioning
- Frustum culling optimization
- Dynamic object management
- LOD (Level of Detail) systems
- Performance monitoring for large scenes
What You'll Learn:
- Building complex scene hierarchies
- Spatial partitioning for performance
- Visibility culling techniques
- Managing thousands of objects efficiently
- Performance optimization strategies
Location: Examples/AdvancedMath/ (Planned)
Difficulty: Intermediate
Concepts: SIMD math operations, performance optimization
Description: Showcases the engine's SIMD-optimized math library:
- Vector and matrix operations with SIMD
- Performance comparisons between scalar and SIMD code
- Batch processing of mathematical operations
- Runtime CPU feature detection
- Memory alignment considerations
What You'll Learn:
- Writing SIMD-optimized game code
- Understanding performance implications of math operations
- Batch processing for optimal CPU utilization
- Memory alignment for SIMD operations
Location: Examples/PhysicsDemo/ (Planned)
Difficulty: Intermediate
Concepts: Physics simulation, collision detection, rigid bodies
Description: Demonstrates physics system integration:
- Rigid body dynamics
- Collision detection and response
- Constraint systems (springs, hinges)
- Character controller implementation
- Vehicle physics simulation
What You'll Learn:
- Setting up physics worlds and objects
- Implementing realistic character movement
- Creating interactive physics simulations
- Integrating physics with rendering
Location: Examples/MultiThreading/ (Planned)
Difficulty: Advanced
Concepts: Multi-threaded rendering, job systems, performance
Description: Shows advanced multi-threading techniques:
- Multi-threaded rendering pipelines
- Job system implementation
- Lock-free data structures
- CPU utilization optimization
- Thread synchronization strategies
Location: Examples/CustomShaders/ (Planned)
Difficulty: Advanced
Concepts: Advanced shading, post-processing, effects
Description: Advanced shader programming examples:
- Custom shader effects (water, fire, etc.)
- Post-processing pipelines
- Compute shader usage
- Advanced lighting models (PBR)
- Screen-space effects (SSAO, SSR)
File: Tutorials/01_FirstTriangle.md
A step-by-step guide to rendering your first triangle:
- Setting up the development environment
- Creating a minimal game class
- Basic shader creation and compilation
- Vertex buffer setup
- Rendering pipeline basics
File: Tutorials/02_ColorsAndMovement.md
Building on the first tutorial:
- Adding vertex colors
- Implementing simple animations
- Time-based movement
- Camera basics
File: Tutorials/03_3DTransformations.md
Introduction to 3D graphics:
- Understanding transformation matrices
- Model, view, and projection matrices
- 3D object positioning and rotation
- Camera movement and control
File: Tutorials/04_TexturesAndMaterials.md
Working with textures:
- Loading textures from files
- UV mapping and texture coordinates
- Material system basics
- Combining textures with lighting
File: Tutorials/05_LightingAndShading.md
Implementing realistic lighting:
- Ambient, diffuse, and specular lighting
- Multiple light sources
- Normal mapping
- Shadow mapping basics
Ensure you have built the engine successfully:
cd Pyramid-Engine
cmake -B build -S .
cmake --build build --config DebugEach example can be run independently:
# Navigate to build output directory
cd build\bin\Debug
# Run specific example
BasicGame.exe
BasicRendering.exeYou can build individual examples:
# Build only BasicGame
cmake --build build --target BasicGame --config Debug
# Build only BasicRendering
cmake --build build --target BasicRendering --config DebugExamples can be disabled during CMake configuration:
# Disable examples to speed up builds
cmake -B build -S . -DPYRAMID_BUILD_EXAMPLES=OFF
# Enable only specific examples (future feature)
cmake -B build -S . -DPYRAMID_BUILD_BASIC_EXAMPLES=ON -DPYRAMID_BUILD_ADVANCED_EXAMPLES=OFFEach example follows a consistent structure:
ExampleName/
├── CMakeLists.txt # Build configuration
├── README.md # Example-specific documentation
├── include/
│ └── ExampleName.hpp # Header files
├── source/
│ ├── ExampleName.cpp # Implementation
│ └── Main.cpp # Entry point
└── assets/ # Example-specific assets
├── shaders/
├── textures/
└── models/
We recommend following this learning path:
- Start with BasicGame: Understand core engine concepts
- Progress to BasicRendering: Learn advanced rendering techniques
- Study the Math Library: Understand the mathematical foundations
- Explore Scene Management: Learn about spatial organization
- Experiment with Physics: Add realistic simulations
- Advanced Topics: Multi-threading, custom shaders, optimization
Problem: Examples crash on startup
Solutions:
- Ensure graphics drivers are up to date
- Verify OpenGL 3.3+ support
- Run from the correct directory (build\bin\Debug)
- Check console output for error messages
Problem: Examples run slowly or stutter
Solutions:
- Build in Release configuration for performance testing
- Update graphics drivers
- Check VSync settings
- Monitor GPU and CPU usage
Problem: Examples fail to compile
Solutions:
- Ensure engine library compiled successfully
- Check CMake configuration
- Verify all dependencies are available
- Clean and rebuild if necessary
We welcome contributions of new examples! To contribute:
- Follow the Standard Structure: Use the established directory layout
- Document Thoroughly: Include comprehensive README files
- Focus on Learning: Ensure examples are educational
- Test Thoroughly: Verify examples work across different systems
- Submit Pull Request: Follow the contribution guidelines
- Example follows standard directory structure
- CMakeLists.txt properly configured
- README.md with clear documentation
- Code is well-commented and educational
- Example builds and runs successfully
- No external dependencies beyond the engine
- Appropriate difficulty level indicated
If you have questions about the examples or suggestions for new ones:
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions and share knowledge
- Discord (Coming Soon): Real-time community support
- Engine Architecture - Understanding the engine design
- API Reference - Detailed API documentation
- Build Guide - Building and configuration
- Contributing Guide - How to contribute to the project
- SceneManagement example
- AdvancedMath demonstration
- Basic physics integration
- Texture and material showcase
- Audio system integration
- Input system demonstration
- Multi-threading examples
- Custom shader gallery
- Performance optimization showcase
- VR/AR examples (when supported)
Stay tuned for updates and new examples as the engine continues to evolve!