Skip to content
/ game Public

A Simple Game Based on ECS and SDL3, Written in C++23

License

Notifications You must be signed in to change notification settings

m1dsolo/game

Repository files navigation

A Simple Rougelike Game

(I haven't thought of a name for this game yet.)

license

Language

Table of Contents

Introduction

Demo:

game_v0.1.2.mp4

This is a simple rougelike game developed based on SDL3 and my ECS framework.

This game is a 2D top-down rougelike survivor roguelike. The objective is to survive through endless waves of enemies. Before each wave starts, you need to upgrade the enemies. Then you have half a minute to survive the relentless attacks of the enemies. During this time, you can upgrade yourself, collect resources, and establish powerful defensive structures.

Since the game is based on highly scalable ECS framework, and the main game information can be configured through JSON, you can easily add more monsters, items, and modify the AI, etc.

Features

The project used the following technologies:

  • ECS(Entity-Component-System) architecture, providing highly reusable modules and efficient execution speed
  • QuadTree to accelerate collision detection
  • SceneGraph to manage the logical relationship between objects and the rendering order
  • BehaviorTree to manage the AI Logic of enemies and defense towers
  • Lazy Theta* pathfinding algorithm, providing smoother movement compared to A*
  • JSON is used to configure game settings, monster information, item information, upgrade rewards, monster upgrade information, behavior tree, etc.

ECS, QuadTree and other modules primarily rely on my wheel library. Refer to the library's documentation for more details.

Install

This project is written in C++23 and built using CMake. It has only been tested on my own computer (Arch Linux). If you use another operating systems, you may need to modify CMakeLists.txt to meet your requirements.

  1. clone project
git clone --depth=1 https://github.com/m1dsolo/game.git
cd game
git submodule update --init --depth=1
  1. build
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j4
  1. run
./build/game

Usage

The game controls are as follows:

  • Movement
    • WASD to move the character
  • Combat
    • LeftMouse to shoot if you have a gun selected
    • R to reload the gun if you have one selected
    • Space to use consumables if you have one selected
    • F to flash
    • G to drop selected item
  • Hotbar
    • 1, 2, 3, etc. to select items
    • QE to cycle through items
    • hold LeftMouse to swap items
  • Menu
    • ESC to show the exit menu
      • 1 to quit
      • 2 to resume
    • I to switch inventory menu
      • same as hotbar controls

License

MIT © m1dsolo

About

A Simple Game Based on ECS and SDL3, Written in C++23

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published