commit 410f720c3821fe9810092a5072c99171423548b9
parent e55ca5edd1cb8598b7c6ac94ae4a007f5ab612b1
Author: anon <anon@example.com>
Date: Sun, 18 Oct 2026 05:09:57 +0000
Start browser visitors running with character tips disabled
Diffstat:
7 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
@@ -24,7 +24,8 @@ Open [the game](http://127.0.0.1:8080/) in a browser supporting WebAssembly
JSPI, shared memory, OffscreenCanvas and WebGL 2. It loads automatically with a
randomized Solitus visitor near Bronto Burger in Omni-Entertainment. A persistent
cookie identifies your character on later visits; no account or training is
-required. Click the game or press a key to enable sound.
+required. New visitors start in run mode with character tips disabled.
+Click the game or press a key to enable sound.
The first server run verifies and unpacks the bundled data.
[Server controls](http://127.0.0.1:8080/control)
provide character editing, teleporting and time controls.
diff --git a/server/browser_launch.go b/server/browser_launch.go
@@ -32,6 +32,7 @@ func (server *server) browserLaunch(w http.ResponseWriter, r *http.Request) {
token := rand.Text()
character = server.newCharacter_locked()
character.name = fmt.Sprintf("Visitor %d", character.id)
+ character.running = true
character.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte(token)))
character.playfield = 705
character.position = [3]float32{960 + float32(mathrand.IntN(49)-24)/8, 16.5, 510 + float32(mathrand.IntN(49)-24)/8}
diff --git a/server/browser_launch_test.go b/server/browser_launch_test.go
@@ -31,6 +31,9 @@ func TestBrowserLaunchCreatesPersistentVisitor(t *testing.T) {
t.Fatalf("saved first character: %+v", loaded.characters[1])
}
visitor := loaded.characters[1]
+ if !visitor.running {
+ t.Fatal("new visitor did not start in run mode")
+ }
if visitor.position[0] < 957 || visitor.position[0] > 963 || visitor.position[1] != 16.5 || visitor.position[2] < 507 || visitor.position[2] > 513 {
t.Fatalf("visitor is not near Bronto Burger: %v", visitor.position)
}
diff --git a/src/runtime/browser_host.c b/src/runtime/browser_host.c
@@ -5,6 +5,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
+#include <errno.h>
#include <pthread.h>
#include <stdint.h>
#include <emscripten/proxying.h>
@@ -42,7 +43,7 @@ void browser_prefetch_resource(uint32_t kind, uint32_t identity)
free(request);
}
-void browser_initialize(void)
+void browser_initialize(unsigned character_id)
{
/* FetchFS performs range requests on its own worker while game threads wait. */
char *base = ao_asset_base_url();
@@ -96,6 +97,28 @@ void browser_initialize(void)
}
}
free(manifest);
+ /* Each browser visitor starts with character tips disabled. */
+ char character_path[128];
+ snprintf(character_path, sizeof(character_path), "Prefs/localtest/Char%u", character_id);
+ assert(mkdir(character_path, 0755) == 0 || errno == EEXIST);
+ strcat(character_path, "/Char.cfg");
+ FILE *original = fopen(character_path, "r");
+ assert(original || errno == ENOENT);
+ FILE *character_preferences = fopen("Prefs/visitor.cfg", "w");
+ assert(character_preferences);
+ if (original) {
+ char line[4096];
+ while (fgets(line, sizeof(line), original)) {
+ if (strncmp(line, "IsFirstTime ", 12) && strncmp(line, "IsTipEnabled ", 13))
+ fputs(line, character_preferences);
+ }
+ assert(!ferror(original));
+ fclose(original);
+ }
+ fputs("IsFirstTime 0\nIsTipEnabled 0\n", character_preferences);
+ assert(fclose(character_preferences) == 0);
+ assert(rename("Prefs/visitor.cfg", character_path) == 0);
+
/* Start the guest with the viewport size, including nonstandard aspect ratios. */
int width, height;
assert(emscripten_get_canvas_element_size("#canvas", &width, &height) == EMSCRIPTEN_RESULT_SUCCESS);
diff --git a/src/runtime/linux_host.c b/src/runtime/linux_host.c
@@ -10,6 +10,7 @@
#include "guest_msvcp.h"
#include "../vendor/msvcp60/source/module.h"
#include "../vendor/ace/source/module.h"
+#include <assert.h>
#include <strings.h>
#include <pthread.h>
#include <unistd.h>
@@ -238,10 +239,11 @@ int main(int argc, char **argv)
{
extern char **environ;
#ifdef __EMSCRIPTEN__
- extern void browser_initialize(void);
+ extern void browser_initialize(unsigned character_id);
browser_profile_initialize(&g_cur_func);
double setup_start = ao_profile_begin("asset setup");
- browser_initialize();
+ assert(argc > 3);
+ browser_initialize((unsigned)strtoul(argv[3], NULL, 10));
ao_profile_end("asset setup", setup_start, NULL);
#endif
setvbuf(stderr, NULL, _IONBF, 0);
diff --git a/src/tests/browser_runtime.c b/src/tests/browser_runtime.c
@@ -9,7 +9,7 @@
#include <sys/utsname.h>
#include <pthread.h>
-void browser_initialize(void);
+void browser_initialize(unsigned character_id);
static uint32_t call(recomp_func_t function, unsigned count, const uint32_t *arguments)
{
@@ -117,7 +117,7 @@ static void socket_address_queries(uint32_t socket, uint32_t error)
int main(void)
{
assert(!emscripten_is_main_browser_thread());
- browser_initialize();
+ browser_initialize(1);
assert(guest_map("browser test", 0x100000, 0x10000));
g_fs_base = 0x100000;
hostname_queries(0);
diff --git a/src/tests/browser_storage.c b/src/tests/browser_storage.c
@@ -4,7 +4,7 @@
#include <sys/stat.h>
#include <emscripten/html5.h>
-void browser_initialize(void);
+void browser_initialize(unsigned character_id);
static void replace_occlusion_cache(void)
{
@@ -87,7 +87,14 @@ static void preferences_use_canvas_dimensions(void)
int main(void)
{
- browser_initialize();
+ browser_initialize(42);
+
+ FILE *preferences = fopen("Prefs/localtest/Char42/Char.cfg", "r");
+ assert(preferences);
+ char content[128] = {0};
+ assert(fread(content, 1, sizeof(content) - 1, preferences) == 29);
+ fclose(preferences);
+ assert(!strcmp(content, "IsFirstTime 0\nIsTipEnabled 0\n"));
preferences_use_canvas_dimensions();
replace_occlusion_cache();
create_occlusion_cache();
@@ -95,4 +102,5 @@ int main(void)
puts("PASS: browser occlusion caches preserve assets and support writes");
puts("PASS: asset reads preserve bytes across the 1 MiB boundary");
puts("PASS: private preferences use the canvas dimensions");
+ puts("PASS: visitor preferences disable first-run tutorials and tips");
}