From 95e4124b0c02b4e5be383c41ed4241566f40e6e6 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Sat, 7 Feb 2026 21:53:59 +0100 Subject: Prefetch char.ini for characters present in area via playerlist Store player data (charId, area) in an in-memory Map on the client, updated by PR/PU packet handlers. Use this to eagerly load char.ini when a player's character appears in our area or when switching areas, eliminating the lazy-load delay on first IC message. Co-Authored-By: Claude Opus 4.6 --- webAO/client.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'webAO/client.ts') diff --git a/webAO/client.ts b/webAO/client.ts index b7a15a4..95df67a 100644 --- a/webAO/client.ts +++ b/webAO/client.ts @@ -150,6 +150,7 @@ class Client extends EventEmitter { connect: () => void; loadResources: () => void; isLowMemory: () => void; + players: Map; charicon_extensions: string[]; emote_extensions: string[]; emotions_extensions: string[]; @@ -211,6 +212,7 @@ class Client extends EventEmitter { this.temp_packet = ""; loadResources; isLowMemory; + this.players = new Map(); this.charicon_extensions = [".png", ".webp"]; this.emote_extensions = [".gif", ".png", ".apng", ".webp", ".webp.static"]; this.emotions_extensions = [".png", ".webp"]; -- cgit From 020dfcda00ca06b9a06e7076eaf8a0164ae1327e Mon Sep 17 00:00:00 2001 From: David Skoland Date: Tue, 10 Feb 2026 23:38:17 +0100 Subject: Refactor playerlist to state-driven rendering with renderPlayerList handlePR and handlePU now only update client.playerlist state, and renderPlayerList handles all DOM rendering from that state. Co-Authored-By: Claude Opus 4.6 --- webAO/client.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'webAO/client.ts') diff --git a/webAO/client.ts b/webAO/client.ts index 95df67a..05a40c9 100644 --- a/webAO/client.ts +++ b/webAO/client.ts @@ -150,7 +150,8 @@ class Client extends EventEmitter { connect: () => void; loadResources: () => void; isLowMemory: () => void; - players: Map; + /** Maps player ID to player data */ + playerlist: Map; charicon_extensions: string[]; emote_extensions: string[]; emotions_extensions: string[]; @@ -212,7 +213,7 @@ class Client extends EventEmitter { this.temp_packet = ""; loadResources; isLowMemory; - this.players = new Map(); + this.playerlist = new Map(); this.charicon_extensions = [".png", ".webp"]; this.emote_extensions = [".gif", ".png", ".apng", ".webp", ".webp.static"]; this.emotions_extensions = [".png", ".webp"]; -- cgit