Scion2D is a lightweight, educational 2D game engine built with the goal of learning by doing ๐ง ๐ก. It's part of my journey to understand game development from the ground up โ and share everything I learn through my YouTube channel ๐บโจ.
This engine isnโt meant to compete with big names like Unity or Godot โ and thatโs okay!
Itโs about exploring, building, breaking things, and growing as a developer ๐.
Whether you're here to learn alongside me, peek at the source, or just curious about making your own engine, welcome! ๐
๐ Why Scion2D?
- โ Made with โค๏ธ for education
- ๐ Teach what I learn, and learn what I teach
- ๐ฎ Build real 2D games from scratch
- ๐ฌ Collaborate, share ideas, and grow together
โ ๏ธ Active Development Notice: This engine and editor are currently under active development. The documentation is still a work in progress and will not be up to date. Scion2D Docs
- Cross-Platform: Builds on Windows and Linux. Currently Mac is not supported.
- Modern C++20: Use of modern c++ standards and functionality.
- Integrated Tilemap Editor: Ability to create tilemaps, create game objects, and more.
Requires CMake 3.26 and vcpkg
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.bat -disableMetrics
VCPKG_ROOT=[path_to_vcpkg]
VCPKG_DEFAULT_TRIPLET=x64-windows
-
Windows
Add the following line in your Path environnment variable:
<path_to_vcpkg_installation_folder>
Open a terminal and type the following:
vcpkg integrate install vcpkg integrate powershell
-
Linux
Edit your profile's bashrc file:
nano ~/.bashrc
Add the following lines at the end:
export PATH=<path_to_vcpkg_installation_folder>:$PATH export VCPKG_ROOT=<path_to_vcpkg_installation_folder> export VCPKG_DEFAULT_TRIPLET=x64-linux
Apply changes:
source ~/.bashrc
Open a terminal and type the following:
vcpkg integrate install vcpkg integrate bash
- Windows
vcpkg install fmt glm entt glad soil2 sdl2 sdl2-mixer[mpg123] lua sol2 stb tinyfiledialogs rapidjson libzippp
- Linux[debian based]
sudo apt install python-jinja2 autoconf automake libtool pkg-config libibus-1.0-dev
- if[Xorg]
sudo apt install libx11-dev libxft-dev libxext-dev
- if[Wayland]
sudo apt install libwayland-dev libxkbcommon-dev libegl1-mesa-dev
- Optional but good practice
sudo apt install build-essential
vcpkg install fmt glm entt glad soil2 sdl2[alsa] sdl2-mixer[mpg123] lua sol2 stb tinyfiledialogs rapidjson libzippp
- if[Xorg]
- ImGui Docking and SDL2-Binding
- It seems like the
ImGui[sdl2-binding]
no longer exists in vcpkg. Also the currentImgui[docking-experimental]
does not seem to be up to date either. - For now, we grabbed the latest from the docking imgui branch and build with the editor. I have added the necessary files under the thirdparty folder.
- These should already be setup in cmake.
- Will move back to using vcpkg bindings once the correct version is available.
- It seems like the
- Box2d Install
- There has been a huge change in the latest box2d that is a breaking change to our codebase.
- We are using Box2D 2.41, the latest 3.1, uses a C-API that is done in a completely different way.
- Eventually we are going to have to update the code to support the latest; however, we currently have a work around.
- Please see the
Readme.md
file here SCION_PHYSICS for the workaround steps.
git clone https://github.com/dwjclark11/Scion2D.git
cd Scion2D
cmake -S . -B build
- Also, in the main.lua file for the editor, comment out the loaded assets and files that don't exist. They will just error out.
Note: this requires a graphics adapter with OpenGL version >= 4.3 capabilities.
In Scion2D/CMakeLists.txt:
- Set the variable
SCION_OPENGL_DEBUG_CALLBACK
toON
. - Optionnaly, set the variable
SCION_OPENGL_DEBUG_FORWARD_COMPATIBILITY
toON
in order to enable warnings about deprecated OpenGL functions.
Activate the debugger in your code as soon as you have a valid OpenGL context made current:
-
SCION_RENDERING::OpenGLDebugger::init()
. -
Optionnaly, you can opt out a list of warning wy doing the following:
std::vector<unsigned int> ignore{ 1281, 131169, 131185, 131204, 31218 }; SCION_RENDERING::OpenGLDebugger::init( ignore );
-
To allow the debugger to break, call
SCION_RENDERING::OpenGLDebugger::breakOnError( true/false )
and/orSCION_RENDERING::OpenGLDebugger::breakOnWarning( true/false )
. -
To ignore a specific warning, call
SCION_RENDERING::OpenGLDebugger::push( Id )
. -
To reinstate, call
SCION_RENDERING::OpenGLDebugger::pop( Id )
. -
To set the severity level, call
SCION_RENDERING::OpenGLDebugger::setSeverityLevel( SCION_RENDERING::OpenGLDebuggerSeverity::Disable/Notification/Low/Medium/High )
.
In Scion2D/CMakeLists.txt:
- Set the variable
SCION_OPENGL_FORCE_DISCRETE_GPU
toON
. Note: Ids can differ between platforms or drivers. Note for linux users: this is currently working only on nVidia GPUs.
Platform | Compiler | Status |
---|---|---|
Windows | MSVC 2019+ | โ Fully Supported |
Windows | MinGW/GCC | ๐ง To be tested |
Linux | GCC 10+ | โ Partially Supported |
Linux | Clang 12+ | ๐ง To be tested |
This project is licensed under the MIT License - see the LICENSE file for details.
This project would not be possible without the help of all the contributors, the motivation to keep working forward through the wonderful comments and supporters from my YouTube Channel. Also from all the wonderful open source projects that I have been able to use in the creation of the engine.
Check out these amazing open source projects that we are using in the engine. Make sure to give them all a star! for all of their amazing work.
- EnTT - Fast and reliable Entity Component System.
- SDL2 - a cross-platform library that provides an abstraction layer for computer multimedia hardware components.
- SDL_mixer - An audio mixer that supports various file formats for Simple Directmedia Layer.
- Dear ImGui - Immediate mode GUI for C++.
- Box2D - 2D physics engine for games.
- GLM - Mathematics library for graphics software.
- RapidJSON - Fast JSON parser and generator.
- sol2 - C++ Lua binding library.
- stb - Single-file public domain libraries.
- Lua - Powerful, efficient scripting language.
- tinyfiledialogs - Cross-Platform Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE Official.
- Libzippp - C++ wrapper around the libzip library.
Thank you to all the contributors and maintainers of these projects! โค๏ธ