Skip to content

ymehili/rtype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

489 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rtype - Custom Game Engine with R-Type Clone

A custom game engine featuring a networked 4-player R-Type clone implementation.

Version: 1.0.0 Author: EPITECH Team

CI Build and Test Sanitizer Builds


Overview

rtype is a 7-week academic project delivering a custom game engine with networked multiplayer capabilities, demonstrated through a 4-player R-Type clone. The engine follows Hexagonal Architecture (Ports & Adapters pattern) with custom implementations of core systems:

  • Custom ECS (Entity Component System) with sparse set storage
  • Custom UDP networking stack with client-side prediction
  • Custom 3D math library (Vector2/3/4, Matrix4, Quaternion)
  • SFML integration for graphics, audio, and input (adapter layer only)

Features

  • Hexagonal Architecture: Clean separation between domain logic and frameworks
  • Custom Core Systems: ECS, networking, math library (no external game engines)
  • Client-Side Prediction: Server-authoritative multiplayer with snapshot optimization
  • Cross-Platform: Linux (Ubuntu 22.04+, Fedora 38+) primary, Windows (MSVC) stretch goal
  • Modern C++17: Stable language standard with broad compiler support
  • Build Performance: Full rebuild < 5 minutes, incremental build < 30 seconds

Prerequisites

Required Tools

Linux (Ubuntu 22.04+ / Fedora 38+):

Ubuntu/Debian:

sudo apt update
sudo apt install -y \
  cmake \
  g++-10 \
  git \
  ninja-build

Fedora:

sudo dnf install -y \
  cmake \
  gcc-c++ \
  git \
  ninja-build

Minimum Versions

  • CMake: 3.20+ (cmake --version)
  • GCC: 10+ or Clang: 12+ (g++ --version or clang++ --version)
  • Git: 2.30+ (git --version)

Dependencies

All dependencies are automatically downloaded via CPM (CMake Package Manager) - no manual installation required:

  • SFML 2.6.1: Graphics, Audio, Window, Input (adapter layer only)
  • Google Test: Unit testing framework (main branch)
  • nlohmann/json v3.11.3: JSON parsing for config and level files

Custom implementations (NO external dependencies):

  • ECS (Entity Component System) - Custom sparse set storage
  • UDP Networking - Custom reliability layer with binary protocol
  • 3D Math Library - Vector2/3/4, Matrix4, Quaternion
  • Logging - Custom thread-safe logger with levels

Build Instructions

1. Clone Repository

git clone https://github.com/EpitechPGE3-2025/G-CPP-500-LYN-5-2-rtype-9.git
cd rtype

2. Configure Build

Using Make (default):

cmake -B build -DCMAKE_BUILD_TYPE=Release

Using Ninja (faster builds):

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release

Debug build (with assertions, no optimizations):

cmake -B build -DCMAKE_BUILD_TYPE=Debug

Optional: Use CPM source cache (speeds up rebuilds, recommended for team development):

export CPM_SOURCE_CACHE=$HOME/.cache/cpm
cmake -B build -DCMAKE_BUILD_TYPE=Release

Add to ~/.bashrc or ~/.zshrc for persistence:

echo 'export CPM_SOURCE_CACHE=$HOME/.cache/cpm' >> ~/.bashrc

3. Build Project

Parallel build (recommended):

cmake --build build -j$(nproc)

Single-threaded build:

cmake --build build

4. Run Tests

Run all tests:

cd build && ctest --output-on-failure

Or directly:

./build/bin/rtype_tests

5. Run Executables

Server:

./build/bin/r-type_server

Client:

./build/bin/r-type_client

Build Targets

Target Type Description Dependencies Output
rtype_engine Static Library Core engine library (domain, adapters, application) nlohmann/json build/lib/librtype_engine.a
r-type_server Executable Headless server (no SFML graphics) rtype_engine, SFML System build/bin/r-type_server
r-type_client Executable Client with SFML graphics/audio/window rtype_engine, SFML (all modules) build/bin/r-type_client
rtype_tests Executable Google Test suite (placeholder tests) rtype_engine, Google Test build/bin/rtype_tests

Project Structure

rtype/
├── CMakeLists.txt                    # Root CMake configuration
├── cmake/                            # CMake utility modules
│   ├── CPM.cmake                     # CPM v0.42.0 package manager
│   ├── CompilerWarnings.cmake        # Compiler warning configuration
│   └── Sanitizers.cmake              # ASan/UBSan configuration
│
├── include/rtype_engine/             # Public headers (Hexagonal Architecture)
│   ├── domain/                       # Pure business logic (NO external dependencies)
│   │   ├── core/                     # Custom ECS (Entity, Component, System, ECS registry)
│   │   ├── math/                     # Custom 3D math library (Vector, Matrix, Quaternion)
│   │   ├── physics/                  # Physics engine (collision, spatial grid)
│   │   └── game/                     # R-Type game domain logic
│   ├── ports/                        # Abstract interfaces (IRenderer, INetworkManager, etc.)
│   ├── adapters/                     # Concrete implementations (SFMLRenderer, UDPSocket, etc.)
│   ├── application/                  # Orchestration layer (Engine, ServerApp, ClientApp)
│   └── utils/                        # Cross-cutting utilities (Logger, Random, Config)
│
├── src/                              # Implementation files
│   ├── domain/                       # Domain implementations (pure C++)
│   ├── adapters/                     # Adapter implementations (SFML, networking)
│   ├── application/                  # Application layer
│   ├── server/                       # Server executable entry point
│   └── client/                       # Client executable entry point
│
├── tests/                            # Test files
│   ├── domain/                       # Unit tests for domain logic
│   ├── adapters/                     # Tests for adapter implementations
│   ├── integration/                  # Integration tests
│   └── mocks/                        # Mock adapters for domain testing
│
├── assets/                           # Game assets
│   ├── sprites/                      # Sprite images (PNG)
│   ├── audio/                        # Audio files
│   │   ├── sfx/                      # Sound effects (WAV)
│   │   └── music/                    # Background music (OGG)
│   └── levels/                       # Level definitions (JSON)
│
└── docs/                             # Documentation
    ├── architecture.md               # Architecture decisions
    ├── prd.md                        # Product requirements
    └── sprint-artifacts/             # Sprint planning and stories

