feat(places): the cache names its own places, and a bank you can ask for #230
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/places"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Archive 16 is the world map, and nothing had ever opened it. Two of its files
are a gazetteer.
labelsstates 253 named places, each a name, a worldcoordinate and a text size — and the text size is a hierarchy Jagex authored:
18 regions (Kingdom of Misthalin, Karamja, Wilderness), 52 settlements
(Varrock at 3211,3450), 183 landmarks (Grand Exchange at 3168,3477). A
/ina name is a hard line break rather than spelling.
detailsstates 30 mapareas — main, misthalin_underground, godwars, zanaris — each with the world
regions it draws.
Sections in that second file are the trap. The client picks a section class by
an id byte whose meaning is one indirection away: WorldMapSectionType pairs an
id with a type and the switch is on the type, so ids 0 and 1 read as the
same class and are not. Every section maps world onto drawn map, so each
carries two coordinates and only the world end means anything here.
planesis a count, not a range.
The 30 areas are the partition
planehas never been. Caves, dungeons andmines are plane 0 at high y, so a plane filter put an underground bank and a
surface one in one bucket and the distance between them was a number with no
physical meaning. Bot.Sites.nearest_bank/2 now asks World.Places.same_area?/2
in both modes: a bot in the Dwarven Mines is offered the Dwarven Mines bank, a
bot in Misthalin Underground is offered nothing, and Bot.Travel.recover/2
sends it to the respawn point rather than relocating it into a dungeon.
Refusing was not previously an available answer.
What the cache does not state is an extent — no polygon bounds any of the 253,
because a label is drawn where the cartographer put the text. So a catchment
is derived per rank at 8-tile chunk granularity, nearest anchor wins, ties
broken by key. Chunks rather than tiles because the line between Varrock and
Edgeville is an opinion, and tile precision would dress a guess up as a
measurement. Three corrections it needed: a catchment must not cross a map
area, or a surface anchor claims Zanaris; an island projects a kingdom's
radius across water, since rank is prominence on the map and not size on the
ground, and a land flood fill cannot fix it here because sea tiles are not
reliably blocked in this cache (#118) — five authored radii instead; and a
landmark's reach wants to be half the distance to the nearest settlement
rather than a constant, which is what separates Camelot Castle from the
Falador east bank.
The rule that keeps it honest: nothing with its own geometry may consult this.
World.Wilderness is clientscript 384, World.MultiCombat is polygons,
World.ClanWars.Arenas is measured boxes. Each is exact and each is a rule. The
catchment says what to call a tile and never what may happen on one, and
World.PlacesWorldTest pins that by asserting the wilderness naming agrees with
the rule to within one chunk — which makes "approximate" a measured bound
instead of an excuse.
Five names are placed more than once, so a key is a slug qualified by the
region it stands in (:chaos_temple_wilderness) and resolve/1 answers a list.
Handing back one of two identically named places is the id-by-name mistake in
another costume.
For bots: every derived bank carries the place it stands in and the side of
that place it is on, so bank(:varrock, :east) is the east bank on every boot.
61 of 74 fall in a named place; the 13 that do not are in dungeons. choose/2
still rolls, because a fleet all picking the nearest would pile onto one site
— but a roll is right for "go and chop something" and wrong for a named
destination, and two bots given one instruction landing at two booths was the
whole complaint.
Two measurements came out the other way and are worth keeping. "Drawn" filters
nothing: all 253 anchors stand on rendered terrain, Menaphos and Sophanem
included, so the test that was going to name three unreleased places would
have found zero and called it a clean bill of health. "Walkable" finds two,
and they are different kinds of thing — Prifddinas is drawn and sealed because
it postdates this cache, while the Poison Waste is in era and simply has its
label printed on impassable swamp.