Skip to content

m1dsolo/game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++23 SDL3 ECS game framework

license

Table of Contents

Introduction

A lightweight, modern game development framework built with C++23 and SDL3, designed around the ECS(Entity Component System) architecture. This repository includes two parts:

  • Core Framework (core): Provides ECS and SDL3 utilities for game development.
  • Survivor (survivor): A top-down survivor-style game built on the core framework.

Survivor demo preview:

survivor-0.1.2.mp4

project structure:

game/
├── core/                   # Core ECS Framework
│   ├── include/core/       # Public headers (ECS, AssetManager, RenderManager)
│   ├── src/                # Framework implementation
│   ├── assets/             # Framework assets (fonts, animation finite state machine)
│   └── third_party/        # Dependencies
│       ├── ecs/            # My simple ECS framework
│       ├── wheel/          # My utility library (Log, Timer, QuadTree, etc.)
│       ├── sdl/            # My OO wrapper for SDL3, SDL3_image, SDL3_mixer, SDL3_ttf
│       └── reflect-cpp/    # C++20 reflection library
├── games/                  # Game Projects
│   └── survivor/           # Demo: 2D Top-down survivor game
│       ├── src/            # Game logic (player, enemies, level design)
│       └── assets/         # Game assets (configs, sprites, animations, sounds, music)
├── editor/                 # Game Editor (TODO)
└── LICENSE                 # MIT License

Features

  • Modern C++23: Leverages latest standards for clean, efficient code.
  • SDL3 Integration: Hardware-accelerated rendering, audio, input handling, and window management.
  • ECS Architecture: Decoupled entity-component logic for scalable, maintainable game code

Quick Start

Prerequisites

  • C++ compiler: need C++23 support. (e.g., g++ or clang++)
  • cmake: ninja is recommended for faster builds.
  • git: for cloning the repository and submodules.

Note: This project has been tested on Arch Linux. For Windows/macOS, minor modifications to CMakeLists.txt may be required.

Survivor Game

  1. clone the repository
git clone --depth=1 https://github.com/m1dsolo/game.git
cd game
git submodule update --init --depth=1
cd core/third_party/sdl/third_party
git submodule update --init --depth=1 
cd -
  1. build the project
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8
  1. launch the Survivor game
cd build/games/survivor
./survivor

Game Controls:

Action Keyboard Gampad
Menu Navigation W/S D-Pad Up/Down
Character Movement WASD Left Stick
Open Pause Menu ECS Start Button

Core Framework

To build your own game with the core framework: Create a new game directory under ./games (e.g., ./games/your_game). Add a CMakeLists.txt to your game folder, linking against the core framework:

add_executable(your_game src/main.cpp src/Player.cpp src/Enemy.cpp)

target_link_libraries(your_game PRIVATE core)

Re-run the build commands (Step 2 above) to compile your game. Refer to Survivor's CMakeLists.txt for a complete example.

Credits

Sprites:

Sounds:

Repositories:

License

MIT © m1dsolo

About

c++23 SDL3 ECS game

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published