Supported Platforms

Platform Compiler Status Notes
Linux (Ubuntu 22.04+) GCC 10+ ✅ Supported Primary development platform
Linux (Fedora 38+) GCC 11+ ✅ Supported Tested platform
Linux (Ubuntu 22.04+) Clang 12+ ✅ Supported CI validation
Windows (MSVC 2019+) MSVC 🔧 Stretch Goal Part 2 (Week 5-7)

Troubleshooting

CMake Configuration Fails

Error: CMake 3.20 or higher is required

  • Solution: Update CMake via package manager or download from cmake.org

Error: No CMAKE_CXX_COMPILER could be found

  • Solution: Install GCC or Clang: sudo apt install g++ or sudo apt install clang

Build Fails

Error: Failed to download dependency from GitHub

  • Solution: Check network connection. CPM downloads dependencies from GitHub at build time.
  • Workaround: Use CPM_SOURCE_CACHE to cache dependencies locally (see Build Instructions)

Error: Compiler warnings treated as errors

  • Solution: Fix the warning or temporarily disable -Werror in CMakeLists.txt (not recommended)

Build is Slow

Optimization: Use Ninja generator for faster builds:

cmake -B build -G Ninja

Optimization: Enable parallel builds:

cmake --build build -j$(nproc)

Optimization: Use CPM source cache to avoid re-downloading dependencies:

export CPM_SOURCE_CACHE=$HOME/.cache/cpm

Development Workflow

Coding Standards

  • C++ Standard: C++17 (ISO/IEC 14882:2017)
  • Naming Conventions:
    • Files: PascalCase.hpp / PascalCase.cpp
    • Classes: PascalCase (e.g., GameState, PhysicsEngine)
    • Functions: camelCase (e.g., getEntity(), drawSprite())
    • Variables: camelCase (e.g., entityId, deltaTime)
    • Constants: UPPER_SNAKE_CASE (e.g., MAX_ENTITIES, TARGET_FPS)
    • Member variables: camelCase_ with trailing underscore
    • Namespaces: snake_case (e.g., rtype::domain::core)
  • Header Guards: Use #pragma once
  • Compiler Warnings: -Wall -Wextra -Werror enabled (zero-tolerance for warnings)

Git Workflow

This project follows a feature branch workflow with pull requests and code reviews. All development happens on feature branches, and changes are merged to the main branch through pull requests after peer review.

Branch Protection:

  • main branch is protected and always stable (deployment-ready)
  • No direct commits to main allowed
  • All changes must go through pull requests
  • Minimum 1 approval required before merge
  • CI must pass before merge

Workflow:

  1. Create feature branch: git checkout -b feature/story-X-Y-brief-description
  2. Make changes and commit with conventional format
  3. Push branch: git push origin feature/story-X-Y-brief-description
  4. Create pull request via GitHub
  5. Wait for review and CI validation
  6. Merge to main after approval

For detailed Git workflow guidelines, see CONTRIBUTING.md.

Team Structure

Project Timeline: 7 weeks (Part 1: Weeks 1-4, Part 2: Weeks 5-7) Team Size: 5 developers Methodology: Agile with 2-week sprints

Roles:

  • Architect/Tech Lead: Architecture decisions, technical design, code review
  • Build Engineer: CMake, CI/CD, package management, build performance
  • Core Systems Developer: ECS, math library, physics engine
  • Network Engineer: UDP protocol, client-side prediction, multiplayer
  • Graphics/Game Developer: Rendering, game logic, SFML integration, R-Type gameplay

Contributing

We welcome contributions from all team members! To contribute:

  1. Read the guidelines: See CONTRIBUTING.md for detailed workflow
  2. Pick a story: Check sprint-status.yaml for available stories
  3. Create feature branch: Follow naming convention (feature/story-X-Y-description)
  4. Implement and test: Write code, add tests, ensure all tests pass
  5. Submit pull request: Create PR, request review, address feedback
  6. Merge: After approval and CI pass, merge to main

Code Review Requirements:

  • Minimum 1 approval from another team member
  • All CI checks must pass (build, tests, static analysis, formatting)
  • Code must follow coding standards (.clang-format, .clang-tidy)

Performance Targets

  • Build Performance:
    • Full rebuild: < 5 minutes on commodity hardware (4-core CPU, 8GB RAM)
    • Incremental build: < 30 seconds (single file change)
  • Runtime Performance:
    • Target: 60 FPS with 1000+ entities (Part 1), 5000-10000 entities (Part 2)
    • Network: < 100ms RTT on good connections, playable up to 200ms

License

This is an academic project developed as part of EPITECH curriculum.


Documentation

  • Architecture: See docs/architecture.md for technical architecture decisions
  • PRD: See docs/prd.md for product requirements

Contact

For questions or issues, contact the development team through the project repository.


Built with CMake | Powered by custom C++17 engine | EPITECH 2025

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors