1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# LibreForts
Open-source clone of Forts, a 2D physics artillery RTS. Custom C++ engine,
content driven by Lua. Work in progress. See CLAUDE.md for details.
## Stack
C++20, Meson/Ninja, SDL3, Dear ImGui, a custom mass-spring physics solver,
Lua 5.4 with sol2, and stb_image. Box2D is linked but idle; bgfx, SoLoud, ENet
and EnTT are planned but not yet wired up.
## Build and run
### Container (reproducible, any distro)
The `Makefile` wraps the Podman workflow. Run it from the repo root:
```sh
make image # one-time, and after editing Containerfile
make run # compile in the container, then launch on the host
```
| Target | What it does |
|---|---|
| `make build` | compile in the container (default; configures on first use) |
| `make run` | compile, then run the game on the host |
| `make check` | compile + validate the Lua data |
| `make reconfigure` | re-run `meson setup` after editing `meson.build` |
| `make shell` | interactive shell in the dev container |
| `make clean` / `make clean-image` | remove `builddir/` / the dev image |
The container builds every dependency into `/usr/local` and links Lua
statically, so the resulting binary runs on any host. Compilation happens in the
container, but the game runs on the host, which supplies SDL3 and a display;
`make run` handles both halves. Run from the repo root either way, since `data/`
is resolved relative to the working directory.
### Local (Arch Linux)
`meson.build` falls back to system packages, so a native build only needs the
libraries the code actually uses. bgfx, SoLoud, ENet and EnTT are part of the
planned stack but not yet wired up, so they are not required to build.
The `make` targets above all go through Podman, so a native build drives meson
directly. (`make check-lua` is the exception: it runs on the host and works
either way.)
```sh
# repo packages
sudo pacman -S --needed meson ninja gcc pkgconf sdl3 lua54 glm box2d
# sol2 (header-only Lua bindings) from the AUR, e.g. with an AUR helper
paru -S sol2 # or: yay -S sol2
meson setup builddir
meson compile -C builddir
./builddir/forts-clone # run from repo root
```
Native builds link Lua dynamically against the system `lua54`, which is fine
when you build and run on the same machine.
## Assets
The repo ships CC0 placeholders only. If you own Forts, real textures load at
runtime from your install via `forts:` paths (set `$FORTS_DATA`). Nothing
copyrighted is stored here. Forts is copyright EarthWork Games.
|