Nodens
A C++23 framework for building interactive desktop applications quickly, with optional Dear
ImGui. Everything is a C++ module, so an app starts with import nodens; and links
one static library.
Writing an app
- An app inherits from
Nodens::Application, pushes one or more layers, and callsRun(). Every frame, each layer receivesOnUpdate(TimeStep)andOnImGuiRender(TimeStep), and input events routed down the stack arrive inOnInputEvent. - Three examples ship with it:
circularwave3d(live 2D/3D plots with ImPlot and ImPlot3D),planetaryscan(the event bus and task system working together) andheadlesspulse(a loop with no window). - CMake builds every dependency from source, so there is nothing to install by hand.
- 01 · Modules
Module-first
Public APIs are C++ module interfaces (
.cppm). Third-party headers stay in the global module fragment, so an app only ever writesimport nodens;. - 02 · Delivery
One static library
The framework builds into a single static library, so the final product is one portable executable.
- 03 · Platform
Linux, on purpose
The validated environment is Arch Linux. Native Windows and macOS builds are not supported.
How an app is organised
A few ideas carry most of an app. The guide goes deeper into each.
- 01 · Layers
Your app is a stack of layers
A layer is a self-contained piece of the app: a simulation, a plot window, a debug panel. Each one sets itself up when it is added, reacts to input, updates every frame, draws its own interface, and cleans up when it is removed. Overlays such as the ImGui layer always draw on top.
- 02 · Events
Two ways to send a message
Input and window events travel down the layers until one handles them. Events you define yourself go through an event bus: handled immediately, or queued and delivered once per frame on the main thread.
- 03 · Tasks
Heavy work off the main thread
Simulation and data processing run on worker threads, and a finished task reports back through a queued event or a future. The main thread receives the result, so handlers never need locks of their own.
- 04 · Profiling
Tracy built in
Add
ZoneScopedto any function to see it in Tracy, including lock contention between workers and GPU timings on Vulkan. - 05 · Loop
A window is optional
Set the presentation to a window with ImGui, a window alone, or headless. The same loop runs the layers either way, and a layer can end it. Frame time is variable by default; fixed mode runs constant steps, which suits simulations.
Where it comes from
Nodens began as a personal project for my undergraduate Computer Graphics course at UFMG. Its foundations follow the early episodes of The Cherno's Game Engine series, and earlier iterations powered several of my academic projects, including boids and galaxians. Versions of it also ran the numerical simulation applications from my research, which are on my portfolio.
Examples
All three ship in the repository under examples/.
| Example | Shows |
|---|---|
circularwave3d |
The immediate-mode GUI, with live 2D and 3D plots from ImPlot and ImPlot3D |
planetaryscan |
The event bus and task system together, with thread-safe data collection and a live scatter plot |
headlesspulse |
A loop with no window, ended by a layer, with fixed-step pacing as an option |
Get started
References
- The Cherno. (n.d.). Game engine series [Video playlist]. YouTube. http://www.youtube.com/playlist?list=PLlrATfBNZ98dC-V-N3m0Go4deliWHPFwT
- Gregory, J. (2019). Game engine architecture (3rd ed.). CRC Press.
- Horton, I., & Van Weert, P. (2023). Beginning C++23: From beginner to pro. Apress. https://doi.org/10.1007/978-1-4842-9343-0