Skip to content

Zone Protocol

Pazaz edited this page Jun 3, 2024 · 45 revisions

Observations

Static means "in the map data at startup"
Dynamic means "changed at runtime"

  1. PARTIAL_ENCLOSED is used to send this tick's changes. A new shared buffer must be created each tick there are changes.
  2. FULL_FOLLOWS clears the zone of changes and is sent while loading. Static map changes that happened in the past are sent here while loading.
  3. Public OBJ events are sent individually with PARTIAL_FOLLOWS while loading. FULL_FOLLOWS is still sent, right before this.
  4. Private OBJ events are not enclosed and get sent individually with PARTIAL_FOLLOWS.
  5. Public changes (OBJ/LOC) and transient events (projanim, locmerge) are sent with PARTIAL_ENCLOSED.
  6. Private items do not combine with public items, new stacks are always created. Attempting to pick up one will take the public item first.
    image
  7. Teleporting to another floor (i.e. taking stairs) will clear zones and send FULL_FOLLOWS for the current level.
  8. Tracks 3x3 area of zones around the player. With 48 as the center zone start, 24 is -3*8, 72 is +3*8.

OSRS: logging into an area does not show items that were previously dropped by players.

Network Traffic

Logging in

Under each UPDATE_ZONE line is the build area-relative coordinate.
Zone base: build area x, build area z, level

Loading 3206, 3224, 2. This is right by lumbridge bank booths. There are normal log spawns nearby

Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 24, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 32, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 40, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 48, 2
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 24, 48, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 56, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 64, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 56, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 64, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 24, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 32, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 40, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 48, 2
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 48, 48, 2
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 48, 48, 2
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 56, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 64, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 72, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 24, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 32, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 40, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 48, 2
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 48, 2
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 48, 2
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 56, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 64, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 72, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 24, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 32, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 40, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 48, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 56, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 64, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 72, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 24, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 32, 2
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 72, 32, 2
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 40, 2
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 72, 40, 2
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 48, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 56, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 64, 2
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 72, 2

Logging in after someone has lit 2 normal logs (same location)

Packet received: UPDATE_ZONE_FULL_FOLLOWS
Packet received: LOC_ADD_CHANGE
Packet received: LOC_ADD_CHANGE

Loading 3217, 3276, 0. This is in between both lumbridge farms

Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 48, 0
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 24, 48, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 64, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 24, 72, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 48, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 64, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 32, 72, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 48, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 64, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 40, 72, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 48, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 64, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 48, 72, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 48, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 64, 0
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 64, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 64, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 56, 72, 0
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 72, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 72, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 56, 72, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 48, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 64, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 64, 72, 0
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Zone base: 64, 72, 0
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 24, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 32, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 40, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 48, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 56, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 64, 0
Packet received: UPDATE_ZONE_FULL_FOLLOWS
Zone base: 72, 72, 0

Chopping a tree down

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_ADD_CHANGE

Opening a door

Normally

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_DEL
Partial zone update: LOC_ADD_CHANGE

In between two zones

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_DEL
Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_ADD_CHANGE

Closing a door

Normally

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_DEL
Partial zone update: LOC_ADD_CHANGE

In between two zones

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_ADD_CHANGE
Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_DEL

Dropping item

Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_ADD

Picking up dropped item

Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_DEL

Dropping a stackable item on the same item

Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_COUNT

Picking up static item spawn

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: OBJ_DEL

Static item respawning

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: OBJ_ADD

Lighting static logs

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: OBJ_DEL
Partial zone update: LOC_ADD_CHANGE

Lighting dynamic logs

Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_DEL
Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_ADD_CHANGE

Lit logs disappearing

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_DEL

Dropping a stackable item on a static item spawn

Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_ADD

Observing another player's item after it's revealed

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_ADD

Picking up another player's item after it's revealed

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: OBJ_DEL

Ranged attack

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: MAP_PROJANIM
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_ADD
Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: MAP_PROJANIM
Packet received: UPDATE_ZONE_PARTIAL_FOLLOWS
Packet received: OBJ_COUNT

Agility shortcut

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_MERGE

Area sound effect

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: SOUND_AREA

Loc animation

Operating the spinning wheel in lumbridge castle

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: LOC_ANIM

Casting telegrab

Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: MAP_PROJANIM
Partial zone update: MAP_ANIM
Partial zone update: SOUND_AREA
...
Packet received: UPDATE_ZONE_PARTIAL_ENCLOSED
Partial zone update: OBJ_DEL

Kris' Notes

The way I see it, it should really just be... and this is some kotlin pseudocode, but that's irrelevant:

class Zone {
    private val enclosedEvents: List<ZoneEvent>
    private val followsEvents: List<ZoneEvent>

    fun addEvent(event: ZoneEvent) {
        // determine the collection based on the event
        // e.g. map anim would go in enclosed, but obj add prob in follows
        collection.add(event)
    }
}

interface ZoneEvent : OutgoingPacket

class LocAddEvent(packet_properties) : ZoneEvent // packet impl etc

Zone would furthermore have another collection to actually store information of every loc that exists. Don't mix the visual representation of packets w/ the underlying data. Whenever you add a new loc to the collection, you also add a locadd event to the zone events. Same with deletion, etc.

(The below is regarding syncing old changes done to zones in the past, e.g. a tree that spawned 30 seconds ago) This other collection needs to contain information of two types - the original loc(or lack of) and the currently-visible loc, so that you can determine/on-demand build a list of old events that happened in the past by comparing the original loc and the currently visible loc, e.g:

  • If original loc exists, and current loc != original, LocAdd(currently_visible_loc)
  • If original loc does not exist, and current loc exists, LocAdd(currently_visible_loc)
  • If original loc exists, and current loc does not exist, LocDel(original_loc)
  • Otherwise, do nothing - only if both are the same (either both nulls, or both equal in value)

So whenever you actually spawn a loc, you'd be doing something like....

class Zone {
    // other shit above

    fun addLoc(loc: Loc) {
        val existing = locCollection.add(loc)
        if (existing == loc) return // no need to change anything if equal
        events += LocAdd(loc)
        if (existing != null) {
            removeClipping(existing)
        }
        addClipping(loc)
    }
}

... etc

Clone this wiki locally