commit 8cd35f96e98aa6c1412ac11b571d95847ad9f976
parent d207c6ca73d57d16ef4f050d230579412f77b60e
Author: anon <anon@example.com>
Date: Sat, 24 Oct 2026 20:38:02 +0000
Support the original player head catalog and gameplay height
Diffstat:
22 files changed, 932 insertions(+), 40 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -425,6 +425,10 @@ checks are recorded in [treatment kits](docs/treatment-kit.md).
## Character creation
+The original 255-head catalog, seven breed/sex templates, body materials and
+persisted gameplay height are recorded in [player appearance](docs/character-appearance.md).
+The selection flow and complete original creation sequence remain open below.
+
- [ ] Choose a breed at creation. Check: the choice persists and the native
appearance and derived resource coefficients agree with it.
- [ ] Choose a profession at creation. Check: profession-dependent starting
@@ -435,6 +439,12 @@ checks are recorded in [treatment kits](docs/treatment-kit.md).
reconnect and are rendered consistently to another player.
- [ ] Grant one profession's starter loadout. Check: a new character receives
the expected items once; reconnecting does not grant another set.
+- [ ] Reconstruct the original Arrival Hall and training-ground introduction.
+ Check all three factions' entry/exit flow, authored tutorial NPC identities,
+ dialogues, starter instructions and camera state. Replace training NPC
+ placeholder names using period evidence. Original door transforms and usable
+ entry checks are in [character creation](docs/character-creation.md) and
+ [player appearance](docs/character-appearance.md).
- [x] Populate a new player's action bar with the default actions. Check: a
fresh character's native action bar contains the appropriate starter actions
on first login; reconnecting preserves the layout and existing player edits.
@@ -633,6 +643,10 @@ disconnect retention and succession policy still need period corroboration.
## Travel
+- [ ] Audit compact actor-spawn Run Speed. The byte after HeadMesh is applied
+ to native stat 156; the server currently sends a constant 100. Recover its
+ complete compact encoding and verify that a late observer receives the
+ correct speed after training, equipment changes and reconnect.
- [x] Synchronize rotation while a character stands still. Check: turning with
keys or the mouse updates another native client promptly, without requiring
walking, a later packet or reconnect. Cover start/stop, final facing, late
diff --git a/docs/character-appearance.md b/docs/character-appearance.md
@@ -0,0 +1,102 @@
+# Original player appearance
+
+The server reads the original creator's 255 head choices and seven breed/sex
+templates from `gamedata/player_appearances.yaml`. The extractor
+`tools/data/extract_player_appearances.py` reproduces that file from the selected
+14.9.1 database and SHA-checked `ddr.dll` and `bbr.dll` binaries.
+
+| Breed | Native sex | Heads | First mesh | Last mesh |
+| --- | --- | --- | --- | --- |
+| Solitus | 2 male | 52 | 40681 | 40680 |
+| Solitus | 3 female | 52 | 40629 | 40628 |
+| Opifex | 2 male | 30 | 40261 | 40284 |
+| Opifex | 3 female | 31 | 40224 | 40246 |
+| Nanomage | 2 male | 30 | 40185 | 40206 |
+| Nanomage | 3 female | 30 | 40151 | 40169 |
+| Atrox | 1 androgynous | 30 | 40111 | 40132 |
+
+`ddr.dll!FUN_10030230` builds these ordered choices by looking up original head
+filenames, excluding specific entries and skipping absent meshes. Each choice
+retains its explicit mesh identity and skin race. The Solitus catalog includes
+three skin races. The native creator previews Atrox using sex 2, while
+`NameScene_t`'s helper at `0x10038b40` sends sex 1 in its creation request.
+Both use the original `athrox` body/head resources.
+
+The profile and SQLite record store `head_mesh` independently of the packed
+appearance's five-bit face hint. `characterPacket` sends that explicit mesh to
+local and observing clients. A default head uses the first original choice
+matching breed, sex and skin race. New browser visitors randomly select from
+the complete Solitus catalog and retain the head's matching skin race.
+The mapping between the original creation catalog index and the packed face
+hint remains unproven; the server does not truncate the full catalog into it.
+
+## Body materials and height
+
+The original body builds are slim 0, normal 1 and heavy 2. The native client
+selects their corresponding CIR resources from the packed appearance. Body
+materials follow `bbr.dll!VisualCATMesh_t::ChangeClothes`: retain authored
+defaults, replacing a fully green material with its matching naked skin.
+The extractor reads the native full/partial green tables and asserts that no
+default body material requires a partial merge. Only Solitus male/female and
+Atrox default hands need replacement; the remaining defaults are retained.
+
+The persisted `height` is the original gameplay percentage: 90 short, 100
+normal or 110 tall. An unspecified height uses the native default of 100.
+`ddr.dll!NameScene_t::SetState` converts the selected height into those values
+before `Client_t::CreateCharacter`. Its preview uses 95/100/105; those preview
+values are not the saved gameplay percentages.
+
+The observer spawn packet carries height as the uint16 after MonsterData and
+before the length-prefixed vehicle. `kkr.dll`'s reader at `0x10083650` reads it
+into the message's scale field; activation at `0x100821d0` applies stat 360.
+The local full-character packet also supplies that base stat, and server
+physical extent uses the same base height before equipment modifiers. Vehicle
+scale keeps its existing separate rule. The later byte after HeadMesh is
+Run Speed, which still needs its own compact-field audit.
+
+Head and height changes commit with the character profile. Control-panel
+edits retain them through reconnect, rezoning and restart. Failed or ignored
+writes and failed COMMITs leave both memory and SQLite unchanged.
+
+## Evidence and remaining creation work
+
+Complete REA records and extracted resource hashes are retained under
+`local/character-creation-research/`: `creation-appearance-evidence.json`,
+`creation-scale-evidence.json`, `creation-request-evidence.json`,
+`creation-materials-evidence.json` and `appearance-catalog.json`.
+The extractor checks the source binary identities before using native tables.
+
+This supplies appearance support for the pending browser character-creation
+flow. That flow still needs its selection UI, atomic new-character transaction,
+training-ground entry, starter grants and the clearer Create/Adopt/Log in
+choices. The original 14.9.1 Arrival Hall precedes final faction selection;
+its full flow remains part of the canonical-game target.
+
+## Verification
+
+Automated tests check the original catalog counts and boundary meshes, all
+seven body templates, explicit head identity in spawn packets, local/observer
+height agreement, physical extent, profile edits and restart. Invalid integer
+ranges, failed/ignored writes, failed COMMITs and successful retries preserve
+the expected memory/database state. Browser launch retains its selected head
+and matching skin race through reopen.
+
+Two hardware Chromium WASM clients on the GPU rendered every breed/sex
+template, all three builds and all three heights through live profile edits.
+Native memory snapshots agree between the local player and observer. Captured
+observer byte streams also contain every selected full head mesh, scale and
+resolved material ID. Additional checks cover all three Solitus skin races for
+both sexes. Cold server recovery retained Atrox head 40132 and height 110;
+movement then replicated to the observing client. No browser/worker errors
+were recorded in either completed run.
+
+The same client rendered Omni, Clan and Neutral training grounds and moved
+away from each authored entrance without immediately zoning back. Test entry
+positions use the existing zoning convention of 2.5 metres along the door's
+forward vector and terrain height plus 0.75 metres. This is a verified usable
+reconstruction policy, rather than a recovered original-server spawn offset.
+The final creation flow still needs its original camera/Arrival Hall behavior.
+
+Screenshots, native snapshots, SQLite snapshots, wire captures and verification
+reports are under `local/player-appearance-smoke/`. Automated logs and original
+training-door provenance are under `local/browser-creation-research/`.
diff --git a/docs/character-creation.md b/docs/character-creation.md
@@ -1,4 +1,4 @@
-# Starting abilities and skills
+# Character creation
Creation reads the six ability baselines directly from the original 14.9.1
breed training data in `server/gamedata/ip_training.yaml`. Resource type
@@ -24,8 +24,11 @@ lists the original resource's Opifex and Nanomage starting values. Its level-220
tables are expansion-era corroboration, rather than an exact 14.9.1 server
capture.
-The browser currently creates Solitus Soldiers. Selecting other breeds and
-professions, including their appropriate appearance assets, remains open.
+The browser currently creates Solitus Soldiers. Its visitors use the complete
+original Solitus head catalog and matching skin race. The server supports all
+seven original breed/sex appearance templates, explicit head identities and
+gameplay height; see [player appearance](character-appearance.md). The browser
+creation flow for selecting breed, profession and appearance remains open.
Profiles with explicitly supplied stats retain those values.
All raw skills start at 5 and unspent IP at 1500. Those remain reconstruction
@@ -41,6 +44,74 @@ health/nano of 34/32, 38/31, 25/48 and 59/20 respectively. Creation starts at fu
health and retains the current zero-nano policy. Historical starting resources,
equipment and action choices still need a complete creation audit.
+## Original creation research
+
+The original creator in `ddr.dll` offers the four breeds, twelve professions,
+three builds and three heights. Its seven breed/sex templates and full head
+catalog are documented in [player appearance](character-appearance.md).
+`cd_image/data/launcher/Professions.txt` maps the original profession IDs.
+
+`NameScene_t::StartServerCreation` normalizes the nickname, then validates it
+with the helper at `0x10038c10`: length 4-12, at least four initial ASCII
+letters, and optional trailing digits. Letters cannot follow digits. The
+normalizer at `0x10038d00` removes other characters and uses first-uppercase,
+remaining-lowercase spelling. The browser's current prototype naming limits
+still need to be aligned with that original creation behavior. Original server
+profanity and reserved-name policy remains unknown.
+
+The selected version includes Arrival Hall playfield 4604 and
+`cd_image/text/tips/OnEnteringArrivalHall.txt`. Final faction selection leads
+to Omni Training 950, Clan Training 952 or Neutral Training 954. These original
+`1000026` door records identify their backyard entrances:
+
+| Playfield | Door | Authored XYZ | Quaternion XYZW |
+| --- | --- | --- | --- |
+| 950 | `0xc00003b6` | 52.597332, 15.870241, 55.136177 | 0, 0, 0, 1 |
+| 952 | `0xc00103b8` | 40.237694, 14.859026, 70.091904 | 0, 0.707108, 0, 0.70710546 |
+| 954 | `0xc00003ba` | 239.886292, 5.964665, 69.931137 | 0, 0, 0, 1 |
+
+Clan/Neutral map-center spawn coordinates in the exploration catalog are not
+historical creation positions. Original-server final offsets, clearance and
+backyard-instance allocation remain unproven. Raw door bytes, hashes and
+terrain measurements are retained in
+`local/browser-creation-research/training-door-locations.json`.
+
+The shipped startup crystal tips instruct manual upload from inventory. They
+identify the following original QL1 crystal items and resulting nanos:
+
+| Profession ID/name | Crystal item -> nano |
+| --- | --- |
+| 1 Soldier | 29092 -> 29091 |
+| 2 Martial Artist | 43382 -> 43369 |
+| 3 Engineer | 43329 -> 43325; 29194 -> 29188 |
+| 4 Fixer | 43380 -> 43370 |
+| 5 Agent | 43383 -> 43367; 29191 -> 29153 |
+| 6 Adventurer | 28742 -> 26695 |
+| 7 Trader | 43378 -> 43374; 78417 -> 76742 |
+| 8 Bureaucrat | 43381 -> 43368; 29625 -> 29618 |
+| 9 Enforcer | 43379 -> 43371 |
+| 10 Doctor | 28778 -> 28665; 43384 -> 43376 |
+| 11 Nano-Technician | 28815 -> 28612; 42111 -> 42110 |
+| 12 Meta-Physicist | 43330 -> 43324; 29193 -> 29114 |
+
+`cd_image/text/tips/tipheader.txt` names these startup crystals; the original
+item records retain their skill requirements. Their presence does not justify
+automatically learning nanos or granting extra trained skills.
+
+Original descriptions/tutorials identify startup Soldier assault rifle 121569,
+Agent rifle 121568, Fixer SMG 121571, Trader shotgun 121570, Enforcer bat 121564,
+MP shield 121566 and MA attack Jab of the Snake 117610. Solar pistol 121567 is
+a starter weapon, but its exact profession allocation still needs corroboration.
+Tutorials instruct manually equipping the weapons. The mere existence of MA
+Oak Bo 121565 does not establish a creation grant.
+
+The original startup laboratory 116628 has capacity 200 and restores 15 health
+and 15 nano; first-aid kit 116629 has capacity 300 and restores 5-7 of each.
+Capacity metadata does not prove the original server's issued charge counts.
+Startup maps are 116693 Omni, 116696 Clan and 116697 Neutral. Clan board 96358,
+Omni board 99719 and Omni shirt 29426 have original startup references. Exact
+allocation, counts, credits and complete starting loadouts remain open.
+
## Verification
`server/character_initialization_test.go` checks all four breed baselines and
diff --git a/server/appearance.go b/server/appearance.go
@@ -1,11 +1,52 @@
package main
import (
+ "ao/server/gamedata"
"fmt"
"go.yaml.in/yaml/v3"
)
+func (character *character) baseScale() uint16 {
+ if character.height == 0 {
+ return 100
+ }
+ return character.height
+}
+
+func (character *character) appearanceAssets() (uint32, [5]uint32) {
+ // Unspecified player templates use the original Solitus male defaults.
+ appearance := unpackAppearance(character.appearance)
+ if appearance.Breed < 1 || appearance.Breed > 4 {
+ appearance.Breed = 1
+ }
+ if appearance.Breed == 4 {
+ appearance.Sex = 1
+ } else if appearance.Sex != 3 {
+ appearance.Sex = 2
+ }
+ if appearance.Race == 0 || appearance.Breed != 1 {
+ appearance.Race = 1
+ }
+
+ // Explicit head identity supports all native choices, independently of face bits.
+ head := character.headMesh
+ if head == 0 {
+ for _, choice := range gamedata.PlayerAppearances.Heads {
+ if choice.Breed == appearance.Breed && choice.Sex == appearance.Sex && choice.Race == appearance.Race {
+ head = choice.Mesh
+ break
+ }
+ }
+ }
+ for _, body := range gamedata.PlayerAppearances.Bodies {
+ if body.Breed == appearance.Breed && body.Sex == appearance.Sex {
+ return head, body.Textures[appearance.Race]
+ }
+ }
+ panic("missing player body assets")
+}
+
type appearanceFields struct {
Race uint16 `yaml:"race"`
Fatness uint16 `yaml:"fatness"`
@@ -38,12 +79,12 @@ func (appearance appearanceFields) MarshalYAML() (any, error) {
return nil, err
}
comments := []string{
- "Native race code: 0-3; current players and creatures use 1.",
- "Native body build: 0-3; 1 is normal.",
+ "Native race code: 1 default; Solitus skin variants also use 2 and 3.",
+ "Body build: 0 slim, 1 normal, 2 heavy; native field range 0-3.",
"Breed: 1 Solitus, 2 Opifex, 3 Nanomage, 4 Atrox, 6 creature; native range 0-7.",
- "Sex: 2 male, 3 female; creatures use 1. Native range 0-3.",
+ "Sex: 2 male, 3 female; Atrox and creatures use 1. Native range 0-3.",
"Side: 0 neutral, 1 Clan, 2 Omni-Tek; native range 0-3.",
- "Head selection: 0-31 on the wire; current Solitus meshes support 0-7.",
+ "Native face hint: 0-31; head_mesh selects the visible head independently.",
}
for index, comment := range comments {
node.Content[index*2].HeadComment = comment
diff --git a/server/appearance_test.go b/server/appearance_test.go
@@ -3,6 +3,8 @@ package main
import (
"bytes"
"encoding/binary"
+ "fmt"
+ "net/url"
"testing"
)
@@ -34,7 +36,125 @@ func TestPlayerAppearanceIncludesVehicleMaterials(t *testing.T) {
}
}
-func TestSolitusAppearanceUsesMatchingOriginalAssets(t *testing.T) {
+func TestPlayerAppearanceUsesEachNativeBreedAndSexTemplate(t *testing.T) {
+ for _, scenario := range []struct {
+ breed, sex, race uint16
+ head uint32
+ textures [5]uint32
+ }{
+ {1, 2, 3, 40680, [5]uint32{8714, 8710, 8771, 8713, 8709}},
+ {1, 3, 3, 40628, [5]uint32{8849, 8850, 8864, 8853, 8848}},
+ {2, 2, 1, 40284, [5]uint32{8964, 8960, 8963, 8965, 8961}},
+ {2, 3, 1, 40246, [5]uint32{8885, 8886, 8887, 8884, 8883}},
+ {3, 2, 1, 40206, [5]uint32{8986, 8983, 8984, 8985, 8982}},
+ {3, 3, 1, 40169, [5]uint32{9028, 9024, 9023, 9027, 9026}},
+ {4, 1, 1, 40132, [5]uint32{9233, 9231, 9240, 9234, 9236}},
+ } {
+ t.Run(fmt.Sprintf("%d/%d", scenario.breed, scenario.sex), func(t *testing.T) {
+ appearance := appearanceFields{Race: scenario.race, Breed: scenario.breed, Sex: scenario.sex}
+ player := &character{id: 1, name: "Visitor", appearance: appearance.packed(), headMesh: scenario.head, level: 1}
+
+ packet := characterPacket(player)
+
+ if binary.BigEndian.Uint32(packet[145:149]) != scenario.head {
+ t.Fatal("explicit head mesh was replaced or truncated")
+ }
+ for index, name := range []string{"arms", "feet", "hands", "legs", "body"} {
+ start := bytes.Index(packet, append([]byte(name), 0)) + len(name) + 1
+ if start < len(name)+1 || binary.BigEndian.Uint32(packet[start:]) != scenario.textures[index] {
+ t.Fatalf("%s did not use its native resolved default material", name)
+ }
+ }
+ })
+ }
+}
+
+func TestPlayerHeightReachesSpawnStatsAndPhysicalExtent(t *testing.T) {
+ for _, height := range []uint16{90, 100, 110} {
+ t.Run(fmt.Sprint(height), func(t *testing.T) {
+ player := &character{id: 1, name: "Visitor", height: height, level: 1}
+
+ spawn, full := characterPacket(player), fullCharacterPacket(player)
+ stats := make(map[uint32]uint32)
+ count := binary.BigEndian.Uint32(full[64:68])/1009 - 1
+ for offset := 68; offset < 68+int(count)*8; offset += 8 {
+ stats[binary.BigEndian.Uint32(full[offset:])] = binary.BigEndian.Uint32(full[offset+4:])
+ }
+ extent := player.physicalExtent()
+
+ if binary.BigEndian.Uint16(spawn[111:113]) != height || stats[360] != uint32(height) || extent != float32(height*2)*0.01 {
+ t.Fatalf("height disagrees between observer, local stats and extent: %d %d %f", binary.BigEndian.Uint16(spawn[111:113]), stats[360], extent)
+ }
+ })
+ }
+}
+
+func TestPlayerAppearancePersistsThroughControlEditAndRestart(t *testing.T) {
+ world := newTestServer(t)
+ postControlForm(world, "/control/users", url.Values{"name": {"Visitor"}})
+
+ response := postControlForm(world, "/control/users/1", url.Values{"data": {
+ "head_mesh: 40132\nheight: 110\nappearance: {race: 1, breed: 4, sex: 1, fatness: 2}\n",
+ }})
+ restored := newTestInventoryServer(t).characters[1]
+ spawn := characterPacket(restored)
+
+ if response.Code != 303 || restored.headMesh != 40132 || restored.height != 110 || restored.appearance != 0x2c9 ||
+ binary.BigEndian.Uint32(spawn[145:149]) != 40132 || binary.BigEndian.Uint16(spawn[111:113]) != 110 {
+ t.Fatalf("appearance changed across edit/restart: %d head=%d height=%d appearance=%x", response.Code, restored.headMesh, restored.height, restored.appearance)
+ }
+}
+
+func TestPlayerAppearanceFailedControlSaveLeavesMemoryAndDatabaseUnchanged(t *testing.T) {
+ for _, failure := range []struct{ name, statement string }{
+ {"abort", "CREATE TRIGGER deny_appearance BEFORE UPDATE OF head_mesh ON characters BEGIN SELECT RAISE(ABORT, 'appearance'); END"},
+ {"ignore", "CREATE TRIGGER deny_appearance BEFORE UPDATE OF head_mesh ON characters BEGIN SELECT RAISE(IGNORE); END"},
+ {"commit", "CREATE TABLE missing_appearance (id INTEGER REFERENCES players(id) DEFERRABLE INITIALLY DEFERRED); CREATE TRIGGER deny_appearance AFTER UPDATE OF head_mesh ON characters BEGIN INSERT INTO missing_appearance VALUES (999999); END"},
+ } {
+ t.Run(failure.name, func(t *testing.T) {
+ world := newTestServer(t)
+ postControlForm(world, "/control/users", url.Values{"name": {"Visitor"}})
+ if _, err := world.db.Exec(failure.statement); err != nil {
+ t.Fatal(err)
+ }
+
+ response := postControlForm(world, "/control/users/1", url.Values{"data": {"head_mesh: 40680\nheight: 110\n"}})
+ restored := newTestInventoryServer(t).characters[1]
+
+ if response.Code != 500 || world.characters[1].headMesh != 0 || world.characters[1].height != 0 || restored.headMesh != 0 || restored.height != 0 {
+ t.Fatal("failed appearance save changed memory or persisted state")
+ }
+ if _, err := world.db.Exec("DROP TRIGGER deny_appearance"); err != nil {
+ t.Fatal(err)
+ }
+
+ response = postControlForm(world, "/control/users/1", url.Values{"data": {"head_mesh: 40680\nheight: 110\n"}})
+ restored = newTestInventoryServer(t).characters[1]
+
+ if response.Code != 303 || restored.headMesh != 40680 || restored.height != 110 {
+ t.Fatal("appearance save did not recover after the failed transaction")
+ }
+ })
+ }
+}
+
+func TestPlayerAppearanceRejectsUnrepresentableProfileFields(t *testing.T) {
+ for _, data := range []string{"height: 65536", "height: -1", "head_mesh: 4294967296", "head_mesh: -1"} {
+ t.Run(data, func(t *testing.T) {
+ world := newTestServer(t)
+ postControlForm(world, "/control/users", url.Values{"name": {"Visitor"}})
+
+ response := postControlForm(world, "/control/users/1", url.Values{"data": {data}})
+ restored := newTestInventoryServer(t).characters[1]
+
+ if response.Code != 400 || world.characters[1].headMesh != 0 || world.characters[1].height != 0 || restored.headMesh != 0 || restored.height != 0 {
+ t.Fatal("unrepresentable appearance edit changed the player")
+ }
+ })
+ }
+}
+
+func TestSolitusAppearanceUsesExplicitHeadMeshAndMatchingSkin(t *testing.T) {
for _, appearance := range []struct {
packed uint16
head uint32
@@ -49,7 +169,7 @@ func TestSolitusAppearanceUsesMatchingOriginalAssets(t *testing.T) {
{0x2595, 40634, 8865}, {0x2d95, 40635, 8865},
{0x3595, 40636, 8865}, {0x3d95, 40637, 8865},
} {
- visitor := &character{id: 1, name: "Visitor", appearance: appearance.packed, level: 1}
+ visitor := &character{id: 1, name: "Visitor", appearance: appearance.packed, headMesh: appearance.head, level: 1}
packet := characterPacket(visitor)
diff --git a/server/browser_launch.go b/server/browser_launch.go
@@ -1,6 +1,7 @@
package main
import (
+ "ao/server/gamedata"
"crypto/rand"
"crypto/sha256"
"fmt"
@@ -37,8 +38,17 @@ func (server *server) browserLaunch(w http.ResponseWriter, r *http.Request) {
character.playfield = 705
character.position = [3]float32{960 + float32(mathrand.IntN(49)-24)/8, 16.5, 510 + float32(mathrand.IntN(49)-24)/8}
character.rotation = [4]float32{0, 0.9238795, 0, -0.3826834}
- // Solitus, normal build, Omni; random sex and one of eight original heads.
- character.appearance = 1 | 1<<2 | 1<<4 | uint16(2+mathrand.IntN(2))<<7 | 2<<9 | uint16(mathrand.IntN(8))<<11
+ // Use complete native Solitus head choices with their matching skin race.
+ appearance := appearanceFields{Race: 1, Fatness: 1, Breed: 1, Sex: uint16(2 + mathrand.IntN(2)), Side: 2}
+ var heads []gamedata.PlayerHead
+ for _, head := range gamedata.PlayerAppearances.Heads {
+ if head.Breed == appearance.Breed && head.Sex == appearance.Sex {
+ heads = append(heads, head)
+ }
+ }
+ head := heads[mathrand.IntN(len(heads))]
+ character.headMesh, appearance.Race = head.Mesh, head.Race
+ character.appearance = appearance.packed()
if err := server.saveUser_locked(character); err != nil {
delete(server.characters, character.id)
server.nextCharacter--
diff --git a/server/browser_launch_test.go b/server/browser_launch_test.go
@@ -1,6 +1,7 @@
package main
import (
+ "ao/server/gamedata"
"crypto/sha256"
"fmt"
"net/http"
@@ -40,9 +41,18 @@ func TestBrowserLaunchCreatesPersistentVisitor(t *testing.T) {
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)
}
- if visitor.appearance>>4&7 != 1 || visitor.appearance>>9&3 != 2 || visitor.appearance>>11 > 7 || (visitor.appearance>>7&3 != 2 && visitor.appearance>>7&3 != 3) {
+ if visitor.appearance>>4&7 != 1 || visitor.appearance>>9&3 != 2 || (visitor.appearance>>7&3 != 2 && visitor.appearance>>7&3 != 3) {
t.Fatalf("visitor appearance: %x", visitor.appearance)
}
+ validHead := false
+ for _, head := range gamedata.PlayerAppearances.Heads {
+ if head.Mesh == visitor.headMesh && head.Breed == 1 && head.Sex == visitor.appearance>>7&3 && head.Race == visitor.appearance&3 {
+ validHead = true
+ }
+ }
+ if !validHead || visitor.headMesh != world.characters[1].headMesh {
+ t.Fatal("visitor head mesh or matching skin race changed across restart")
+ }
cookies := response.Result().Cookies()
if len(cookies) != 1 || cookies[0].Name != "ao_client" || len(cookies[0].Value) < 26 || !cookies[0].HttpOnly || cookies[0].Path != "/" || cookies[0].SameSite != http.SameSiteLaxMode || cookies[0].MaxAge != 31536000 {
t.Fatalf("visitor credential: %+v", cookies)
diff --git a/server/combat.go b/server/combat.go
@@ -214,7 +214,7 @@ func (attacker *character) normalDamage(target *character, roll func(uint32) uin
func (character *character) physicalExtent() float32 {
// FUN_1005a790 scales CharRadius421 by Scale360; Kodaik OnWear sets it to 20.
- scale := int32(100)
+ scale := int32(character.baseScale())
if character.driving() {
scale = 20
}
diff --git a/server/database.go b/server/database.go
@@ -65,9 +65,12 @@ type playerVitals struct {
}
func (character *character) profile() playerProfile {
- return playerProfile{character.id, character.name, unpackAppearance(character.appearance), character.monsterData,
- character.level, character.experience, character.insuredExperience, max(1, character.profession), character.baseStats(), character.running, character.browserTokenHash, character.resurrectionTerminal,
- character.implantChangesUntil, character.treatmentLockedUntil}
+ return playerProfile{ID: character.id, Name: character.name, Appearance: unpackAppearance(character.appearance),
+ HeadMesh: character.headMesh, Height: character.height, MonsterData: character.monsterData,
+ Level: character.level, Experience: character.experience, InsuredExperience: character.insuredExperience,
+ Profession: max(1, character.profession), Stats: character.baseStats(), Running: character.running,
+ BrowserTokenHash: character.browserTokenHash, ResurrectionTerminal: character.resurrectionTerminal,
+ ImplantChangesUntil: character.implantChangesUntil, TreatmentLockedUntil: character.treatmentLockedUntil}
}
func (character *character) vitals() playerVitals {
@@ -134,8 +137,10 @@ func (record *characterRecord) fields() []any {
func (record characterRecord) character() *character {
profile, position := record.Profile, record.Position.editor()
- data := userData{profile.ID, profile.Name, position.Playfield, position.Position, position.Rotation,
- profile.Appearance.packed(), profile.MonsterData, profile.Level, profile.Experience, profile.InsuredExperience, profile.Profession, profile.Stats, profile.Running, position.ReturnDoor, profile.BrowserTokenHash}
+ data := userData{ID: profile.ID, Name: profile.Name, Playfield: position.Playfield, Position: position.Position, Rotation: position.Rotation,
+ Appearance: profile.Appearance.packed(), HeadMesh: profile.HeadMesh, Height: profile.Height, MonsterData: profile.MonsterData,
+ Level: profile.Level, Experience: profile.Experience, InsuredExperience: profile.InsuredExperience, Profession: profile.Profession,
+ Stats: profile.Stats, Running: profile.Running, ReturnDoor: position.ReturnDoor, BrowserTokenHash: profile.BrowserTokenHash}
player := data.character()
player.applyVitals(record.Vitals)
player.resurrectionTerminal = profile.ResurrectionTerminal
diff --git a/server/gamedata/load.go b/server/gamedata/load.go
@@ -29,7 +29,11 @@ var (
MapCoordinates MapCoordinateData
TerrainEvidence TerrainExtractionEvidence
Playfields map[uint32]Playfield
- BankTerminals map[uint32]struct {
+ PlayerAppearances struct {
+ Heads []PlayerHead `yaml:"heads"`
+ Bodies []PlayerBody `yaml:"bodies"`
+ }
+ BankTerminals map[uint32]struct {
Playfield uint32 `yaml:"playfield"`
Position [3]float32 `yaml:"position"`
}
@@ -71,6 +75,7 @@ func init() {
loadYAML("map_coordinates.yaml", &MapCoordinates)
loadYAML("terrain_evidence.yaml", &TerrainEvidence)
loadYAML("playfields.yaml", &Playfields)
+ loadYAML("player_appearances.yaml", &PlayerAppearances)
loadYAML("banks.yaml", &BankTerminals)
loadYAML("profession_resources.yaml", &ProfessionTitles)
loadYAML("experience.yaml", &ExperienceLevels)
diff --git a/server/gamedata/player_appearances.go b/server/gamedata/player_appearances.go
@@ -0,0 +1,14 @@
+package gamedata
+
+type PlayerHead struct {
+ Mesh uint32 `yaml:"mesh"`
+ Breed uint16 `yaml:"breed"`
+ Sex uint16 `yaml:"sex"`
+ Race uint16 `yaml:"race"`
+}
+
+type PlayerBody struct {
+ Breed uint16 `yaml:"breed"`
+ Sex uint16 `yaml:"sex"`
+ Textures map[uint16][5]uint32 `yaml:"textures"`
+}
diff --git a/server/gamedata/player_appearances.yaml b/server/gamedata/player_appearances.yaml
@@ -0,0 +1,290 @@
+# Generated from the original 14.9.1 creator and filename registry.
+heads:
+ - {mesh: 40681, breed: 1, sex: 2, race: 1}
+ - {mesh: 40682, breed: 1, sex: 2, race: 1}
+ - {mesh: 40683, breed: 1, sex: 2, race: 1}
+ - {mesh: 40684, breed: 1, sex: 2, race: 1}
+ - {mesh: 40666, breed: 1, sex: 2, race: 1}
+ - {mesh: 40686, breed: 1, sex: 2, race: 1}
+ - {mesh: 40687, breed: 1, sex: 2, race: 1}
+ - {mesh: 40688, breed: 1, sex: 2, race: 1}
+ - {mesh: 40689, breed: 1, sex: 2, race: 1}
+ - {mesh: 40690, breed: 1, sex: 2, race: 1}
+ - {mesh: 40691, breed: 1, sex: 2, race: 1}
+ - {mesh: 40692, breed: 1, sex: 2, race: 1}
+ - {mesh: 40693, breed: 1, sex: 2, race: 1}
+ - {mesh: 40694, breed: 1, sex: 2, race: 1}
+ - {mesh: 40695, breed: 1, sex: 2, race: 1}
+ - {mesh: 40696, breed: 1, sex: 2, race: 1}
+ - {mesh: 40697, breed: 1, sex: 2, race: 1}
+ - {mesh: 40698, breed: 1, sex: 2, race: 1}
+ - {mesh: 40699, breed: 1, sex: 2, race: 1}
+ - {mesh: 40700, breed: 1, sex: 2, race: 1}
+ - {mesh: 40701, breed: 1, sex: 2, race: 1}
+ - {mesh: 40702, breed: 1, sex: 2, race: 1}
+ - {mesh: 40703, breed: 1, sex: 2, race: 1}
+ - {mesh: 40704, breed: 1, sex: 2, race: 1}
+ - {mesh: 40705, breed: 1, sex: 2, race: 1}
+ - {mesh: 40706, breed: 1, sex: 2, race: 1}
+ - {mesh: 40707, breed: 1, sex: 2, race: 1}
+ - {mesh: 40708, breed: 1, sex: 2, race: 1}
+ - {mesh: 40709, breed: 1, sex: 2, race: 1}
+ - {mesh: 40710, breed: 1, sex: 2, race: 1}
+ - {mesh: 40711, breed: 1, sex: 2, race: 1}
+ - {mesh: 40712, breed: 1, sex: 2, race: 1}
+ - {mesh: 40713, breed: 1, sex: 2, race: 1}
+ - {mesh: 40714, breed: 1, sex: 2, race: 1}
+ - {mesh: 40715, breed: 1, sex: 2, race: 1}
+ - {mesh: 40716, breed: 1, sex: 2, race: 1}
+ - {mesh: 40717, breed: 1, sex: 2, race: 1}
+ - {mesh: 40685, breed: 1, sex: 2, race: 2}
+ - {mesh: 40667, breed: 1, sex: 2, race: 2}
+ - {mesh: 40668, breed: 1, sex: 2, race: 2}
+ - {mesh: 40669, breed: 1, sex: 2, race: 2}
+ - {mesh: 40670, breed: 1, sex: 2, race: 2}
+ - {mesh: 40671, breed: 1, sex: 2, race: 2}
+ - {mesh: 40672, breed: 1, sex: 2, race: 2}
+ - {mesh: 40673, breed: 1, sex: 2, race: 2}
+ - {mesh: 40674, breed: 1, sex: 2, race: 2}
+ - {mesh: 40675, breed: 1, sex: 2, race: 3}
+ - {mesh: 40676, breed: 1, sex: 2, race: 3}
+ - {mesh: 40677, breed: 1, sex: 2, race: 3}
+ - {mesh: 40678, breed: 1, sex: 2, race: 3}
+ - {mesh: 40679, breed: 1, sex: 2, race: 3}
+ - {mesh: 40680, breed: 1, sex: 2, race: 3}
+ - {mesh: 40629, breed: 1, sex: 3, race: 1}
+ - {mesh: 40630, breed: 1, sex: 3, race: 1}
+ - {mesh: 40631, breed: 1, sex: 3, race: 1}
+ - {mesh: 40632, breed: 1, sex: 3, race: 1}
+ - {mesh: 40633, breed: 1, sex: 3, race: 1}
+ - {mesh: 40634, breed: 1, sex: 3, race: 1}
+ - {mesh: 40635, breed: 1, sex: 3, race: 1}
+ - {mesh: 40636, breed: 1, sex: 3, race: 1}
+ - {mesh: 40637, breed: 1, sex: 3, race: 1}
+ - {mesh: 40638, breed: 1, sex: 3, race: 1}
+ - {mesh: 40639, breed: 1, sex: 3, race: 1}
+ - {mesh: 40640, breed: 1, sex: 3, race: 1}
+ - {mesh: 40641, breed: 1, sex: 3, race: 1}
+ - {mesh: 40642, breed: 1, sex: 3, race: 1}
+ - {mesh: 40643, breed: 1, sex: 3, race: 1}
+ - {mesh: 40644, breed: 1, sex: 3, race: 1}
+ - {mesh: 40645, breed: 1, sex: 3, race: 1}
+ - {mesh: 40646, breed: 1, sex: 3, race: 1}
+ - {mesh: 40647, breed: 1, sex: 3, race: 1}
+ - {mesh: 40648, breed: 1, sex: 3, race: 1}
+ - {mesh: 40649, breed: 1, sex: 3, race: 1}
+ - {mesh: 40650, breed: 1, sex: 3, race: 1}
+ - {mesh: 40651, breed: 1, sex: 3, race: 1}
+ - {mesh: 40652, breed: 1, sex: 3, race: 1}
+ - {mesh: 40653, breed: 1, sex: 3, race: 1}
+ - {mesh: 40654, breed: 1, sex: 3, race: 1}
+ - {mesh: 40655, breed: 1, sex: 3, race: 1}
+ - {mesh: 40656, breed: 1, sex: 3, race: 1}
+ - {mesh: 40657, breed: 1, sex: 3, race: 1}
+ - {mesh: 40658, breed: 1, sex: 3, race: 1}
+ - {mesh: 40659, breed: 1, sex: 3, race: 1}
+ - {mesh: 40660, breed: 1, sex: 3, race: 1}
+ - {mesh: 40661, breed: 1, sex: 3, race: 1}
+ - {mesh: 40662, breed: 1, sex: 3, race: 1}
+ - {mesh: 40663, breed: 1, sex: 3, race: 1}
+ - {mesh: 40664, breed: 1, sex: 3, race: 1}
+ - {mesh: 40665, breed: 1, sex: 3, race: 1}
+ - {mesh: 40625, breed: 1, sex: 3, race: 2}
+ - {mesh: 40615, breed: 1, sex: 3, race: 2}
+ - {mesh: 40616, breed: 1, sex: 3, race: 2}
+ - {mesh: 40617, breed: 1, sex: 3, race: 2}
+ - {mesh: 40618, breed: 1, sex: 3, race: 2}
+ - {mesh: 40619, breed: 1, sex: 3, race: 2}
+ - {mesh: 40620, breed: 1, sex: 3, race: 2}
+ - {mesh: 40621, breed: 1, sex: 3, race: 2}
+ - {mesh: 40622, breed: 1, sex: 3, race: 3}
+ - {mesh: 40623, breed: 1, sex: 3, race: 3}
+ - {mesh: 40624, breed: 1, sex: 3, race: 3}
+ - {mesh: 40614, breed: 1, sex: 3, race: 3}
+ - {mesh: 40626, breed: 1, sex: 3, race: 3}
+ - {mesh: 40627, breed: 1, sex: 3, race: 3}
+ - {mesh: 40628, breed: 1, sex: 3, race: 3}
+ - {mesh: 40261, breed: 2, sex: 2, race: 1}
+ - {mesh: 40249, breed: 2, sex: 2, race: 1}
+ - {mesh: 40250, breed: 2, sex: 2, race: 1}
+ - {mesh: 40251, breed: 2, sex: 2, race: 1}
+ - {mesh: 40252, breed: 2, sex: 2, race: 1}
+ - {mesh: 40253, breed: 2, sex: 2, race: 1}
+ - {mesh: 40254, breed: 2, sex: 2, race: 1}
+ - {mesh: 40255, breed: 2, sex: 2, race: 1}
+ - {mesh: 40256, breed: 2, sex: 2, race: 1}
+ - {mesh: 40257, breed: 2, sex: 2, race: 1}
+ - {mesh: 40258, breed: 2, sex: 2, race: 1}
+ - {mesh: 40259, breed: 2, sex: 2, race: 1}
+ - {mesh: 40260, breed: 2, sex: 2, race: 1}
+ - {mesh: 40247, breed: 2, sex: 2, race: 1}
+ - {mesh: 40262, breed: 2, sex: 2, race: 1}
+ - {mesh: 40263, breed: 2, sex: 2, race: 1}
+ - {mesh: 40265, breed: 2, sex: 2, race: 1}
+ - {mesh: 40267, breed: 2, sex: 2, race: 1}
+ - {mesh: 40269, breed: 2, sex: 2, race: 1}
+ - {mesh: 40271, breed: 2, sex: 2, race: 1}
+ - {mesh: 40272, breed: 2, sex: 2, race: 1}
+ - {mesh: 40273, breed: 2, sex: 2, race: 1}
+ - {mesh: 40275, breed: 2, sex: 2, race: 1}
+ - {mesh: 40276, breed: 2, sex: 2, race: 1}
+ - {mesh: 40277, breed: 2, sex: 2, race: 1}
+ - {mesh: 40279, breed: 2, sex: 2, race: 1}
+ - {mesh: 40281, breed: 2, sex: 2, race: 1}
+ - {mesh: 40282, breed: 2, sex: 2, race: 1}
+ - {mesh: 40283, breed: 2, sex: 2, race: 1}
+ - {mesh: 40284, breed: 2, sex: 2, race: 1}
+ - {mesh: 40224, breed: 2, sex: 3, race: 1}
+ - {mesh: 40209, breed: 2, sex: 3, race: 1}
+ - {mesh: 40210, breed: 2, sex: 3, race: 1}
+ - {mesh: 40211, breed: 2, sex: 3, race: 1}
+ - {mesh: 40212, breed: 2, sex: 3, race: 1}
+ - {mesh: 40213, breed: 2, sex: 3, race: 1}
+ - {mesh: 40214, breed: 2, sex: 3, race: 1}
+ - {mesh: 40215, breed: 2, sex: 3, race: 1}
+ - {mesh: 40216, breed: 2, sex: 3, race: 1}
+ - {mesh: 40217, breed: 2, sex: 3, race: 1}
+ - {mesh: 40218, breed: 2, sex: 3, race: 1}
+ - {mesh: 40219, breed: 2, sex: 3, race: 1}
+ - {mesh: 40220, breed: 2, sex: 3, race: 1}
+ - {mesh: 40222, breed: 2, sex: 3, race: 1}
+ - {mesh: 40223, breed: 2, sex: 3, race: 1}
+ - {mesh: 40207, breed: 2, sex: 3, race: 1}
+ - {mesh: 40225, breed: 2, sex: 3, race: 1}
+ - {mesh: 40227, breed: 2, sex: 3, race: 1}
+ - {mesh: 40228, breed: 2, sex: 3, race: 1}
+ - {mesh: 40229, breed: 2, sex: 3, race: 1}
+ - {mesh: 40230, breed: 2, sex: 3, race: 1}
+ - {mesh: 40231, breed: 2, sex: 3, race: 1}
+ - {mesh: 40232, breed: 2, sex: 3, race: 1}
+ - {mesh: 40234, breed: 2, sex: 3, race: 1}
+ - {mesh: 40236, breed: 2, sex: 3, race: 1}
+ - {mesh: 40238, breed: 2, sex: 3, race: 1}
+ - {mesh: 40240, breed: 2, sex: 3, race: 1}
+ - {mesh: 40242, breed: 2, sex: 3, race: 1}
+ - {mesh: 40243, breed: 2, sex: 3, race: 1}
+ - {mesh: 40244, breed: 2, sex: 3, race: 1}
+ - {mesh: 40246, breed: 2, sex: 3, race: 1}
+ - {mesh: 40185, breed: 3, sex: 2, race: 1}
+ - {mesh: 40171, breed: 3, sex: 2, race: 1}
+ - {mesh: 40172, breed: 3, sex: 2, race: 1}
+ - {mesh: 40173, breed: 3, sex: 2, race: 1}
+ - {mesh: 40174, breed: 3, sex: 2, race: 1}
+ - {mesh: 40175, breed: 3, sex: 2, race: 1}
+ - {mesh: 40176, breed: 3, sex: 2, race: 1}
+ - {mesh: 40177, breed: 3, sex: 2, race: 1}
+ - {mesh: 40178, breed: 3, sex: 2, race: 1}
+ - {mesh: 40179, breed: 3, sex: 2, race: 1}
+ - {mesh: 40180, breed: 3, sex: 2, race: 1}
+ - {mesh: 40181, breed: 3, sex: 2, race: 1}
+ - {mesh: 40182, breed: 3, sex: 2, race: 1}
+ - {mesh: 40183, breed: 3, sex: 2, race: 1}
+ - {mesh: 40184, breed: 3, sex: 2, race: 1}
+ - {mesh: 40170, breed: 3, sex: 2, race: 1}
+ - {mesh: 40186, breed: 3, sex: 2, race: 1}
+ - {mesh: 40187, breed: 3, sex: 2, race: 1}
+ - {mesh: 40188, breed: 3, sex: 2, race: 1}
+ - {mesh: 40189, breed: 3, sex: 2, race: 1}
+ - {mesh: 40191, breed: 3, sex: 2, race: 1}
+ - {mesh: 40193, breed: 3, sex: 2, race: 1}
+ - {mesh: 40195, breed: 3, sex: 2, race: 1}
+ - {mesh: 40197, breed: 3, sex: 2, race: 1}
+ - {mesh: 40199, breed: 3, sex: 2, race: 1}
+ - {mesh: 40201, breed: 3, sex: 2, race: 1}
+ - {mesh: 40203, breed: 3, sex: 2, race: 1}
+ - {mesh: 40204, breed: 3, sex: 2, race: 1}
+ - {mesh: 40205, breed: 3, sex: 2, race: 1}
+ - {mesh: 40206, breed: 3, sex: 2, race: 1}
+ - {mesh: 40151, breed: 3, sex: 3, race: 1}
+ - {mesh: 40135, breed: 3, sex: 3, race: 1}
+ - {mesh: 40136, breed: 3, sex: 3, race: 1}
+ - {mesh: 40137, breed: 3, sex: 3, race: 1}
+ - {mesh: 40138, breed: 3, sex: 3, race: 1}
+ - {mesh: 40139, breed: 3, sex: 3, race: 1}
+ - {mesh: 40140, breed: 3, sex: 3, race: 1}
+ - {mesh: 40141, breed: 3, sex: 3, race: 1}
+ - {mesh: 40142, breed: 3, sex: 3, race: 1}
+ - {mesh: 40143, breed: 3, sex: 3, race: 1}
+ - {mesh: 40144, breed: 3, sex: 3, race: 1}
+ - {mesh: 40145, breed: 3, sex: 3, race: 1}
+ - {mesh: 40146, breed: 3, sex: 3, race: 1}
+ - {mesh: 40147, breed: 3, sex: 3, race: 1}
+ - {mesh: 40148, breed: 3, sex: 3, race: 1}
+ - {mesh: 40149, breed: 3, sex: 3, race: 1}
+ - {mesh: 40150, breed: 3, sex: 3, race: 1}
+ - {mesh: 40133, breed: 3, sex: 3, race: 1}
+ - {mesh: 40152, breed: 3, sex: 3, race: 1}
+ - {mesh: 40154, breed: 3, sex: 3, race: 1}
+ - {mesh: 40156, breed: 3, sex: 3, race: 1}
+ - {mesh: 40158, breed: 3, sex: 3, race: 1}
+ - {mesh: 40160, breed: 3, sex: 3, race: 1}
+ - {mesh: 40161, breed: 3, sex: 3, race: 1}
+ - {mesh: 40162, breed: 3, sex: 3, race: 1}
+ - {mesh: 40164, breed: 3, sex: 3, race: 1}
+ - {mesh: 40165, breed: 3, sex: 3, race: 1}
+ - {mesh: 40166, breed: 3, sex: 3, race: 1}
+ - {mesh: 40168, breed: 3, sex: 3, race: 1}
+ - {mesh: 40169, breed: 3, sex: 3, race: 1}
+ - {mesh: 40111, breed: 4, sex: 1, race: 1}
+ - {mesh: 40099, breed: 4, sex: 1, race: 1}
+ - {mesh: 40100, breed: 4, sex: 1, race: 1}
+ - {mesh: 40101, breed: 4, sex: 1, race: 1}
+ - {mesh: 40102, breed: 4, sex: 1, race: 1}
+ - {mesh: 40103, breed: 4, sex: 1, race: 1}
+ - {mesh: 40105, breed: 4, sex: 1, race: 1}
+ - {mesh: 40106, breed: 4, sex: 1, race: 1}
+ - {mesh: 40107, breed: 4, sex: 1, race: 1}
+ - {mesh: 40108, breed: 4, sex: 1, race: 1}
+ - {mesh: 40109, breed: 4, sex: 1, race: 1}
+ - {mesh: 40110, breed: 4, sex: 1, race: 1}
+ - {mesh: 40098, breed: 4, sex: 1, race: 1}
+ - {mesh: 40112, breed: 4, sex: 1, race: 1}
+ - {mesh: 40113, breed: 4, sex: 1, race: 1}
+ - {mesh: 40114, breed: 4, sex: 1, race: 1}
+ - {mesh: 40115, breed: 4, sex: 1, race: 1}
+ - {mesh: 40116, breed: 4, sex: 1, race: 1}
+ - {mesh: 40117, breed: 4, sex: 1, race: 1}
+ - {mesh: 40118, breed: 4, sex: 1, race: 1}
+ - {mesh: 40119, breed: 4, sex: 1, race: 1}
+ - {mesh: 40120, breed: 4, sex: 1, race: 1}
+ - {mesh: 40121, breed: 4, sex: 1, race: 1}
+ - {mesh: 40122, breed: 4, sex: 1, race: 1}
+ - {mesh: 40124, breed: 4, sex: 1, race: 1}
+ - {mesh: 40126, breed: 4, sex: 1, race: 1}
+ - {mesh: 40127, breed: 4, sex: 1, race: 1}
+ - {mesh: 40128, breed: 4, sex: 1, race: 1}
+ - {mesh: 40130, breed: 4, sex: 1, race: 1}
+ - {mesh: 40132, breed: 4, sex: 1, race: 1}
+bodies:
+ - breed: 1
+ sex: 2
+ textures:
+ 1: [8714, 8710, 8773, 8713, 8709]
+ 2: [8714, 8710, 8770, 8713, 8709]
+ 3: [8714, 8710, 8771, 8713, 8709]
+ - breed: 1
+ sex: 3
+ textures:
+ 1: [8849, 8850, 8865, 8853, 8848]
+ 2: [8849, 8850, 8863, 8853, 8848]
+ 3: [8849, 8850, 8864, 8853, 8848]
+ - breed: 2
+ sex: 2
+ textures:
+ 1: [8964, 8960, 8963, 8965, 8961]
+ - breed: 2
+ sex: 3
+ textures:
+ 1: [8885, 8886, 8887, 8884, 8883]
+ - breed: 3
+ sex: 2
+ textures:
+ 1: [8986, 8983, 8984, 8985, 8982]
+ - breed: 3
+ sex: 3
+ textures:
+ 1: [9028, 9024, 9023, 9027, 9026]
+ - breed: 4
+ sex: 1
+ textures:
+ 1: [9233, 9231, 9240, 9234, 9236]
diff --git a/server/gamedata/player_appearances_test.go b/server/gamedata/player_appearances_test.go
@@ -0,0 +1,37 @@
+package gamedata
+
+import "testing"
+
+func TestPlayerAppearanceCatalogContainsTheOriginalCreatorChoices(t *testing.T) {
+ expected := []struct {
+ breed, sex uint16
+ count int
+ first, last uint32
+ }{
+ {1, 2, 52, 40681, 40680}, {1, 3, 52, 40629, 40628},
+ {2, 2, 30, 40261, 40284}, {2, 3, 31, 40224, 40246},
+ {3, 2, 30, 40185, 40206}, {3, 3, 30, 40151, 40169},
+ {4, 1, 30, 40111, 40132},
+ }
+
+ groups := make(map[[2]uint16][]uint32)
+ meshes := make(map[uint32]bool)
+ for _, head := range PlayerAppearances.Heads {
+ if meshes[head.Mesh] {
+ t.Fatal("duplicate creator head mesh")
+ }
+ meshes[head.Mesh] = true
+ key := [2]uint16{head.Breed, head.Sex}
+ groups[key] = append(groups[key], head.Mesh)
+ }
+
+ if len(PlayerAppearances.Heads) != 255 || len(PlayerAppearances.Bodies) != 7 || len(groups) != 7 {
+ t.Fatal("creator choices are incomplete")
+ }
+ for _, group := range expected {
+ heads := groups[[2]uint16{group.breed, group.sex}]
+ if len(heads) != group.count || heads[0] != group.first || heads[len(heads)-1] != group.last {
+ t.Fatalf("unexpected breed %d sex %d head catalog", group.breed, group.sex)
+ }
+ }
+}
diff --git a/server/main_test.go b/server/main_test.go
@@ -360,7 +360,7 @@ func TestWorldCookieThenPing(t *testing.T) {
if hex.EncodeToString(updates[1][122:154]) != "0000001c00000000000000000000000002010001000100010001000000020000" {
t.Fatalf("player vehicle state: %x", updates[1][122:154])
}
- if hex.EncodeToString(updates[1][37:41]) != "000002d8" || hex.EncodeToString(updates[1][154:158]) != "00009eea" {
+ if hex.EncodeToString(updates[1][37:41]) != "000002d8" || hex.EncodeToString(updates[1][154:158]) != "00009ee9" {
t.Fatalf("player head mesh: %x", updates[1])
}
if hex.EncodeToString(updates[1][159:163]) != "0000276a" || hex.EncodeToString(updates[1][197:215]) != "68616e647300000022450000000000000000" {
diff --git a/server/npcs_test.go b/server/npcs_test.go
@@ -161,7 +161,7 @@ func TestEveryAuthoredPopulationIsPreserved(t *testing.T) {
if total != 68609 || populated != 251 {
t.Fatalf("coverage: %d NPCs in %d playfields", total, populated)
}
- if len(guard) < 195 || binary.BigEndian.Uint32(guard[37:41]) != 0x2d1 || binary.BigEndian.Uint32(guard[134:138]) != 40682 || !bytes.Equal(guard[177:195], []byte("hands\x00\x00\x00\x22\x45\x00\x00\x00\x00\x00\x00\x00\x00")) {
+ if len(guard) < 195 || binary.BigEndian.Uint32(guard[37:41]) != 0x2d1 || binary.BigEndian.Uint32(guard[134:138]) != 40681 || !bytes.Equal(guard[177:195], []byte("hands\x00\x00\x00\x22\x45\x00\x00\x00\x00\x00\x00\x00\x00")) {
t.Fatalf("human NPC head and hand material: %x", guard)
}
if binary.BigEndian.Uint32(guard[96:100]) != 26092 {
diff --git a/server/profile_database.go b/server/profile_database.go
@@ -1,7 +1,7 @@
package main
// These columns are shared by players and NPCs; the pointers serve SQL scans and writes.
-const profileColumns = "name, appearance_race, appearance_fatness, appearance_breed, appearance_sex, appearance_side, appearance_head, " +
+const profileColumns = "name, appearance_race, appearance_fatness, appearance_breed, appearance_sex, appearance_side, appearance_head, head_mesh, height, " +
"monster_data, level, experience, insured_experience, profession, improvement_points, abilities_strength, abilities_agility, abilities_stamina, " +
"abilities_intelligence, abilities_sense, abilities_psychic, body_martial_arts, body_brawling, body_riposte, body_dimach, " +
"body_adventuring, body_swimming, body_body_development, body_nano_pool, melee_one_hand_blunt, melee_one_hand_edged, " +
@@ -23,7 +23,7 @@ const profileColumns = "name, appearance_race, appearance_fatness, appearance_br
func (profile *playerProfile) fields() []any {
return []any{
&profile.Name, &profile.Appearance.Race, &profile.Appearance.Fatness, &profile.Appearance.Breed,
- &profile.Appearance.Sex, &profile.Appearance.Side, &profile.Appearance.Head, &profile.MonsterData,
+ &profile.Appearance.Sex, &profile.Appearance.Side, &profile.Appearance.Head, &profile.HeadMesh, &profile.Height, &profile.MonsterData,
&profile.Level, &profile.Experience, &profile.InsuredExperience, &profile.Profession, &profile.Stats.ImprovementPoints, &profile.Stats.Abilities.Strength,
&profile.Stats.Abilities.Agility, &profile.Stats.Abilities.Stamina, &profile.Stats.Abilities.Intelligence, &profile.Stats.Abilities.Sense,
&profile.Stats.Abilities.Psychic, &profile.Stats.Body.MartialArts, &profile.Stats.Body.Brawling, &profile.Stats.Body.Riposte,
diff --git a/server/state.go b/server/state.go
@@ -19,6 +19,8 @@ type character struct {
position [3]float32
rotation [4]float32
appearance uint16
+ headMesh uint32
+ height uint16
monsterData uint32
level uint16
experience uint32
diff --git a/server/target_protocol_test.go b/server/target_protocol_test.go
@@ -98,7 +98,7 @@ initialized:
if hex.EncodeToString(npc[60:89]) != "000001cb0b456469746564204e50430000000000000000000000000007" {
t.Fatalf("target NPC appearance, name and new stats: %x", npc[60:89])
}
- if hex.EncodeToString(full[57:105]) != "000003f10001766f0000003600000001000000340000000000000039000000000000015e000005aa000000ec00000000" {
+ if hex.EncodeToString(full[57:105]) != "000003f100017a600000003600000001000000340000000000000039000000000000015e000005aa000000ec00000000" {
t.Fatalf("target seventh list and initial progression/insurance stats: %x", full[57:105])
}
}
diff --git a/server/users.go b/server/users.go
@@ -23,6 +23,8 @@ type userData struct {
Position [3]float32
Rotation [4]float32
Appearance uint16
+ HeadMesh uint32
+ Height uint16
MonsterData uint32
Level uint16
Experience uint32
@@ -39,6 +41,8 @@ type playerProfile struct {
ID uint32 `yaml:"id"`
Name string `yaml:"name"`
Appearance appearanceFields `yaml:"appearance"`
+ HeadMesh uint32 `yaml:"head_mesh"`
+ Height uint16 `yaml:"height"`
MonsterData uint32 `yaml:"monster_data"`
Level uint16 `yaml:"level"`
Experience uint32 `yaml:"experience"`
@@ -60,13 +64,16 @@ type playerPosition struct {
}
func (character *character) userData() userData {
- return userData{character.id, character.name, character.playfield, character.position,
- character.rotation, character.appearance, character.monsterData, character.level, character.experience, character.insuredExperience, max(1, character.profession), character.baseStats(), character.running, character.returnDoor, character.browserTokenHash}
+ return userData{ID: character.id, Name: character.name, Playfield: character.playfield, Position: character.position,
+ Rotation: character.rotation, Appearance: character.appearance, HeadMesh: character.headMesh, Height: character.height,
+ MonsterData: character.monsterData, Level: character.level, Experience: character.experience, InsuredExperience: character.insuredExperience,
+ Profession: max(1, character.profession), Stats: character.baseStats(), Running: character.running, ReturnDoor: character.returnDoor, BrowserTokenHash: character.browserTokenHash}
}
func (data userData) character() *character {
character := &character{id: data.ID, name: data.Name, playfield: data.Playfield, position: data.Position,
- rotation: data.Rotation, appearance: data.Appearance, monsterData: data.MonsterData, level: data.Level, experience: data.Experience,
+ rotation: data.Rotation, appearance: data.Appearance, headMesh: data.HeadMesh, height: data.Height,
+ monsterData: data.MonsterData, level: data.Level, experience: data.Experience,
insuredExperience: data.InsuredExperience,
profession: max(1, data.Profession),
running: data.Running,
diff --git a/server/world.go b/server/world.go
@@ -103,7 +103,7 @@ func characterPacket(character *character) []byte {
for _, value := range []uint32{character.maximumHealth() - uint32(character.inventory.equipmentBonus(1)), character.health, character.monsterData} {
body = binary.BigEndian.AppendUint32(body, value)
}
- body = binary.BigEndian.AppendUint16(body, 100)
+ body = binary.BigEndian.AppendUint16(body, character.baseScale())
// Stationary velocity, movement commands, control state, and empty path.
vehicle := make([]byte, 28)
copy(vehicle[12:22], []byte{2, 1, 0, 1, 0, 1, 0, 1, 0, 1})
@@ -119,16 +119,10 @@ func characterPacket(character *character) []byte {
}
body = binary.BigEndian.AppendUint32(body, uint32(len(vehicle)))
body = append(body, vehicle...)
+ head, textures := uint32(0), [5]uint32{}
if human {
// Supply the head mesh before the client refreshes its appearance.
- head := uint32(40682)
- if character.appearance>>4&7 == 1 {
- heads := [8]uint32{40682, 40683, 40684, 40666, 40686, 40687, 40688, 40689}
- if character.appearance>>7&3 == 3 {
- heads = [8]uint32{40630, 40631, 40632, 40633, 40634, 40635, 40636, 40637}
- }
- head = heads[character.appearance>>11&7]
- }
+ head, textures = character.appearanceAssets()
body = binary.BigEndian.AppendUint32(body, head)
}
body = append(body, 100)
@@ -139,10 +133,6 @@ func characterPacket(character *character) []byte {
} else {
body = binary.BigEndian.AppendUint32(body, 10090)
}
- textures := [5]uint32{8714, 8710, 8773, 8713, 8709}
- if character.appearance>>4&7 == 1 && character.appearance>>7&3 == 3 {
- textures = [5]uint32{8849, 8850, 8865, 8853, 8848}
- }
for index, material := range []string{"arms", "feet", "hands", "legs", "body"} {
body = append(body, material...)
body = append(body, 0)
@@ -207,6 +197,7 @@ func fullCharacterPacket(character *character) []byte {
[2]uint32{37, character.titleLevel()}, [2]uint32{368, uint32(max(1, character.profession))},
[2]uint32{51, uint32(character.aggDef)}, [2]uint32{61, character.inventory.Credits},
[2]uint32{47, uint32(character.appearance >> 2 & 3)},
+ [2]uint32{360, uint32(character.baseScale())},
[2]uint32{214, character.nano}, [2]uint32{221, character.maximumNano() - uint32(character.inventory.equipmentBonus(221))})
if time.Now().Before(character.implantChangesUntil) {
stats = append(stats, [2]uint32{224, 16})
diff --git a/server/world.sql b/server/world.sql
@@ -16,6 +16,8 @@ CREATE TABLE IF NOT EXISTS characters (
appearance_sex INTEGER NOT NULL DEFAULT 0 CHECK (appearance_sex BETWEEN 0 AND 3),
appearance_side INTEGER NOT NULL DEFAULT 0 CHECK (appearance_side BETWEEN 0 AND 3),
appearance_head INTEGER NOT NULL DEFAULT 0 CHECK (appearance_head BETWEEN 0 AND 31),
+ head_mesh INTEGER NOT NULL DEFAULT 0 CHECK (head_mesh BETWEEN 0 AND 4294967295),
+ height INTEGER NOT NULL DEFAULT 0 CHECK (height BETWEEN 0 AND 65535),
monster_data INTEGER NOT NULL DEFAULT 0,
level INTEGER NOT NULL DEFAULT 1,
experience INTEGER NOT NULL DEFAULT 0 CHECK (experience BETWEEN 0 AND 4294967295),
diff --git a/tools/data/extract_player_appearances.py b/tools/data/extract_player_appearances.py
@@ -0,0 +1,171 @@
+import hashlib
+import json
+import pathlib
+import re
+import struct
+
+import ao_database
+
+
+def read_pe_rva(data, address, size):
+ pe = struct.unpack_from('<I', data, 0x3c)[0]
+ count = struct.unpack_from('<H', data, pe + 6)[0]
+ optional_size = struct.unpack_from('<H', data, pe + 20)[0]
+ image_base = struct.unpack_from('<I', data, pe + 24 + 28)[0]
+ rva = address - image_base
+ for index in range(count):
+ section = pe + 24 + optional_size + index * 40
+ _, virtual_address, raw_size, raw_pointer = struct.unpack_from('<4I', data, section + 8)
+ if virtual_address <= rva and rva + size <= virtual_address + raw_size:
+ offset = raw_pointer + rva - virtual_address
+ return data[offset:offset + size]
+ raise ValueError(f'unmapped PE bytes: {address:x}')
+
+
+# Match ddr.dll FUN_10030230's ordered filename scans and explicit exclusions.
+root = pathlib.Path(__file__).resolve().parents[2]
+client = root / 'anarchy-vanilla-14.9.1'
+assert (client / 'version.id').read_text().strip() == '14.9.1'
+assert hashlib.sha256((client / 'ddr.dll').read_bytes()).hexdigest() == '3c937161de8f690351c3c08e158431417cee9ced77a41b677e7123b61a8c9883'
+database = ao_database.Database(client)
+registry = database.read(1000010, 1)
+bbr = (client / 'bbr.dll').read_bytes()
+assert hashlib.sha256(bbr).hexdigest() == '28f196f650edbb1573fb874ccaf7746453d3e4a183e1d86db1d790c1c32ecc2c'
+totally_green = list(struct.unpack('<11I', read_pe_rva(bbr, 0x10155c6c, 44)))
+partially_green = list(struct.unpack('<271I', read_pe_rva(bbr, 0x10155c98, 1084)))
+assert totally_green == [8711, 8712, 8852, 9232, 9235, 85936, 85937, 85938, 85939, 85940, 100021]
+filenames = {}
+for match in re.finditer(rb'[ -~]{5,}', registry):
+ identity, length = struct.unpack_from('<II', registry, match.start() - 8)
+ if length == (len(match.group()) // 4 + 1) * 4:
+ filenames[match.group().decode('ascii')] = identity
+
+scans = [
+ (1, 2, 1, 'solitusmale', 51, {3, 4, 10, 11, 12, 14, 28, 29, 31, 32, 34, 37, 41, 47}),
+ (1, 2, 2, 'solitusmale_african', 9, set()),
+ (1, 2, 3, 'solitusmale_asian', 6, set()),
+ (1, 3, 1, 'solitusfemale', 50, {3, 4, 8, 9, 10, 13, 14, 22, 29, 30, 43, 46, 47}),
+ (1, 3, 2, 'solitusfemale_african', 8, set()),
+ (1, 3, 3, 'solitusfemale_asian', 7, set()),
+ (2, 2, 1, 'opifexmale', 30, set()),
+ (2, 3, 1, 'opifexfemale', 32, {30}),
+ (3, 2, 1, 'nanomale', 30, set()),
+ (3, 3, 1, 'nanofemale', 30, set()),
+ (4, 2, 1, 'athrox', 30, set()),
+]
+heads = []
+counts = {}
+for breed, sex, race, prefix, limit, excluded in scans:
+ key = (breed, sex)
+ for number in range(limit):
+ if number in excluded:
+ continue
+ filename = f'head_{prefix}{number:02d}.abiff'
+ if filename not in filenames:
+ continue
+ mesh = filenames[filename]
+ assert mesh != filenames['default_mesh.abiff']
+ assert (1010001, mesh) in database.records
+ payload = database.read(1010001, mesh)
+ index = counts.get(key, 0)
+ heads.append(dict(breed=breed, sex=sex, creation_sex=1 if breed == 4 else sex,
+ race=race, catalog_index=index,
+ creation_head_index=index,
+ filename_number=number, packed_head_index=None,
+ mesh=mesh, filename=filename,
+ record_file_offset=database.records[1010001, mesh],
+ payload_sha256=hashlib.sha256(payload).hexdigest()))
+ counts[key] = index + 1
+assert counts == {(1, 2): 52, (1, 3): 52, (2, 2): 30, (2, 3): 31,
+ (3, 2): 30, (3, 3): 30, (4, 2): 30}
+assert len({head['mesh'] for head in heads}) == 255
+
+# Preserve both authored default materials and separately named naked skin assets.
+bodies = []
+for breed, sex, body_prefix, skin_prefix in [
+ (1, 2, 'solitus_male', 'solitusmale'),
+ (1, 3, 'solitus_female', 'solitusfemale'),
+ (2, 2, 'opifex_male', 'opifexmale'),
+ (2, 3, 'opifex_female', 'opifexfemale'),
+ (3, 2, 'nanomage_male', 'nanomagemale'),
+ (3, 3, 'nanomage_female', 'nanomagefemale'),
+ (4, 2, 'athrox_male', 'athroxmale'),
+]:
+ meshes = []
+ for build, suffix in [(0, '_thin'), (1, ''), (2, '_fat')]:
+ filename = body_prefix + suffix + '.cir'
+ identity = filenames[filename]
+ assert (1010002, identity) in database.records
+ body = database.read(1010002, identity)
+ for material in ['arms', 'feet', 'hands', 'legs', 'body']:
+ assert f'{material}_{skin_prefix}_default.png'.encode() in body
+ meshes.append(dict(build=build, mesh=identity, filename=filename))
+ defaults = {}
+ skins = {}
+ for material in ['arms', 'feet', 'hands', 'legs', 'body']:
+ filename = f'{material}_{skin_prefix}_default.png'
+ defaults[material] = dict(texture=filenames[filename], filename=filename)
+ for race in ([1, 2, 3] if breed == 1 else [1]):
+ ethnicity = {1: 'caucation', 2: 'african', 3: 'asian'}[race]
+ suffix = f'_{ethnicity}' if breed == 1 else ''
+ filename = f'{material}_{skin_prefix}{suffix}_naked.png'
+ skins.setdefault(race, {})[material] = dict(texture=filenames[filename],
+ filename=filename)
+ bodies.append(dict(breed=breed, sex=sex, creation_sex=1 if breed == 4 else sex,
+ body_meshes=meshes,
+ default_materials=defaults, named_naked_materials=skins))
+ resolved = {}
+ for race, skin in skins.items():
+ resolved[race] = {}
+ for material, default in defaults.items():
+ assert default['texture'] not in partially_green
+ resolved[race][material] = skin[material] if default['texture'] in totally_green else default
+ bodies[-1]['resolved_default_materials'] = resolved
+database.close()
+
+# Retain explicit uncertainty: catalog ordinal is not proven packed wire face value.
+result = dict(
+ version='14.9.1',
+ source=dict(registry_type=1000010, registry_id=1,
+ registry_record_file_offset=database.records[1000010, 1],
+ registry_payload_sha256=hashlib.sha256(registry).hexdigest(),
+ ddr_sha256=hashlib.sha256((client / 'ddr.dll').read_bytes()).hexdigest(),
+ initializer='ddr.dll!FUN_10030230',
+ creation_request='ddr.dll!NameScene_t::SetState@10034000',
+ bbr_sha256=hashlib.sha256(bbr).hexdigest(),
+ material_resolution='bbr.dll!VisualCATMesh_t::ChangeClothes@10096190',
+ material_resolution_evidence='ev_ac790c71d1530d14cb9cfc4494ea2d8a9cf0bcee90117c9ea219ddb00c40a1d1',
+ evidence_id='ev_2b8353978327f54ecc423e5b8b965d32a308dc9e035ca81b3d4fb1a04f2ee8e6'),
+ limitations=[
+ 'catalog_index is the zero-based index in the native breed/sex selection vector.',
+ 'creation_head_index is CCSelectedHead passed to Client_t::CreateCharacter.',
+ 'sex is preview sex; creation_sex is sent by NameScene helper 10038b40. Atrox uses 2 in preview, 1 in creation.',
+ 'packed_head_index is unknown; do not truncate catalog_index into five wire bits.',
+ 'default_materials are authored defaults, including green placeholder hands.',
+ 'named_naked_materials are resource identities; historical startup clothing remains unverified.',
+ 'resolved_default_materials reproduce native creation preview default-clothing resolution, not starter-item equipment.',
+ ],
+ native_cloth_classification=dict(totally_green=totally_green, partially_green=partially_green),
+ heads=heads,
+ bodies=bodies,
+)
+output = root / 'local/character-creation-research/appearance-catalog.json'
+output.parent.mkdir(parents=True, exist_ok=True)
+output.write_text(json.dumps(result, indent=2) + '\n')
+print(output)
+print('Heads:', len(heads), 'counts:', counts)
+
+# Publish explicit mesh identities and resolved materials; face wire bits remain unknown.
+lines = ['# Generated from the original 14.9.1 creator and filename registry.', 'heads:']
+for head in heads:
+ lines.append(' - {mesh: %d, breed: %d, sex: %d, race: %d}' %
+ (head['mesh'], head['breed'], head['creation_sex'], head['race']))
+lines.append('bodies:')
+for body in bodies:
+ lines.extend([f" - breed: {body['breed']}", f" sex: {body['creation_sex']}",
+ ' textures:'])
+ for race, materials in body['resolved_default_materials'].items():
+ lines.append(f' {race}: ' + json.dumps([materials[name]['texture'] for name in ['arms', 'feet', 'hands', 'legs', 'body']]))
+output = root / 'server/gamedata/player_appearances.yaml'
+output.write_text('\n'.join(lines) + '\n')
+print(output)