Files
Emberwild/docs/SETUP_ON_NEW_MACHINE.md

130 lines
5.7 KiB
Markdown

# Continuing on another machine
This project is a self-contained git repo. Everything needed to build and run is
in it except **Godot itself** (which you install once per machine). No assets to
download — the M0 world is generated in code.
## 1. Install Godot 4.7+
- **macOS / Windows / Linux:** download the *standard* build (NOT the .NET/C#
build — this project is pure GDScript) from https://godotengine.org/download
- Use **4.7.x or newer 4.x**. The project is on `4.7.2.stable`. **Older
versions (4.3 etc.) can't run it**: they fail with script errors. Check
with `godot --version`, or `/Applications/Godot.app/Contents/MacOS/Godot
--version` on a Mac.
- macOS shortcut: `brew install --cask godot`. If Homebrew can't unpack it,
download the zip from the GitHub release page and move `Godot.app` to
`/Applications` (replacing any older one).
## 2. First run on a fresh copy: import once
Godot keeps its list of named classes (e.g. `Inventory`) in `.godot/`, which
isn't in git. Opening the project in the editor creates it. If you only run
**headless** (a server, or the tests), import once after cloning:
```bash
godot --headless --path . --import
```
Without it you get errors like `Could not find type "Inventory"`.
`server/run_server.sh` and `tests/run_all.sh` do this for you.
## 3. Running a dedicated server
```bash
server/run_server.sh # settings from server.json
server/run_server.sh --server-name "Paul's island" --password secret --port 24242
```
It checks the Godot version, imports a fresh copy, then starts the server on
UDP 24242 with no window. Settings live in `server.json` (its path is printed
at start-up; on macOS it's under
`~/Library/Application Support/Godot/app_userdata/Emberwild/server/`).
Stop it with Ctrl+C. Players join with **Join Game** on the title screen. Over
Tailscale, use the server machine's 100.x address or its machine name. See
`docs/MULTIPLAYER_PLAN.md` for all the options.
## Tests
Run everything (fails on any failed check or script error):
```bash
tests/run_all.sh
```
Or one at a time:
```bash
# Wolves: den, grace period, hunting, fire and walls, pack tactics
godot --headless --path . --script res://tests/test_wolves.gd
# Fishing and the mixed diet
godot --headless --path . --script res://tests/test_fishing_diet.gd
# Wildlife, melee, spear, bow, butchering, cooking + buffs, cloak, drops
godot --headless --path . --script res://tests/test_creatures_combat.gd
# Weather, shelter, snap building, support, doors, beds, regrowth
godot --headless --path . --script res://tests/test_weather_building.gd
# Boundary: tries to walk/jump out of the valley in 24 directions
godot --headless --path . --fixed-fps 30 --script res://tests/test_boundary.gd
# Terrain: no deep pits / floating water at the boundary, across 8 seeds
godot --headless --path . --script res://tests/test_terrain_edges.gd
# Survival loop: inventory, crafting, chopping, mining, pickups, building, chests
godot --headless --path . --script res://tests/test_survival_core.gd
# Save/load round trip + world slots (uses user://test_worlds, not your saves)
godot --headless --path . --script res://tests/test_save_load.gd
# Multiplayer lobby: a real headless server on UDP 24343 + scripted bot players
godot --headless --path . --script res://tests/test_net_lobby.gd
# Multiplayer world: avatars, smooth movement at 100 ms latency, cheat checks (UDP 24345)
godot --headless --path . --script res://tests/test_net_world.gd
# Survival stats: hunger, warmth, fire fuel, cooking, foraging, death + grave
godot --headless --path . --script res://tests/test_survival_stats.gd
```
## Save files
Worlds are per machine, under
`~/Library/Application Support/Godot/app_userdata/Emberwild/worlds/` on
macOS (`%APPDATA%\Godot\app_userdata\Emberwild\worlds\` on Windows). Copy a
world's folder across to move it to another machine.
The game used to be called Valheimlike, and its data lived in
`app_userdata/Valheimlike/`. The first time Emberwild starts it copies worlds,
your identity and server settings across to `app_userdata/Emberwild/`
(`scripts/core/boot.gd`). The old folder is left alone as a backup, and you
can delete it once you're happy.
## 2. Get the project onto the machine
You have the folder (from the zip, or a git remote). Then:
```bash
# If you brought the .zip:
unzip valheimlike.zip
cd valheimlike
# If you use a git remote instead (recommended for ongoing work):
git clone <your-remote-url> valheimlike
cd valheimlike
```
## 3. Open / run it
```bash
# Open in the editor (first open rebuilds the local .godot cache — this is normal):
godot --path . # or: open Godot, "Import", pick this folder's project.godot
# Run the game directly:
godot --path .
```
On macOS the binary inside the app is:
`/Applications/Godot.app/Contents/MacOS/Godot --path .`
## Controls
WASD move · Mouse look · Shift sprint · Space jump · ESC frees the cursor.
## Notes
- The `.godot/` cache folder is machine-local and git-ignored — it regenerates on
first open. Don't copy it between machines.
- If scripts look like they "didn't load", let the first editor open finish its
import pass, then press play.
- Where we are: **M0 + M0.5 complete** (detailed, bounded island valley). Next
is **M1** (gather → craft → build). See `docs/ROADMAP.md`.
## Recommended: push to a git remote for cross-machine work
A zip is a one-time snapshot. For going back and forth between machines, create a
private remote once and push:
```bash
# GitHub (private): gh repo create valheimlike --private --source=. --push
# or any remote:
git remote add origin <your-remote-url>
git push -u origin main # (branch may be 'master' — check `git branch`)
```
Then on each machine it's just `git clone` / `git pull` / `git push`.