Skip to content

Daynlight/Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

198 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Engine

wakatime wakatime

Demos

About

Game Engine with editor and production. Build on top of my library CWindow. Uses ImGui build in CWindow for parameters adjustment and visualization. Focused on full compilation to single executable and Game Engine like editing. With handcrafted assets.

TOC

UI

  • Info
  • Logs
  • Materials Explorer
  • Materials Editor
  • Lights Editor
  • Objects Explorer
  • Objects Editor
  • Asset Loader
  • Shader Explorer
  • Shader Editor
  • Script Explorer
  • Script Editor
    All in Editor mode. Production have turn off ui.

Installation and Usage

  1. Install from Releases
  2. Compile by yourself
  3. Install required programs
  4. Clone repository
    git clone https://github.com/Daynlight/help-me-i-am-under-the-water
  5. Update Submodules
    git submodule update --init --recursive
  6. Compile with CMake
    mkdir -p build/
    cd build/
    cmake -B ..
    cmake --build .
  7. Run program
    ./UnderTheWater/UnderTheWater

Compiling End Product

Use cmake command with PRODUCTION FLAG

mkdir -p build-prod
cd build-prod
cmake -B . -DPRODUCTION=ON -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cd ..
./build-prod/bin/UnderTheWater

Architecture

Build System

We use cmake for ease of build with git submodules for git packages.

DataSerializer {SINGLETON}

Focuses only on reading and saving. For loading data uses cmrc that bakes assets into executable. Data are stored in binary format for faster access and avoiding parsing. Everything that is baked via cmrc is save in GameData folder. In editor we skips cmrc and use normal fstreams for faster editing.

  • Meshes: Faster to read then Assimp. Saved as multiple files each for one mesh in Assets/Meshes folder each with .msh extension. On load we search for file in this directory with .msh extension. Loaded to Resources saved in UW::Meshes that controls versioning and allows avoiding unordered_map for editor.
  • Shaders: Accessible via Resources. Saved as multiple files in Assets/Shaders folders each folder is one compiled shader with .glsl extension. List of allowed script types is in config.h.
  • Scripts: In DataSerializer saves and loads .cpp script to UI editor. Logic of hot-reloading and compiling to PRODUCTION is in ScriptController and ScriptShared.
  • Lights: World static lights loaded to Resources and compile as SSBO. Single file Lights.lit.
  • Materials: World static materials loaded to Resources and compile as SSBO. Single file Materials.pbr.
  • Objects: World objects loaded to ObjectManager singleton class. Single file Objects.obj.
  • Textures: Textures are a bit different they are accessible in Resources by getTexture() after first time loading they are stored in unordered_map.

Resources {SINGLETON}

Are one point where we are storing [Meshes, Textures, Shaders, Materials, Lights]. For now all are loaded and store to end of app life time but in future we will manage them wisely. Probably base on calls count and free VRAM.

ObjectManager {SINGLETON}

One point where we stores all GameObjects. Inherit from Interface IObjectManager for bridging between script and main app. Allows creation, deletion, and getting GameObjectData via name.
![ Script access to object manager is not full working for now ]!

Logger {SINGLETON}

Is used for logging [info, warn, erro]. Logs are saved in editor.log up to 10000 lines. Can be changed in config. Mainly for debugging detecting errors and work monitoring. Can be used to report bugs. Is inherit by ILogger interface to bridge between script and main app.

App is main entry where we initialize scene and ui for editor. Scene is full rendering pipeline with creation of main framebuffer, shadows framebuffer and applying post-processing. In future we plan adding Scene Controller and swapping between scenes.

Main on scene object that contains GameObjectData and list of scripts. GameObjectData contains [position, rotation, scale, name, mesh, shader, vector of textures, vector of materials, map of parameters]. We use separated struct GameObjectData for bridging between scripts and main app that allows scripts to work on objects. Parameters are variants of predefined types that are easy to edit in editor mode and accessible in script.

UI provides easy editor interface to building scene adding and managing [objects, materials, lights, ...]. In Production Mode it is turn off.

  • Info: Basic info about [fps, selected camera, ...]. Buttons turn turn on/off [Mesh Mode, Terrain, Post-Processing, ...].
  • Logs: Allows monitoring operations and changes.
  • Materials Explorer: Selecting, Removing, Adding Materials.
  • Materials Editor: Editing PBR parameters for current chosen Material.
  • Lights Editor: Adding, Removing Lights. Editing Color, Position, Strength.
  • Objects Explorer: Allows adding, removing, duplicating objects. And selecting for editing in editor.
  • Objects Editor: Allows setting object [position, scale, size, textures, materials, scripts, parameters].
  • Asset Loader: Allows adding and selecting materials, meshes from files. Uses Assimp and saves as custom binary format.
  • Shader Explorer: Allows refreshing and opening shader editors.
  • Shader Editor: Multiline text editor for shader with auto reloading.
  • Script Explorer: Allows opening script editors.
  • Script Editor: Multiline text editor for scripts after 5 seconds auto saved to file then hoy-reloaded by ScriptController by objects. ![ Preferred to use external editor ]!

