From d489bb57ed7407d341f1f0e585ed196134e82cdf Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Wed, 4 Nov 2026 15:45:10 +0000 Subject: [PATCH] Rename the game to Emberwild (data copied from the old folder) --- docs/SETUP_ON_NEW_MACHINE.md | 12 ++++++--- docs/SURVIVAL_DESIGN.md | 2 +- project.godot | 3 ++- scripts/core/boot.gd | 52 ++++++++++++++++++++++++++++++++++++ scripts/net/server_config.gd | 2 +- scripts/ui/title_screen.gd | 2 +- server/run_server.sh | 2 +- 7 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 scripts/core/boot.gd diff --git a/docs/SETUP_ON_NEW_MACHINE.md b/docs/SETUP_ON_NEW_MACHINE.md index 630520f..ce59b33 100644 --- a/docs/SETUP_ON_NEW_MACHINE.md +++ b/docs/SETUP_ON_NEW_MACHINE.md @@ -33,7 +33,7 @@ server/run_server.sh --server-name "Paul's island" --password secret --port 2424 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/Valheimlike/server/`). +`~/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. @@ -71,10 +71,16 @@ godot --headless --path . --script res://tests/test_survival_stats.gd ## Save files Worlds are per machine, under -`~/Library/Application Support/Godot/app_userdata/Valheimlike/worlds/` on -macOS (`%APPDATA%\Godot\app_userdata\Valheimlike\worlds\` on Windows). Copy a +`~/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: diff --git a/docs/SURVIVAL_DESIGN.md b/docs/SURVIVAL_DESIGN.md index 0ed1ae9..324ec5b 100644 --- a/docs/SURVIVAL_DESIGN.md +++ b/docs/SURVIVAL_DESIGN.md @@ -275,7 +275,7 @@ small Diet bars, and a low group blinks. - **Autosave** every 2 minutes, on Save & Quit (to the title or desktop) and when the window is closed. - Saves live in `user://worlds//` (on macOS: - `~/Library/Application Support/Godot/app_userdata/Valheimlike/worlds/`) as + `~/Library/Application Support/Godot/app_userdata/Emberwild/worlds/`) as `meta.json` + `world.json`. Writes are atomic, and the previous save is kept as `world.json.bak`. - A save stores only what the player changed: player position and look, diff --git a/project.godot b/project.godot index 64e81ba..5c4b341 100644 --- a/project.godot +++ b/project.godot @@ -14,7 +14,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true [application] -config/name="Valheimlike" +config/name="Emberwild" config/description="Low-poly survival game — Valheim look, Rust depth, self-hosted, moddable." run/main_scene="res://scenes/title.tscn" config/features=PackedStringArray("4.7", "Forward Plus") @@ -22,6 +22,7 @@ config/icon="res://icon.svg" [autoload] +Boot="*res://scripts/core/boot.gd" ItemDB="*res://scripts/core/item_db.gd" Actions="*res://scripts/core/actions.gd" Saves="*res://scripts/core/saves.gd" diff --git a/scripts/core/boot.gd b/scripts/core/boot.gd new file mode 100644 index 0000000..1d64d79 --- /dev/null +++ b/scripts/core/boot.gd @@ -0,0 +1,52 @@ +extends Node +## Autoload "Boot", first in the list: one-off start-up housekeeping that has +## to happen before anything reads user://. +## +## The game was called "Valheimlike" until it became "Emberwild". Godot names +## the user-data folder after the project, so the rename moved it from +## .../app_userdata/Valheimlike to .../app_userdata/Emberwild. The first time +## Emberwild starts, this copies saved worlds, your identity (key, name, look) +## and server settings across. It copies rather than moves, so the old folder +## stays as a backup, and it never overwrites anything already in the new +## folder. Test folders (test_*) and logs are skipped. + +const OLD_NAME := "Valheimlike" +const MARKER := "migrated_from_valheimlike.txt" +const SKIP := ["logs", "shader_cache", "vulkan", "test_worlds", "test_net"] + +var copied := 0 + +func _enter_tree() -> void: + migrate_user_data() + +## Returns the number of files copied (0 if there was nothing to do). +func migrate_user_data() -> int: + var new_dir := OS.get_user_data_dir() + var old_dir := new_dir.get_base_dir().path_join(OLD_NAME) + if new_dir == old_dir or not DirAccess.dir_exists_absolute(old_dir): + return 0 + if FileAccess.file_exists(new_dir.path_join(MARKER)): + return 0 + copied = 0 + _copy_tree(old_dir, new_dir) + var f := FileAccess.open(new_dir.path_join(MARKER), FileAccess.WRITE) + if f != null: + f.store_string("Copied %d files from %s on %s. The old folder was left as it was.\n" % [ + copied, old_dir, Time.get_datetime_string_from_system()]) + if copied > 0: + print("[boot] moved to the new name: copied %d files from %s" % [copied, old_dir]) + return copied + +func _copy_tree(from: String, to: String) -> void: + DirAccess.make_dir_recursive_absolute(to) + var da := DirAccess.open(from) + if da == null: + return + for f in da.get_files(): + var dst := to.path_join(f) + if not FileAccess.file_exists(dst) and DirAccess.copy_absolute(from.path_join(f), dst) == OK: + copied += 1 + for d in da.get_directories(): + if d in SKIP or d.begins_with("test_"): + continue + _copy_tree(from.path_join(d), to.path_join(d)) diff --git a/scripts/net/server_config.gd b/scripts/net/server_config.gd index 37d22fa..3d33fa1 100644 --- a/scripts/net/server_config.gd +++ b/scripts/net/server_config.gd @@ -6,7 +6,7 @@ extends RefCounted const DEFAULT_PATH := "user://server/server.json" const DEFAULTS := { - "server_name": "Valheimlike server", + "server_name": "Emberwild server", "motd": "Welcome!", "port": 24242, "max_players": 8, diff --git a/scripts/ui/title_screen.gd b/scripts/ui/title_screen.gd index 533da40..83c3420 100644 --- a/scripts/ui/title_screen.gd +++ b/scripts/ui/title_screen.gd @@ -75,7 +75,7 @@ func _ready() -> void: col.offset_right = 520 col.add_theme_constant_override("separation", 14) root.add_child(col) - col.add_child(UITheme.label("VALHEIMLIKE", 54)) + col.add_child(UITheme.label("EMBERWILD", 54)) col.add_child(UITheme.label("Survive the island. Build a home.", 18, UITheme.TEXT_DIM)) var spacer := Control.new() spacer.custom_minimum_size = Vector2(0, 24) diff --git a/server/run_server.sh b/server/run_server.sh index d8bb032..7cfcbe4 100755 --- a/server/run_server.sh +++ b/server/run_server.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Starts a dedicated Valheimlike server (no window, no local player). +# Starts a dedicated Emberwild server (no window, no local player). # # server/run_server.sh defaults from server.json # server/run_server.sh --port 24242 --server-name "Paul's island" --password secret