Added: Initial world generation tool
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the terrain generator (Docs/Terrain.md) to Tools/Terrain/bin/terrain.exe.
|
||||
#
|
||||
# Go is not in the repository and not in the engine's toolchain, so this is the one place that says so out
|
||||
# loud when it is missing. Everything else about the generator is engine-free and needs nothing installed.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT/Tools/Terrain"
|
||||
|
||||
if ! command -v go >/dev/null 2>&1; then
|
||||
echo "build-terrain: no 'go' on PATH." >&2
|
||||
echo " The generator needs a Go toolchain (1.22 or newer, for math/rand/v2). https://go.dev/dl/" >&2
|
||||
echo " Take the windows/amd64 build: a 386 toolchain caps the process near 2 GB, and one float32" >&2
|
||||
echo " field at the full 7141 grid is 204 MB, of which the detail passes hold several at once." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "go $(go version | awk '{print $3}' | sed 's/^go//') ($(go env GOOS)/$(go env GOARCH))"
|
||||
if [ "$(go env GOARCH)" = "386" ]; then
|
||||
echo "build-terrain: WARNING - this is a 32-bit toolchain. The full-resolution run will not fit." >&2
|
||||
fi
|
||||
|
||||
gofmt -l . | (! grep .) || { echo "build-terrain: gofmt would change the files above" >&2; exit 1; }
|
||||
go vet ./...
|
||||
go test ./...
|
||||
mkdir -p bin
|
||||
go build -o bin/terrain.exe ./cmd/terrain
|
||||
echo "built $ROOT/Tools/Terrain/bin/terrain.exe"
|
||||
Reference in New Issue
Block a user