diff options
| author | Vaino Kauppila <vaino@vke.fi> | 2026-07-02 22:58:25 +0300 |
|---|---|---|
| committer | Vaino Kauppila <vaino@vke.fi> | 2026-07-02 23:47:07 +0300 |
| commit | cd0c08dc7ce754473178ad3f32f7740a1dddc1eb (patch) | |
| tree | 589c676b41d6f3d322ea5ce339ddb0811f29ec31 /data/materials.lua | |
| download | forts_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 'data/materials.lua')
| -rw-r--r-- | data/materials.lua | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/data/materials.lua b/data/materials.lua new file mode 100644 index 0000000..a2f876c --- /dev/null +++ b/data/materials.lua @@ -0,0 +1,62 @@ +-- Base building materials for the clone. +-- +-- The engine reads the global `Materials` array (in order). Build modes 1/2/3 +-- map to entries 1/2/3. Mods under data/mods/ run AFTER this file and may use +-- FindMaterial(name) to tweak these, or table.insert(Materials, ...) to add new +-- ones. (angle_threshold is in DEGREES; the engine converts to radians.) + +Materials = +{ + { + name = "wood", + stiffness = 600, damping = 12, mass = 0.25, + max_compression = 0.90, max_expansion = 1.10, -- snaps past +/-10% length + angle_threshold = 30, tension_only = false, -- snaps if a loose strut rotates >30deg + min_length = 0.4, max_length = 3.0, max_link_length = 6.0, -- single-strut size limits + hit_points = 150, + flammable = true, burn_rate = 15, spread_time = 2.0, -- wood: slow burn/spread + blocks_projectiles = true, blocks_beam = true, -- solid: stops shells & beams + half_width = 0.15, + color = { 1.0, 1.0, 1.0, 1.0 }, -- white = show texture untinted + texture = "data/textures/wood.png", + }, + { + name = "bgbrace", -- background bracing + stiffness = 600, damping = 12, mass = 0.25, + max_compression = 0.92, max_expansion = 1.08, + angle_threshold = 30, tension_only = false, + min_length = 0.4, max_length = 3.0, max_link_length = 6.0, + hit_points = 100, + flammable = true, burn_rate = 22, spread_time = 0.7, -- burns ~3x faster than wood + blocks_projectiles = false, blocks_beam = false, -- shells AND beams pass through (beam still burns it) + half_width = 0.15, + color = { 1.0, 1.0, 1.0, 0.45 }, -- translucent + texture = "data/textures/bgbrace.png", + }, + { + name = "rope", + stiffness = 150, damping = 8, mass = 0.05, + max_compression = 0.0, max_expansion = 1.50, -- slack in compression, snaps at +50% + angle_threshold = 360, tension_only = true, -- never snaps on angle + min_length = 0.8, max_length = 1.5, max_link_length = 20.0, -- subdivides into many segments -> drapes + hit_points = 50, + flammable = true, burn_rate = 25, spread_time = 1.0, -- burns through fast + blocks_projectiles = false, blocks_beam = false, -- shells AND beams pass through + half_width = 0.04, + color = { 0.15, 0.12, 0.10, 1.0 }, + }, +} + +-- Helpers mods can use (mirrors the Forts modding API shape). +function IndexOfMaterial(name) + for i, m in ipairs(Materials) do + if m.name == name then return i end + end + return nil +end + +function FindMaterial(name) + local i = IndexOfMaterial(name) + if i then return Materials[i] end + return nil +end |
