aboutsummaryrefslogtreecommitdiffstats
path: root/src/game/build_system.hpp
diff options
context:
space:
mode:
authorVaino Kauppila <vaino@vke.fi>2026-07-02 22:58:25 +0300
committerVaino Kauppila <vaino@vke.fi>2026-07-02 23:47:07 +0300
commitcd0c08dc7ce754473178ad3f32f7740a1dddc1eb (patch)
tree589c676b41d6f3d322ea5ce339ddb0811f29ec31 /src/game/build_system.hpp
downloadforts_clone-cd0c08dc7ce754473178ad3f32f7740a1dddc1eb.tar.gz
forts_clone-cd0c08dc7ce754473178ad3f32f7740a1dddc1eb.zip
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.
Diffstat (limited to 'src/game/build_system.hpp')
-rw-r--r--src/game/build_system.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/game/build_system.hpp b/src/game/build_system.hpp
new file mode 100644
index 0000000..0bf615d
--- /dev/null
+++ b/src/game/build_system.hpp
@@ -0,0 +1,32 @@
+#pragma once
+
+// Material types for building.
+enum class Material : int {
+ Wood = 0,
+ Background = 1,
+ Rope = 2,
+ COUNT = 3,
+};
+
+struct MaterialInfo {
+ const char* name;
+ float half_w, half_h; // half-size of placed piece
+ float metal_cost;
+ float energy_cost;
+ float r, g, b; // color
+ float alpha; // 1.0 = opaque, 0.4 = semi-transparent
+ bool blocks_projectiles;
+};
+
+inline MaterialInfo material_info(Material m) {
+ switch (m) {
+ case Material::Wood:
+ return {"Wood", 1.0f, 0.4f, 10.0f, 5.0f, 0.55f, 0.35f, 0.15f, 1.0f, true};
+ case Material::Background:
+ return {"BgBrace", 1.0f, 0.4f, 5.0f, 3.0f, 0.45f, 0.40f, 0.30f, 0.4f, false};
+ case Material::Rope:
+ return {"Rope", 0.0f, 0.0f, 3.0f, 2.0f, 0.15f, 0.12f, 0.10f, 1.0f, false};
+ default:
+ return {"???", 1.0f, 0.4f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, true};
+ }
+}