Player Updating is a packet sent every game tick (600ms) to the client. Without sending this packet, the client will logout after 3-4 seconds. This packet sends the following information to the client:
- Your movement to a new tile.
- movement of everyone around you
- position of any new players who entered your area
- Your appearance (equipment), along with any animation, gfx, chat text, face entity, face tile, hit mask1, hitmask2, forced movement, forced chat your may be doing this game tick.
- appearance of everyone around you
- appearance of new players
There is a detailed breakdown of the #570 GPI (global player information) aka player update packet here.
Note: before you send the GPI packet, you must make sure you send a update map region packet if your character has changed region.
Example
Here is a Pseudocode example of this packet:
GNI / NPC updating packet
(graphical NPC information aka npc updating) This is pretty much identical, except it is for npcs that are in your area and not players. It uses a different packet opcode but the structure is extremely similar.
Player Update Masks
A 'mask' is a flag (like a boolean) representing if the server is sending information to the client above one of the following:
- Face coordinate (tile)
- Forced chat
- Hit splat 1
- Hit splat 2
- Face entity
- Appearance
- Graphic (gfx)
- Animation (anim, emote)
- Forced movement
- Chat
Face coordinate: face a tile of x,y
Face entity: face an entity visible in your local arena. Player rotates as the target entity moves around
Hit splat 1/2 - damage like miss/hit/poison/venom appearing on the player
Chat/forced chat - Chat is your basic talk. Force chat doesn't appear in the chatbox for others, but does for you. It appears above your head.
Anim/gfx - self explanatory
Appearance (gender, skin colour, clothes, armour, weapon, username, combat level
Forced movement - makes your player move without you clicking. Used for agility and jumping over the wilderness ditch.
NPC update masks
Most are the same as the player masks, except there is one additional mask: Transformation
This allows an npc to transform (change definition) into another NPC type .. for example a man into a woman, so the server doesn't have to delete and add a new npc just to change what one looks like.
This is used for the Dagannoth mother in the Horror from the Deep quest. Also in Recipe for Disaster finale battle. In later revisions it is used to transform Tormented Demons into different types - that look the same but have a different protection prayer over their head.
How to send these masks
Uses bit shifting - for info see 'the client' section (varbit sub-section)
int mask = 0;
if(chat)
mask |= 0x1;
if(gfx)
mask |= 0x2;
etc
Appearance mask limitation/cap
The appearance mask block in 317 is at least 52 bytes, reaching up to 64 with a 12 character username. The client's incoming buffer size is only 5000 bytes, which means you can only read 5,000 bytes per cycle from the server. In turn, 5000/52 = 96 appearance blocks maximum can be sent per cycle, even though you can see 255 players in your area. This means in these rare circumstances of having 96+ players altar their appearance you will not see them all one the cycle they occur.
Finding these packets in a client
See The Client