aorecomp

Anarchy Online classic in the browser

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


commit 1b9d3806e568bc0c574fa09fb283adaf6adf4382
parent 3d422e6750eb2423e1cc1f1553c667f0b18894c5
Author: anon <anon@example.com>
Date:   Thu, 29 Oct 2026 00:49:19 +0000

Add bounded Tiny Stalker combat profiles

Diffstat:
MTODO.md | 9+++++++++
Mdocs/combat-npc-balance.md | 3++-
Adocs/tiny-stalker.md | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/gamedata/npc_combat.yaml | 30++++++++++++++++++++++++++++++
Mserver/npc_shared_pursuit_test.go | 2+-
Aserver/tiny_stalker_test.go | 251+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 400 insertions(+), 2 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -672,6 +672,15 @@ for exact records, protocol, tests and remaining reconstruction assumptions. and further player levels without admin grants. Preserve authored outdoor ranges; enemies outside the admitted range still reject mission generation before fees. Original NPC growth and damage-rating scaling remain unresolved. +- [x] Verify mapped Tiny Stalkers as a second ordinary early combat family. + Admit only SR01 at levels 2..4 through shared profiles, preserving medium + identity confidence, attack-selection uncertainty and provisional balance. + An ordinary earned Enforcer defeated full-health levels 2/3/4 for 375 XP, + collected five credits and QL3/QL5 Monster Parts, and retained all 20 owned + instances across cold restart. All 16,553 Go results, 45 focused race results + and vet pass. Broader families, higher levels and useful equipment drops remain + open. See + [Tiny Stalker scope](docs/tiny-stalker.md). - [x] Make the next supported enemy level available through ordinary starter play. Check: a new player can reach and identify supported level-1 and level-2 enemies without admin placement. Resolve the generator's minimum-only choice diff --git a/docs/combat-npc-balance.md b/docs/combat-npc-balance.md @@ -2,7 +2,8 @@ The local wiki database provides useful weapon and behavior leads, but it does not supply a complete set of historical creature health, ratings and armor. -The server admits Leet levels 1..5 through the bounded profiles below. Unprofiled creatures retain +The server admits Leet levels 1..5 through the bounded profiles below and +[mapped Tiny Stalkers at levels 2..4](tiny-stalker.md). Unprofiled creatures retain prototype 100 HP, 5 damage and one-second attack/recharge phases. ## Bounded early progression diff --git a/docs/tiny-stalker.md b/docs/tiny-stalker.md @@ -0,0 +1,107 @@ +# Tiny Stalker combat scope + +The mapped SR01 population can use bounded level-2..4 combat profiles through +the shared NPC rules. This adds an early enemy family without a Stalker-specific +runtime branch. Other template codes, placeholder bodies and levels outside +this interval do not inherit these profiles. + +## Evidence and selected policy + +The original Omni Training group `950/district/4/group/3/authored_point` contains +four positions at authored levels 2..4. Its SR01-to-Tiny-Stalker/MonsterData17708 +binding remains **medium-confidence inference**, supported by the NPC mapping +handoff's nearby later capture positions and species geography. Alternatives +remain Tree Stalker, Mist Stalker and Striker Stalker. The mapping does not +recover an original server template, growth formula or inventory. + +The original item records provide two attacks: + +| Endpoints | Attack | QL1 damage / critical bonus | Attack / recharge | Defense | +| --- | --- | --- | --- | --- | +| 121113 / 121114 | Stalker Stomp | 4..9 / 4 | 235 / 235 cs | Evade Close | +| 121116 / 121117 | Stalker Spit | 6..12 / 6 | 235 / 235 cs | Evade Close | + +Both use Martial Arts attack weight 100 and range 5. Stomp uses MeleeAC91; +Spit uses ChemicalAC93. The catalog's original equipper records 121115/121118 +carry STW1/STW2. Selecting **Stomp alone is provisional**: neither the shipped +records nor the later capture inventory establishes the original Tiny Stalker +attack selection or whether it alternated attacks. + +The original database index SHA-256 is +`46e5dc54af9358cc9bff05f4358e86af630e497bc677f361c133c88073b84d71`. +The six complete payloads, offsets, hashes and decoded fields are retained in +`local/tiny-stalker/weapons.json` and adjacent binaries. An independent reread +matches all six maintained catalog records without undecoded tails. + +The later inventory at AORebirth revision +`758a712201472a2481af4b4e7c88cea20427c6a1` includes Tiny Stalkers at levels +1..4, but its profiles are marked incomplete or unsupported. The level-2/3 +observations are misses without an owner-linked weapon definition or landed +attack semantics. They do not certify Stomp, Spit, HP, XP or loot. Selected +profiles are retained in `local/tiny-stalker/later-profiles.json`. + +## Bounded balance + +| Level | HP / solo XP | Raw MA / Duck / Dodge / Evade Close / Nano Resist | Monster Parts QL | +| --- | --- | --- | --- | +| 2 | 100 / 100 | 5 | 1..3 | +| 3 | 125 / 125 | 10 | 2..4 | +| 4 | 150 / 150 | 15 | 3..5 | + +Every value in this table is **provisional gameplay balance**, using the same +early baseline as the admitted Leets rather than claiming a universal species +formula. Levels 2 and 4 are explicit anchors; shared interpolation resolves +level 3. There is no extrapolation. Original weapon fields interpolate separately +at actor QL: Stomp produces 4..10, 4..11 and 4..12 at levels 2, 3 and 4. + +Initiative0/AggDef75 preserve the original 235 cs phases. Cash1..5, +50% Monster Parts, a 100-second respawn delay and 180-second corpse lifetime +are also provisional. The Monster Parts subset is a reconstruction choice for +biological creature loot, not a recovered SR01 drop table. No armor, later +island Stalker Limb or Stalker Carapace drops are inferred from this choice. +Useful equipment loot and historical distributions remain open. + +Existing shared rules handle hit checks, armor, damage, recovery, pursuit, +leading-contributor rewards, selected-quality instances and atomic persistence. +The grey XP cutoff and exact NPC rating/damage growth remain unresolved; see +[kill experience](kill-experience.md) and [NPC balance](combat-npc-balance.md). + +## Verification + +Focused regressions exercise the actual four-position authored group through +initial allocation and cold reconstruction, exact native spawn endpoints and +QL, raw ratings and interpolated damage, normal Stomp timing, rejected bindings, +all six direct killing actions, empty loot, transaction failure/retry and repeated +pickup. The common pursuit/return test also covers all three admitted levels. +These fixtures establish implementation contracts, not historical balance. + +An ordinary earned level-3 Atrox Enforcer walked from the basic shop through +Omni-1 Entertainment and Backyard 11 to Omni Training. It defeated full-health +level-2/3/4 Stalkers using its existing QL3 bat and worn equipment, without admin +grants or consumed supplies. Native initialization matched Stomp's endpoints, +QL, damage, MeleeAC91 and 235 cs phases at all three levels. T inspection +completed normally. The fights awarded 100/125/150 XP; corpse collection added +1/2/2 credits. The first corpse rolled no item. The next two produced QL3/QL5 +Monster Parts, instances 135/136, which native left-click pickup moved into +main inventory slots 78/79. + +Settled native and live server HP agreed at 130/114/90. Incoming damage was +8/28/40, with a four-point player recovery tick during the second fight. +Targets received 103/125/153 damage, including three-point combat recovery in +the first and third fights. Periodic SQLite HP snapshots are not the live fight +measurements. These checks establish this prepared character's route, not +canonical balance or starter viability for every profession. + +All 59 preexisting item records and placements remained unchanged. A cold server +restart retained all 61 database items, and the native client reconstructed the +owner's 20 unique instances with exact QLs, counts and slots. It retained level 3, +875 current-level XP (4925 cumulative), 8309 IP and 36 credits. The original +uncleared Stalker and replacement lives at levels 2/3/4 loaded with full health +and their correct Stomp definitions. Both native phases completed without page +errors; every owned test browser closed. The raw streams, screenshots, original +payload audit and verification reports are under `local/tiny-stalker/`. + +The clean maintained Go suite passed 1,682 root tests / 16,553 results with no +test skips. The focused run passed 6 / 32 and the focused race run passed 7 / 45, +including all admitted levels in the shared pursuit/return checks. Vet passed. +Production data stayed unchanged after the native build. diff --git a/server/gamedata/npc_combat.yaml b/server/gamedata/npc_combat.yaml @@ -66,6 +66,36 @@ quality: [4, 6] chance: 50 +17708: + 2: &tiny_stalker + # SR01's species binding is medium-confidence; see docs/tiny-stalker.md. + template_code: SR01 + # Explicit provisional balance, not an original species growth formula. + health: 100 + experience: 100 + skills: {100: 5, 153: 5, 154: 5, 155: 5, 168: 5} + # Original StalkerStomp endpoints; selecting Stomp rather than Spit is provisional. + weapon: [121113, 121114] + initiative: 0 + agg_def: 75 + respawn_seconds: 100 + corpse_seconds: 180 + # Provisional biological loot subset, chances, cash and nearby quality interval. + credits: [1, 5] + loot: + - template: 42640 + quality: [1, 3] + chance: 50 + 4: + <<: *tiny_stalker + health: 150 + experience: 150 + skills: {100: 15, 153: 15, 154: 15, 155: 15, 168: 15} + loot: + - template: 42640 + quality: [3, 5] + chance: 50 + 30354: 4: # The original Clan Training fixed boss; ordinary salamanders do not inherit it. diff --git a/server/npc_shared_pursuit_test.go b/server/npc_shared_pursuit_test.go @@ -11,7 +11,7 @@ func TestAdmittedNPCProfilesSharePursuitAndReturn(t *testing.T) { for _, profile := range []struct { monster uint32 level uint16 - }{{17655, 1}, {17655, 2}, {30354, 4}} { + }{{17655, 1}, {17655, 2}, {17708, 2}, {17708, 3}, {17708, 4}, {30354, 4}} { for _, roaming := range []bool{false, true} { t.Run(fmt.Sprintf("%d/%d/roaming=%t", profile.monster, profile.level, roaming), func(t *testing.T) { world, _, start := newNPCPursuitWorld() diff --git a/server/tiny_stalker_test.go b/server/tiny_stalker_test.go @@ -0,0 +1,251 @@ +package main + +import ( + "ao/server/gamedata" + "encoding/binary" + "fmt" + "slices" + "testing" + "time" +) + +func TestTinyStalkerPopulationProfilesRecoverNativeWeapons(t *testing.T) { + data := testNPCData() + data.Playfields[0].Districts[0].Groups[0] = *gamedata.NPCGroups["950/district/4/group/3/authored_point"] + useNPCData(t, data) + world := newTestServer(t) + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + + cold := newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + for index, expected := range []struct { + level uint16 + health uint32 + rating int32 + low uint32 + high uint32 + }{{2, 100, 5, 4, 10}, {3, 125, 10, 4, 11}, {4, 150, 15, 4, 12}, {2, 100, 5, 4, 10}} { + npc := current.characters[1000000+uint32(index)] + if npc.name != "Tiny Stalker" || npc.monsterData != 17708 || npc.level != expected.level || npc.health != expected.health || + npc.combatProfile == nil || npc.combatProfile.TemplateCode != "SR01" || npc.attackRating() != expected.rating || + itemStat(npc.attackWeapon(), 286) != expected.low || itemStat(npc.attackWeapon(), 285) != expected.high { + t.Fatal("authored Stalker population lost its bounded profile or weapon quality", index, npc) + } + packet := targetPacket(characterPacket(npc)) + end := int(binary.BigEndian.Uint16(packet[6:8])) + if binary.BigEndian.Uint32(packet[end-16:end-12]) != 121113 || binary.BigEndian.Uint32(packet[end-12:end-8]) != 121114 || + binary.BigEndian.Uint32(packet[end-4:end]) != uint32(expected.level) { + t.Fatal("native spawn received a placeholder or wrong-quality weapon") + } + } + } +} + +func TestTinyStalkerProfileRejectsUnreviewedBindings(t *testing.T) { + for _, change := range []string{"level 1", "level 5", "other code", "placeholder", "other monster"} { + t.Run(change, func(t *testing.T) { + data := testNPCData() + group := &data.Playfields[0].Districts[0].Groups[0] + group.TemplateCode, group.MonsterData, group.Levels, group.AppearanceStatus = "SR01", 17708, [2]uint16{2, 2}, "inferred_species" + switch change { + case "level 1": + group.Levels = [2]uint16{1, 1} + case "level 5": + group.Levels = [2]uint16{5, 5} + case "other code": + group.TemplateCode = "SR02" + case "placeholder": + group.AppearanceStatus = "placeholder_creature" + case "other monster": + group.MonsterData = 17655 + } + useNPCData(t, data) + world := newTestServer(t) + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + + cold := newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + npc := current.characters[1000000] + if change == "other monster" { + if npc.combatProfile != gamedata.NPCCombatProfiles[17655][2] { + t.Fatal("Stalker profile replaced independently admitted Leet combat") + } + } else if npc.combatProfile != nil { + t.Fatal("unreviewed Stalker population inherited a profile", change) + } + } + }) + } +} + +func TestTinyStalkerCombatUsesStompPhases(t *testing.T) { + data := testNPCData() + group := &data.Playfields[0].Districts[0].Groups[0] + group.TemplateCode, group.MonsterData, group.Levels, group.AppearanceStatus = "SR01", 17708, [2]uint16{2, 2}, "inferred_species" + useNPCData(t, data) + world := newTestServer(t) + player := world.newCharacter() + player.position = group.Positions[0] + output := &combatTestConn{} + world.clients[player.id] = &worldClient{id: player.id, conn: output, target: true, ready: true, npcs: map[uint32]bool{1000000: true}} + world.combatRoll = func(limit uint32) uint32 { + if limit == 100 { + return 50 + } + return 0 + } + + if err := world.handleCombat(world.clients[player.id], attackPacket(player.id, 1000000)[20:]); err != nil { + t.Fatal(err) + } + start := player.nextAttack + world.advanceCombat(start) + world.advanceCombat(start.Add(2350*time.Millisecond - time.Nanosecond)) + if player.health != 34 { + t.Fatal("Stomp landed before its original attack phase ended") + } + world.advanceCombat(start.Add(2350 * time.Millisecond)) + + npc := world.characters[1000000] + if player.health != 30 || npc.nextAttack != start.Add(7050*time.Millisecond) { + t.Fatal("Stomp did not use its catalog damage and attack/recharge phases", player.health, npc.nextAttack.Sub(start)) + } +} + +func TestTinyStalkerDeathsRetainRewardsAcrossActions(t *testing.T) { + for _, attack := range []string{"unarmed", "axe", "pistol", "fling", "fast", "nano"} { + for _, expected := range []struct { + level uint16 + xp uint32 + ql uint32 + }{{2, 100, 3}, {3, 125, 4}, {4, 150, 5}} { + t.Run(fmt.Sprintf("%s/%d", attack, expected.level), func(t *testing.T) { + world, _ := newKillExperienceWorld(t, attack) + target := world.characters[1000000] + target.monsterData, target.level, target.npcDefinitionID = 17708, expected.level, "950/district/4/group/3/authored_point" + target.combatProfile = gamedata.NPCCombatProfiles[17708][expected.level] + world.combatRoll = func(limit uint32) uint32 { + if limit == 3 { + return 2 + } + return 0 + } + identity := world.nextItem + 1 + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + + attackForExperience(t, world, attack) + cold := newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + npc := current.characters[1000000] + if npc.health != 0 || npc.corpse == nil || npc.corpse.credits != 1 || current.characters[1].experience != expected.xp || + !slices.Equal(npc.corpse.items, []ownedItem{{ID: identity, Type: 51005, Template: 42640, Quality: expected.ql, Count: 1}}) || + current.nextItem != identity || npc.combatProfile != gamedata.NPCCombatProfiles[17708][expected.level] { + t.Fatal("Stalker death lost or repeated its shared transactional rewards", npc.corpse) + } + } + }) + } + } +} + +func TestTinyStalkerFailedDeathRetriesPickupWithoutDuplicatingRewards(t *testing.T) { + for _, failure := range []struct{ name, sql string }{ + {"item", "CREATE TRIGGER fail_stalker BEFORE INSERT ON items BEGIN SELECT RAISE(FAIL,'stalker'); END"}, + {"ignored placement", "CREATE TRIGGER fail_stalker BEFORE INSERT ON item_locations BEGIN SELECT RAISE(IGNORE); END"}, + {"commit", "CREATE TABLE stalker_commit_failure (id INTEGER REFERENCES items(id) DEFERRABLE INITIALLY DEFERRED); CREATE TRIGGER fail_stalker AFTER INSERT ON items BEGIN INSERT INTO stalker_commit_failure VALUES(9999); END"}, + } { + t.Run(failure.name, func(t *testing.T) { + world, output := newKillExperienceWorld(t, "unarmed") + target := world.characters[1000000] + target.monsterData, target.level, target.npcDefinitionID = 17708, 3, "950/district/4/group/3/authored_point" + target.combatProfile = gamedata.NPCCombatProfiles[17708][3] + world.combatRoll = func(uint32) uint32 { return 0 } + identity := world.nextItem + 1 + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + if _, err := world.db.Exec(failure.sql); err != nil { + t.Fatal(err) + } + + attackForExperience(t, world, "unarmed") + cold := newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + if current.characters[1000000].health != 1 || current.characters[1000000].corpse != nil || + current.characters[1].experience != 0 || current.nextItem != identity-1 { + t.Fatal("failed Stalker death leaked resources or an item identity") + } + } + for _, packet := range output.packets { + switch binary.BigEndian.Uint32(packet[16:20]) { + case 0x46002f16, 0x754f1115, 0x4727213e, 0x4f474e05, 0x7f405a16: + t.Fatal("failed Stalker death published a successful outcome") + } + } + + // Retry the same attack and ordinary pickup after removing the fault. + if _, err := world.db.Exec("DROP TRIGGER fail_stalker"); err != nil { + t.Fatal(err) + } + attackForExperience(t, world, "unarmed") + if err := world.handleLootUse(world.clients[1], lootUseRequest(1)); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(world.clients[1], lootTakeRequest()); err != nil { + t.Fatal(err) + } + if err := world.handleLootUse(world.clients[1], lootUseRequest(2)); err != nil { + t.Fatal(err) + } + cold = newTestInventoryServer(t) + for _, current := range []*server{world, cold} { + player, corpse := current.characters[1], current.characters[1000000].corpse + if player.experience != 125 || player.inventory.Credits != 1 || current.nextItem != identity || + !slices.Equal(player.inventory.Items, []ownedItem{{ID: identity, Type: 51005, Template: 42640, Quality: 2, Slot: 64, Count: 1}}) || + corpse.credits != 0 || len(corpse.items) != 0 { + t.Fatal("retry or repeated pickup lost or repeated Stalker rewards") + } + } + }) + } +} + +func TestTinyStalkerEmptyRollRetainsCashWithoutAllocatingAnItem(t *testing.T) { + world, _ := newKillExperienceWorld(t, "unarmed") + target := world.characters[1000000] + target.monsterData, target.level, target.npcDefinitionID = 17708, 2, "950/district/4/group/3/authored_point" + target.combatProfile = gamedata.NPCCombatProfiles[17708][2] + world.combatRoll = func(limit uint32) uint32 { + if limit == 5 { + return 4 + } + if limit == 100 { + return 50 + } + return 0 + } + before := world.nextItem + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + + attackForExperience(t, world, "unarmed") + cold := newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + corpse := current.characters[1000000].corpse + if corpse == nil || len(corpse.items) != 0 || corpse.credits != 5 || current.nextItem != before || current.characters[1].experience != 100 { + t.Fatal("empty membership roll changed cash, XP or allocated an identity", corpse) + } + } +}