BlueDragonEngine is a programmer-first game engine. It uses brand new C++20 language features and uses several other open source libraries to achieve its goals.
Downloading | Building | Usage | Dependencies
Currently (until there are releases), the only useful way to download the engine is by using Git.
cd <where-ever you want to dowload to>
git clone --recurse-submodules https://github.com/drako0812/BlueDragonEngine
cd BlueDragonEngine
Currently, I only have build instructions for Visual Studio 2019 on Windows 10.
This engine uses Vcpkg to handle most of its dependencies, the others are git submodules and should have been aquired automatically in the Downloading step.
So make sure you install Vcpkg using their instructions before proceeding.
-
Open
BlueDragonEngine.sln
in the root folder to open the VS Solution for the engine. -
Select the Solution Configuration (either Debug or Release).
-
Select
Build->Build Solution
to build the engine. -
Wait.
-
Profit 😜
There should be a
BlueDragonEngineLib.lib
file in<project root>/x64/<Debug or Release>/
. Currently, the Debug version of the engine is over 100 MiB and the Release version is over 70 MiB. I will investigate if there are ways to shrink that down.
COMING SOON
I think the easiest way currently to get set up is to just add a project to the engine's Solution (<root>/BlueDragonEngine.sln
).
Since this engine uses very cutting-edge C++20 features (namely, modules) and it doesn't hide away all of its dependencies through abstraction layers yet, there is a bit of configuration to making a project work with the engine.
NOTE: Hopefully this process will become simpler as the project (as well as the compilers) mature.
-
First, make a new project (I'd go with a C++ Windows Console project for easiest integration).
-
Open up the property pages for the new project. Ensure that
Configuration
is set toAll Configurations
andPlatform
is set toAll Platforms
. -
Go to
General
- Change
C++ Language Standard
to/std:c++latest
- Change
C Language Standard
to/std:c17
(This might not be neccessary)
- Change
-
Go to
vcpkg
- Make sure
Use Vcpkg
,Use Vcpkg Manifest
,Install Vcpkg Dependencies
, andUse AutoLink
are all set toYes
.
- Make sure
-
Go to
C/C++ -> General
- Set
Additional Include Directories
is$(SolutionDir)extern\raylib-nuklear\include;%(AdditionalIncludeDirectories)
- Set
Scan Sources for Module Dependencies
toYes
- Set
-
Go to
C/C++ -> Preprocessor
- Add
SOL_ALL_SAFETIES_ON=1
andSOL_USING_CXX_LUA=1
toPreprocessor Definitions
- Add
-
Go to
C/C++ -> Language
- Set
Enable Experimental C++ Standard Library Modules
toYes
- Set
-
Save the changes to the properties and close the window.
-
Add the file
vcpkg.json
to your project -
Fill in at least the following contents into that JSON file:
{ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "name-of-project", "version": "0.1.0", "dependencies": [ { "name": "raylib", "features": [ "use-audio" ] }, "tomlplusplus", "nuklear", { "name": "lua", "features": [ "cpp" ] }, "sol2" ] }
Be sure to change
name
to whatever your project will be called. And changeversion
to whatever the version of your project is. Be aware that there are rules to how to name your project in avcpkg.json
manifest. Consult the Vcpkg documentation for those rules. -
Right click on your project in the Solution Explorer then select
Add -> Reference...
-
In
Projects -> Solution
selectBlueDragonEngineLib
(check the checkbox) and clickOK
. -
You're basically ready to go, now. But to get you started here's a couple bare-bones examples for your program:
-
#include "raylib-nuklear.h" #include <toml++/toml.h> #include <sol/sol.hpp> #include "bde.export.hpp" import bde.base; import bde.errors; import bde.engine; import <string>; import <vector>; import <iostream>; int main(int argc, char * argv[]) { return bde::Engine()(argc, argv).HandleError(); }
This doesn't do really anything than open an empty window.
-
#include "raylib-nuklear.h" #include <toml++/toml.h> #include <sol/sol.hpp> #include "bde.export.hpp" import bde.base; import bde.errors; import bde.engine; import <string>; import <vector>; import <iostream>; class ExampleEngine : public bde::Engine { public: virtual ~ExampleEngine() override { // Put any cleanup code here. } virtual bde::Result OnStartup(std::vector<std::string> const & args) override { // This is called before the Engine is entirely online // Process the command-line arguments in `args` here. return { .Type = bde::ResultType::Success }; } virtual void OnLoad() override { // Add code to perform when loading the Engine here. } virtual void OnUpdate() override { if (nk_begin(NuklearGUI, "BlueDragonEngine Example", nk_rect(256, 256, 400, 300), 0)) { nk_layout_row_dynamic(NuklearGUI, 0, 3); nk_label(NuklearGUI, "Hello World!", NK_TEXT_LEFT); if (nk_button_label(NuklearGUI, "Okay")) { TraceLog(LOG_INFO, "Pressed Okay!"); } if (nk_button_label(NuklearGUI, "Cancel")) { TraceLog(LOG_INFO, "Pressed Cancel!"); } } nk_end(NuklearGUI); // Add code to update game state every frame here. } virtual void OnRender() override { DrawCircle(128, 128, 128, YELLOW); // Add code to render game visuals every frame here. } virtual void OnShutdown() override { // Add code that should be ran when shutting down the game but still needs the Engine active. } }; int main(int argc, char * argv[]) { return ExampleEngine()(argc, argv).HandleError(); }
This demonstrates some usage of the Nuklear immediate-mode GUI library as well as Raylib. It also shows all the current customization points to the engine.
-
Once again, all the dependencies should be acquired automatically either through the git clone
command or when building utilizing Vcpkg.
- Raylib is the backbone of this engine. It's used for everything from managing the window to displaying graphics and handling audio.
- Nuklear is used for GUI purposes in the engine.
- raylib-nuklear is used as the glue between Raylib and Nuklear.
- toml++ is used for working with TOML configuration files.
- Lua is used for scripting-language purposes.
- Sol is used for glueing together the engine and Lua.