Scripts in editor mode are hot-reloaded by last-time-write that allows ease of editing. Each object have it own script bind. Scripts are accessible by name and stored in Scripts folder. Temporary editor dlls are created by fork + execvp (Linux) and system (Windows) and stored in Scripts_DLL folder. This scripts are controlled by Script Controller. ScriptShared provides interfaces structures that works as bridge between main App and Script. Uses mainly header files with relative include paths for easier script search and avoiding including whole engine. Script structure is provided by interface GameObjectScriptInterface. For physics use FixedUpdate. In Production mode we are compiling scripts with unique class name and register them to ScriptRegister then we creates each instance by Factory. We access scripts by file name that is provided in Script.
![ Accessing to object-manager is not stable after hot-reload it doesn't updates child objects ]!
![ Compilation of scripts freezes app because for now we don't use threads ]!
![ No separation in Editor mode to play simulation and editing changes are overwrite by scripts ]!

EDITOR MODE

Editor mode provides easy interface to [editing/writing/adding/deleting, ...] [scene, materials, lights, loading assets, ...]. Scripts works on hot-reloading. We adds ImGui ui for editing them.

PRODUCTION MODE

Production is designed to create one executable with no additional files requirement. All Assets in GameData is baked via cmrc. Scripts are compiled and register to main exec soo we don't need any dll's. In Production mode we turn off [script compilation, ui, debug camera, saving in DataSerializer].

Tasks Presentation

Normal mapping

PBR

Quaternion camera

Shadow mapping

Parallel Transport Frames

Underwater skybox

A09 Ray-marched SDF object

B07 Heightmap-based seabed mesh

Writing scripts

![ Docs In Future ]!

Supported Platforms

  • Linux X11
  • Windows

Prerequisites

License

GNU GENERAL v3

Author

  • Daniel Stodulski

TODO

Iteration 1
  • Engine setup
  • Normals
  • Readme.md
  • Materials oo SSBO
  • Lights on SSBO
  • BRDF Shader and PBR
  • Add operator[] to Materials and Lights
  • Lazy loading and auto compile for Materials and Lights SSBO
  • Skybox
  • Terrain with height map
  • Shader Editor GUI
  • cmrc for baking assets
Iteration 2 (7.06.2026)
  • Unified Object system
  • Base Object UI
  • Base Example for Object with all parts.
  • Base Material UI (names)
  • Base Shader UI
  • Pbr serialization
  • lights serialization
  • texture load via cmrc backup from disk
  • Resource refactor as controller of files
  • Backup Plan when loading
  • shader movement to Assets
  • shader reset btn
  • shader save on edit
  • Fix bug on delete material
Iteration 3 (15.06.2026)
  • Mesh serialization.
  • Compile flag for end product PRODUCTION
  • Logger UI
  • Asset loader UI
  • Lights UI
  • Full clean up
  • Full optimization
Iteration 4(19.06.2026)
  • FBO Render to texture
  • Under water fog
  • Quaternion Camera, without gimbal lock.
  • Shadow Mapping
  • SDF ray-marching
  • Parallel Transport Layer
Iteration 5 (25.06.2026)
  • Clean up
  • Scripts Win support
  • Optimization
  • Docs
  • Assets
  • Releases
  • Fix FishMovement
  • Parameters serialization
  • Multiple Scripts seg fault (Scripts)
  • Object Add object issue (Scripts)
  • Object Delete Script (Scripts)
  • Object Duplicate object issue (Scripts)
  • Asset Loader seg fault (Scripts)
  • Info UI Check
  • Log UI Check
  • Materials UI Check
  • Lights UI Check
  • Shaders UI Check
  • Scripts UI Check
  • Object UI Check
  • Asset loader on load terrain break
  • Asset loader multiple meshes corrupts
  • Asset loader materials didn't import or missing materials
  • Asset Loader UI Check
Iteration 6 (02.07.2026)
  • Single compilation of scripts.
  • Editor mode load from folder instead of cmrc.
  • Scripts param auto reload.
  • Script on off btn.
  • Script runtime simulation and edit.
  • Scripts runtime copy.
  • Script async compile.
  • objects_manager for scripts.
  • No Scripts blocks edibility issue with copy_game_object_data.
  • GlobResource script shared.
  • GlobResource Window title, vsync, fixed_hz.
  • GlobResource keyevents, mouseevents.
  • Resources properties ui.
  • SharedScripts added proper folder via save in cmrc.
  • Project as GameData and Scripts in folder.
  • Scripts on windows.
🌟Iteration 7🌟
  • Game data backup.
  • Move terrain, water, skybox to object_register vector.
  • Shaders uniform parameters ui.
  • Add Texture Serializer.
  • Last Time Write sync.
  • Fix pre_size size error.
corrupted size vs. prev_size while consolidating
Aborted (core dumped)
  • Fix issue
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create
Aborted (core dumped)
  • Fix issue
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create
Aborted (core dumped)
  • Window Data Serialization move in different file then imgui.ini.
  • Simpler glm in script shared.
  • Clean up.
  • Viewport ui.
  • Rule of 5.
  • Debug Camera and Game Camera. Game Camera as game object specified in GlobConf.
  • Production optimization.
  • Optimization for Compile version (avoid maps).
  • Docs.
Planed in Future
  • Multiple Scenes.
  • Viewport mode for editing and gameplay.
  • Optimization for Production.
  • Production BTN.
  • Full access to render engine from scripts.
  • Components base GameObjects.
  • UI Module for games.
  • Networking.
  • All entities on scene are Objects.
  • Object Tree.
  • Multi threading.
  • Physics Engine.
  • Audio Engine.
  • Animations.
  • Particle system.
  • Better UI.
  • Texture UI.
  • Mesh UI.
  • Build in meshes, scripts, textures, ...
  • Separate to multiple projects.
  • Support for clang, msvs.
  • Editor Debug with movement.
  • Editor mode and runtime.
  • Events with Ctrl + Z / Ctrl + Y.
  • Windows Scripts optimization.

About

Game Engine with editor and production. Build on top of my library CWindow. Uses ImGui build in CWindow for parameters adjustment and visualization. Focused on full compilation to single executable and Game Engine like editing. With handcrafted assets.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors