aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit fca2cbedf18963a79ddeaf893f16c7dcd77c7bec
parent 05bd2304b1c665240322fb1ed95dde7aaa16f593
Author: anon <anon@example.com>
Date:   Thu,  5 Nov 2026 19:27:51 +0000

Verify early-route creature appearances and close A3

Diffstat:
MTODO.md | 6++++--
Mdocs/npc-appearances.md | 58+++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mserver/browser_npc_outfits_test.go | 55++++++++++++++++++++++++++++++++++++++++++-------------
Mtools/client/test_npc_outfits.mjs | 10++++++----
4 files changed, 107 insertions(+), 22 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -58,7 +58,7 @@ research separately. More screenshots and test cases do not count as new gamepla box at the seller's feet remains a visual limitation while the window is open. See [the finite vendor set, verification and evidence limits](docs/npc-shops.md). -- [ ] **A3: Recognizable NPC appearances on early routes.** Start with Omni-Tek +- [x] **A3: Recognizable NPC appearances on early routes.** Start with Omni-Tek Elite Guards in Omni Trade. Their provisional body mappings do not establish heads or outfits; spawning a named human is not a completed appearance. Establish shared appearance/equipment delivery and data-backed outfits for @@ -74,7 +74,9 @@ research separately. More screenshots and test cases do not count as new gamepla now also wear original garments and pass front-view two-observer/reconnect checks. All six training-ground human opponent populations now have original clothing and pass the same checks, with mouse-look correcting slope-obscured - test views. Representative creature appearance checks remain. See + test views. All 15 distinct creature bodies across the three training routes, + including their bosses, now pass visual inspection, native picking and + two-observer/reconnect checks, completing this finite appearance scope. See [NPC appearance scope and evidence](docs/npc-appearances.md). - [ ] **A4: Doors visibly open where players enter.** Reproduce Entertainment diff --git a/docs/npc-appearances.md b/docs/npc-appearances.md @@ -118,6 +118,58 @@ fixtures now construct valid NPC definitions. The population membership fixture places actors in range and uses the authored 1,842-actor count for playfield 646; its previous range-dependent expectations also failed on the prior build. -A3 remains open for representative creature appearances. These controlled -appearance checks do not -establish earned progression, encounter balance or exact historical outfits. +## Creature appearance scope + +`TestBrowserNPCCreatureAppearances` selects the lowest actor identity at one +authored placement for each distinct creature body in the three training +routes. Shared species on other placements use the same MonsterData consumer. +The shared fixture bases viewing distance on the collision extent, with wider +8m Snake and 12m Stalker views because their render models extend beyond that +sphere. It uses ordinary mouse-look to frame the actor before native picking. +It checks both observers and reconnect, retaining the server identity and +MonsterData beside the captures. Armor comparisons apply to equipped humans; +this creature appearance check does not audit combat foundations. + +| Route | Creature | MonsterData | Representative definition | +| --- | --- | --- | --- | +| Omni Training | Leet | 17655 | `950/district/1/group/1/authored_point` | +| Omni Training | Giant Snake | 30252 | `950/district/1/group/2/authored_point` | +| Omni Training | Reet of Paradise | 30365 | `950/district/2/group/1/authored_point` | +| Omni Training | Malle | 17660 | `950/district/4/group/1/authored_point` | +| Omni Training | Tiny Stalker | 17708 | `950/district/4/group/3/authored_point` | +| Omni Training | Aquaan Boss | 30369 | `950/district/6/fixed/0` | +| Clan Training | Green Lizard / Grecko | 22794 | `952/district/0/group/1/authored_point` | +| Clan Training | Rollerrat | 17687 | `952/district/2/group/2/authored_point` | +| Clan Training | Blubbag | 40075 | `952/district/3/group/0/authored_point` | +| Clan Training | Salamander Boss | 30354 | `952/district/5/fixed/0` | +| Neutral Training | Android | 17649 | `954/district/0/group/0/authored_point` | +| Neutral Training | Biofreak Noskin | 30258 | `954/district/0/group/1/authored_point` | +| Neutral Training | Clawfinger | 38387 | `954/district/0/group/2/spread_authored_point` | +| Neutral Training | Eye Mutant | 17653 | `954/district/0/group/3/spread_authored_point` | +| Neutral Training | Blackout the TechnoMaster | 45873 | `954/district/5/fixed/0` | + +November 5 visual review confirms all 15 creature bodies and their textures, +including the second observer after reconnect. The published WASM is unchanged. +The retained runs are: + +| Capture directory under `local/npc-appearances/` | Result | +| --- | --- | +| `20261105-110817/` | First 12 creature scenarios completed; the runner then received SIGTERM while starting Clawfinger. Remaining work was resumed in short batches. | +| `20261105-111935/` | Snake and Stalker passed again with their complete render models in frame; the original close Stalker capture showed only its legs. | +| `20261105-112113/` | Clawfinger and Eye Mutant passed. | +| `20261105-112446/` | Blackout the TechnoMaster passed. | +| `20261105-112359/` | The retained Elite Guard outfit scenario passed with the shared fixture, including all eight armor values. | + +The corresponding logs are `browser-creatures.log`, `browser-creatures-wide.log`, +`browser-creatures-neutral.log` and `browser-creatures-final.log`. Every completed +scenario checks both initial observers and both reconnects, ordinary native +picking and absence of client exceptions. The fixture rejects an unequipped +human so creature support does not weaken the outfit requirement. Test clients +and servers are closed between runs. + +A3 is complete for the 24 human populations listed above and the 15 distinct +creature bodies in this table. The seven Elite Guards share two checked body +variants; every other human definition has its own checked placement. This +verification adds no creature behavior or combat content. The controlled +appearance checks do not establish earned progression, encounter balance or +exact historical outfits, and do not claim coverage of the full world catalog. diff --git a/server/browser_npc_outfits_test.go b/server/browser_npc_outfits_test.go @@ -17,37 +17,66 @@ import ( ) func TestBrowserNPCOutfits(t *testing.T) { + testBrowserNPCAppearances(t, []string{"710/district/0/fixed/8", "710/district/1/fixed/2", "710/district/0/fixed/18", "710/district/0/fixed/19", + "950/district/1/fixed/0", "952/district/3/fixed/0", "954/district/1/fixed/0", + "950/district/2/fixed/0", "950/district/2/fixed/1", "952/district/0/fixed/0", "952/district/0/fixed/1", + "954/district/2/fixed/0", "954/district/2/fixed/1", + "950/district/1/group/0/authored_point", "950/district/3/group/0/authored_point", "950/district/4/group/0/authored_point", + "952/district/2/group/0/authored_point", "952/district/3/group/1/authored_point", "954/district/4/group/3/spread_authored_point"}) +} + +func TestBrowserNPCCreatureAppearances(t *testing.T) { + // One original placement per distinct creature body in the three training routes. + testBrowserNPCAppearances(t, []string{ + "950/district/1/group/1/authored_point", "950/district/1/group/2/authored_point", "950/district/2/group/1/authored_point", + "950/district/4/group/1/authored_point", "950/district/4/group/3/authored_point", "950/district/6/fixed/0", + "952/district/0/group/1/authored_point", "952/district/2/group/2/authored_point", "952/district/3/group/0/authored_point", "952/district/5/fixed/0", + "954/district/0/group/0/authored_point", "954/district/0/group/1/authored_point", "954/district/0/group/2/spread_authored_point", + "954/district/0/group/3/spread_authored_point", "954/district/5/fixed/0", + }) +} + +func testBrowserNPCAppearances(t *testing.T, routes []string) { + t.Helper() if os.Getenv("AO_GAME_TEST") != "1" { - t.Skip("set AO_GAME_TEST=1 for two-client NPC outfits") + t.Skip("set AO_GAME_TEST=1 for two-client NPC appearances") } _, source, _, _ := runtime.Caller(0) root := filepath.Dir(filepath.Dir(source)) output := filepath.Join(root, "local/npc-appearances", time.Now().Format("20060102-150405")) - for _, route := range []string{"710/district/0/fixed/8", "710/district/1/fixed/2", "710/district/0/fixed/18", "710/district/0/fixed/19", - "950/district/1/fixed/0", "952/district/3/fixed/0", "954/district/1/fixed/0", - "950/district/2/fixed/0", "950/district/2/fixed/1", "952/district/0/fixed/0", "952/district/0/fixed/1", - "954/district/2/fixed/0", "954/district/2/fixed/1", - "950/district/1/group/0/authored_point", "950/district/3/group/0/authored_point", "950/district/4/group/0/authored_point", - "952/district/2/group/0/authored_point", "952/district/3/group/1/authored_point", "954/district/4/group/3/spread_authored_point"} { + for _, route := range routes { t.Run(route, func(t *testing.T) { world := newTestServer(t) var npc *character for _, actor := range world.characters { - if actor.npcDefinitionID == route { + if actor.npcDefinitionID == route && (npc == nil || actor.id < npc.id) { npc = actor - break } } if npc == nil { - t.Fatal("outfit actor is absent from the original population") + t.Fatal("appearance actor is absent from the original population") + } + if npc.appearance>>4&7 < 6 && len(npc.inventory.Items) == 0 { + t.Fatal("human appearance actor has no outfit") + } + // Frame large creatures using their scene collision extent. + npc.geometry = world.geometry + body := npc.collisionBody() + distance := max(float32(3), 2*(body.offset[1]+body.radius)) + // These tall render models extend beyond their collision sphere. + switch npc.monsterData { + case 30252: + distance = 8 + case 17708: + distance = 12 } for index, offset := range []float32{-1, 1} { player := world.newCharacter() player.playfield, player.position = npc.playfield, npc.position player.position[0] += offset player.position[1] += .75 - player.position[2] += 3 - yaw := math.Atan2(float64(-offset), -3) + player.position[2] += distance + yaw := math.Atan2(float64(-offset), -float64(distance)) player.rotation = [4]float32{0, float32(math.Sin(yaw / 2)), 0, float32(math.Cos(yaw / 2))} player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprintf("npc-outfit-%d", index)))) if err := world.saveUser_locked(player); err != nil { @@ -63,7 +92,7 @@ func TestBrowserNPCOutfits(t *testing.T) { for index := range armor { armor[index] = npc.equipmentBonus(90 + uint32(index)) } - json.NewEncoder(w).Encode(map[string]any{"id": npc.id, "route": route, "head": npc.headMesh, + json.NewEncoder(w).Encode(map[string]any{"id": npc.id, "route": route, "name": npc.name, "monster": npc.monsterData, "head": npc.headMesh, "items": npc.inventory.Items, "armor": armor, "position": npc.position}) }) host := httptest.NewServer(mux) diff --git a/tools/client/test_npc_outfits.mjs b/tools/client/test_npc_outfits.mjs @@ -14,7 +14,7 @@ async function ready(game) { let timer; try { await Promise.race([game.ready(), new Promise((_, reject) => { - timer = setTimeout(() => reject(new Error('NPC outfit client startup timed out')), 45000); + timer = setTimeout(() => reject(new Error('NPC appearance client startup timed out')), 45000); })]); } finally { clearTimeout(timer); } } @@ -30,6 +30,7 @@ try { console.log(`client ${index}: ready`); } const expected = await (await games[0].page.request.get(url + '/test-state')).json(); + expected.items ??= []; await fs.mkdir(output, {recursive: true}); await fs.writeFile(output + '/server.json', JSON.stringify(expected, null, 2) + '\n'); @@ -42,9 +43,10 @@ try { } await game.page.waitForFunction(() => touchRegion(500, 400)?.world === true); if (!game.state.camera.firstPerson) await game.key('F8'); - await game.wait('NPC clothing and armor applied', state => { + await game.wait('NPC appearance and armor applied', state => { const actor = state.actors.find(actor => actor.type === 50000 && actor.id === expected.id); - return actor?.stats[223] === 1 && expected.armor.every((value, i) => actor.effectiveArmor[i] === value); + return actor && (!expected.items.length || (actor.stats[223] === 1 && + expected.armor.every((value, i) => actor.effectiveArmor[i] === value))); }); const wear = game.events.filter(event => event.kind === 'packet' && event.navigation === game.navigation && event.direction === 'framereceived' && event.opcode === '35505644' && event.actor?.[1] === expected.id) @@ -79,7 +81,7 @@ try { assert.deepEqual(game.errors, []); } } - console.log('PASS:', expected.route, 'matching native outfit and armor on two clients before and after reconnect'); + console.log('PASS:', expected.route, 'native appearance, picking and equipment replay on two clients before and after reconnect'); } catch (error) { console.error(error); throw error;