Skip to content

World Processing Cycle

Pazaz edited this page Nov 20, 2023 · 39 revisions

Each section is listed in order.

World processing

  • world queue
  • NPC spawn scripts
  • NPC hunt

Client input

  • read packets
  • calculate pathfinding request (if not using clientside pathfinding)

note: pathfinding calculates once at the end to save processing time! do not do it for every move packet
note: if using clientside pathfinding, the server still has to validate the input (like every other packet should)

NPC processing

  • if not busy:
    • resume suspended script
    • stat regen
    • timer
    • queue
    • movement
      • theory: movecheck trigger, to conditionally cancel movement (bind effects)
    • modes
      • null, none, wander, patrol, playerescape, playerfollow, playerface, playerfaceclose, op/ap interactions

note: npc stat regen is done at the engine level here, not like player stat regen
note: null mode will set to default mode this tick, which will run starting next tick

Controller processing

  • timer
  • queue

note: controllers do not exist in these early years. Included for completeness.

Player processing

  • resume suspended script
  • close interface if strong queued
  • primary queue
  • weak queue
  • timers
  • soft timers
  • engine queue
    • levelup trigger (queued after gaining a level)
    • area trigger (not in 2004)
    • (maybe run energy restore?)
  • loc/obj interactions
  • movement (the pathfinding request)
    • theory: run movecheck trigger, to conditionally cancel movement (bind effects)
    • theory/custom: run move trigger, to execute a script when entering a new tile (area system does not exist in 2004)
  • player/npc interactions
  • close interface if attempting to logout

note: player stat regen is a soft timer
note: player run energy is at the engine level (not controlled in runescript)
note: weak queues were introduced september 2004, and strong came separately after that
note: while movecheck is just a theory, we are able to override freezes with other effects which proves there can only be 1 registered trigger

Player logout

note: this isn't observable to test, so may be swapped with the section below (loc/obj despawn/respawn)

Loc/obj despawn/respawn

Client output

  • map update (load new zones)
  • player info
  • npc info
  • zone updates
  • stat changes
  • flush packets
Clone this wiki locally