From cd0c08dc7ce754473178ad3f32f7740a1dddc1eb Mon Sep 17 00:00:00 2001 From: Vaino Kauppila Date: Thu, 2 Jul 2026 22:58:25 +0300 Subject: Initial import: LibreForts (M0-M5 in progress) Open-source Forts clone: custom C++20 engine + data-driven (Lua) 2D physics artillery RTS. - Building: node/strut graph on a stiff mass-spring solver (canon Forts model), triangulation rigidity, axial + 30-degree angle-stress breaking, cascading collapse, fire (DoT + spread), ground destroys debris. - Weapons (M4): cannon (ballistic) + laser (beam/ignite) with select-and-aim-in- arc UX; splash / beam damage; bg-brace passthrough. - Devices + economy (M5): reactors + win/loss + restart, mines/turbines/battery, metal deposits, storage caps, per-shot energy cost. - Data-driven via Lua/sol2 with a layered mod loader; enemy-fort scenario mod. - Renderer: SDL3 + textures + ImGui dev UI. stb_image + ImGui vendored. - Assets: CC0 placeholders only; real game art loaded at runtime from the user's own install via forts: paths (bring-your-own; nothing copyrighted committed). See README.md / CLAUDE.md and research/ + requirements/ for detail. --- src/engine/script.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/engine/script.hpp (limited to 'src/engine/script.hpp') diff --git a/src/engine/script.hpp b/src/engine/script.hpp new file mode 100644 index 0000000..8008ded --- /dev/null +++ b/src/engine/script.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +// Thin wrapper around a sol2 Lua state. This is the engine's scripting seam: +// data files (materials, later weapons/devices) are Lua, loaded on top of each +// other so mods can extend or override the base tables. +class ScriptEngine { +public: + ScriptEngine(); + + sol::state& lua() { return lua_; } + + // Run a Lua file in the shared state. Returns false and logs on error + // (errors are caught, never thrown out, so a bad mod can't crash the game). + bool run_file(const std::string& path); + +private: + sol::state lua_; +}; -- cgit v1.3