Overall

Network communication in Terraria is done via a series of Messages. It is not a request/response system. The client sends messages when it wants to notify the server or changes (the player moves, for example), and the server sends messages when it wants to notify the client of changes (another player talks, for example).

That said, there are times when certain responses are to be expected. The login process, for example. This is laid out in the last section on this page.

The structure of the general message is defined below.

Type Formats

The types used in messages are little-endian.

TypeBytesNotes
Byte1Unsigned 0 .. 255
Int162Signed -32,768 .. 32,767
Int324Signed -2,147,483,648 .. 2,147,483,647
Single4Single precision float
Color3Three unsigned bytes that define R,G,B values
String*ASCII string, length must be derived from message size

Message Structure

OffsetTypeDescription
0Int32Message Length
1ByteMessage Type
2*Message Payload

Message Length is the length of Type + Payload in bytes. The smallest message is one without a payload, so Message Length would be 1 in that case.

The Payload is dependent on the Message Type, see below.

Message Types

What follows is a detailed list of all the available message types. It is also specified if the message is sent by the client or the server or both. The Message IDs are specified in hex, as indicated by the '$'. During the login process, the client is only allowed to send the messages marked with an asterisk. Attempts to send any other message will result in an error, and disconnection.

$01 — Connect Request (client → server) *

This is the first message sent by the client to the server when it connects. It also notifies the server of the client version.

Payload

OffsetTypeDescription
0StringThe word Terraria concatenated with the current version. i.e. "Terraria37"

$02 — Fatal Error (client ← server)

The server sends this whenever there is an error. It will drop the connection right after this is sent.

Payload

OffsetTypeDescription
0StringThe error message.

$03 — Connection Approved (client ← server)

The server sends this message when the connection is successful. It also sends the client's assigned player slot. All connected players are assigned a slot, 0-254.

Payload

OffsetTypeDescription
0BytePlayer Slot

$04 — Player Appearance (client ↔ server) *

This defines a player's appearance and name.

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteHair Style
2ByteGender (0=female,1=male)
3ColorHair Color
6ColorSkin Color
9ColorEye Color
12ColorShirt Color
15ColorUndershirt Color
18ColorPants Color
21ColorShoe Color
24ByteDifficulty (0=normal, 1=medium core, 2=hard core)
25StringPlayer Name

Client → Server

The client sends this as part of the login process to notify the server of the player's appearance. There is nothing preventing the client from sending this after the login process, however. The server will enforce the player slot, so any attempts to change the appearance of other players will just change your own.

Client ← Server

The server will send this to the client to notify the client of other players' appearance. The client should ignore this message if the player slot is its own, since the server is not allowed to change any of this data.

$05 — Set Inventory (client ↔ server) *

This specifies what item is in a specific inventory slot. Slots 0 to 58 are inventory slots, Slots 59 to 69 are armor/accessory slots. Slots 70 to 72 are dye slots. A stack of 0 means the slot is empty.

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteInventory Slot
2Int16Item Stack
4ByteItem Prefix ID
5Int16Item ID

Client → Server

The client sends this to notify the server of the player's inventory. During the login process, the client sends 59 of these, one for each slot. It also sends this whenever the player modifies their inventory, either by moving something around, or pulling things out of chests, and so on. The server will enforce the player slot, so any attempts to modify the inventory of other players will just modify your own.

Client ← Server

The server sends this to notify the client of other players' inventories. The client should ignore this message if the player slot is its own, since the server is not allowed to modify your inventory.

$06 — Request World Information (client → server) *

Asks the server for world info. This is done as part of the login process.

Payload

None.

$07 — World Information (client ← server)

This message contains the basic information about the current world.

Payload

OffsetTypeDescription
0Int32Game Time
4ByteDay Time (0=No, 1=Yes)
5ByteMoon Phase
6ByteBlood Moon (0=No, 1=Yes)
7ByteEclipse (0=No, 1=Yes)
8Int32Map Width in Tiles
12Int32Map Height in Tiles
16Int32Spawn Tile X
20Int32Spawn Tile Y
24Int32Ground Level Y
28Int32Rock Layer Y
32Int32World ID
36ByteMoon Type
37Int32[3]Tree X
43Byte[4]Tree Style
47Int32[3]Cave Back X
59Byte[4]Cave Back Style
63Byte[8]Background Styles
71ByteIce Back Style
72ByteJungle Back Style
73ByteHell Back Style
74SingleWind Speed
78ByteNumber of Clouds
79ByteFlags:
BitMeaning
0Shadow Orb Smashed
1Killed Eye of Cthulu
2Killed Eater of Worlds
3Killed Skeletron
4Hard Mode
5Killed Clown
6Server-Side Character
7Killed Plantera
80ByteFlags:
BitMeaning
0Killed The Destroyer
1Killed The Twins
2Killed Skeletron Prime
3Killed Any of the Above
4Has Cloud Background
5World has Crimson
81SingleMax Rain
85StringWorld Name

$08 — Request initial tile data (client → server) *

The client sends this message to the server to request initial tile data. The client specifies the player's spawn X,Y. This may or may not be the same as the server spawn. The server sends a lot of messages in response to this. See the Login process below for more detail.

Payload

OffsetTypeDescription
0Int32Spawn X
4Int32Spawn Y

$09 — Statusbar text (client ← server)

The server uses this message to show status text to the client. This text is shown in the upper right corner of the screen. Number of messages is the number of messages the client should show the status text for. If the client receives this message multiple times, the client should queue them up.

Payload

OffsetTypeDescription
0Int32Number of messages.
4StringStatus text

$0A — Tile Row Data (client ← server)

This contains a small row of tile data, starting at Tile X, Tile Y, and running for Width tiles.

Payload

OffsetTypeDescription
0Int16Width
2Int32Tile X
6Int32Tile Y
10*Tile data

The tile data is represented like so:
ByteFlags:
BitMeaning
0Tile Active
1Not used
2Has Wall
3Has Liquid
4Has Red Wire
5Is Half Brick
6Has Actuator
7In Active
ByteFlags:
BitMeaning
0Has Green Wire
1Has Blue Wire
2Has Color
3Has Wall Color
4-5Slope
 If Has Color:
ByteColor
 If Has Wall Color:
ByteWall Color
 If Active:
ByteTile Type
 If Tile U,V is Important:
Int16Tile U
Int16Tile V
 If Tile has Wall:
ByteTile Wall
 If Tile has Liquid:
ByteLiquid Amount
ByteLiquid Type (0=water, 1=lava, 2=honey)
Int16RLE Amount

RLE Amount is the number of times to repeat this tile horizontally, these duplicate tiles count towards the Width defined above.

$0B — Recalculate U/V (client ← server)

The client should recalculate any random U/Vs for this area. This includes the walls.

Payload

OffsetTypeDescription
0Int32Start X
4Int32Start Y
8Int32End X
12Int32End Y

$0C — Spawn Player (client ↔ server) *

Sets player's spawn and respawn them.

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int32Spawn X
5Int32Spawn Y

Client → Server

The client sends this at the end of the login process to spawn the player. The server enforces the player slot so attempts to spawn another player will instead respawn the client's player.

Client ← Server

The server sends this whenever another player spawns.

$0D — Player Control (client ↔ server)

Set's the player's current position and velocity, along with their current control state.

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteControl Flags:
BitMeaning
0Up Currently Pressed
1Down Currently Pressed
2Left Currently Pressed
3Right Currently Pressed
4Jump Currently Pressed
5Use Item Currently Pressed
6Player Direction (0=Left,1=Right)
2ByteSelected Item Slot
3SinglePlayer Position X
7SinglePlayer Position Y
11SinglePlayer Velocity X
15SinglePlayer Velocity Y
16ByteFlags:
BitMeaning
0On Rope
1Rope Direction

Client → Server

The client sends this when the player presses a control. The server enforces the player slot so attempts to manipulate other players will just manipulate your own.

Client ← Server

The server sends this to notify the client of other players' movements. The client should ignore this message if the player slot is the client's, since the server is not allowed to modify any of this information.

$0E — Set Player Activity (client ← server)

Used to disable or enable players.

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteActive (0=false, 1=true)

$0F — Unused

Unused message.

$10 — Set Player Life (client ↔ server) *

Used to set the player's health stats

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int16Current Health Amount
3Int16Maximum Health Amount

Client → Server

The client sends this as part of the login process. The server enforces the player slot, so attempts to modify another person's health will only modify your own.

Client ← Server

The server sends this to notify the client of other player's health. The client should ignore this message if the player slot is the client's, since the server is not allowed to modify the player's health this way.

$11 — Modify Tile (client ↔ server)

Used to modify the world one tile at a time.

Payload

OffsetTypeDescription
0ByteModify Mode:
ValueMeaning
0Destroy Tile
1Place Tile
2Destroy Wall
3Place Wall
4Obliterate Tile (doesn't drop item)
5Place Wire
6Destroy Wire
7Pound Tile
8Place Actuator
9Destroy Actuator
10Place Green Wire
11Destroy Green Wire
12Place Blue Wire
13Destroy Blue Wire
14Slope Tile
1Int32Tile X
5Int32Tile Y
9ByteTile/Wall ID
10ByteTile Variant

Client → Server

Sent by the client when the player modifies a tile.

Client ← Server

Sent by the server when someone else modifies a tile.

$12 — Set Time (client ← server)

Sets the current game time.

Payload

OffsetTypeDescription
0ByteDay/Night (0=Night,1=Day)
1Int32Time
5Int16Sun Mod Y
7Int16Moon Mod Y

$13 — Open/Close Door (client ↔ server)

Open or Close a door

Payload

OffsetTypeDescription
0Byte0 = Open, 1 = Close
1Int32Tile X
5Int32Tile Y
9ByteFacing Direction (0 = left, 1 = right)

Client → Server

Sent when the player opens or closes a door.

Client ← Server

Sent when someone else opens or closes a door.

$14 — Tile Block (client ↔ server)

Updates a Length x Length block of tiles.

Payload

OffsetTypeDescription
0Int16Length
2Int32Tile X
6Int32Tile Y
10*Tile Data

Tile Data is stored exactly the same as it is stored in Message $0A, except the RLE is not present. There are Length x Length tiles represented

Client → Server

I don't know why the client is allowed to send this. Especially since it doesn't go through anti-spam filters.

Client ← Server

Sent when the server needs to update a chunk of blocks, like with falling sand. The client should update the U/V of the received tiles.

$15 — Update Item (client ↔ server)

An item is modified in the world.

Payload

OffsetTypeDescription
0Int16Item Slot
2SinglePosition X
6SinglePosition Y
10SingleVelocity X
14SingleVelocity Y
18Int16Stack Amount
20BytePrefix ID
21ByteOwn Ignore
22Int16Item ID

If Item ID is 0, this item slot is considered inactive.

Client → Server

Sent when a the player modifies an item in the world. If the item is to be created, Item Slot should be 200.

Client ← Server

Sent when an item in the world is modified. If the player created the item, the server won't tell the player about the item for a set amount of time, to prevent the player from accidentally picking it back up.

$16 — Set Owner of Item (client ↔ server)

Sets the owner of an item on the ground.

Payload

OffsetTypeDescription
0Int16Item Slot
2ByteOwner Player Slot

Client → Server

The client does this to disown an item. Setting the owner to 255. You can only do this for items you own. The server will force the new owner to be no one.

Client ← Server

The server sends this to notify the client of the owner of an item.

$17 — Update NPC (client ← server)

Sets info about an NPC. This could be either a friendly NPC or a Mob.

Payload

OffsetTypeDescription
0Int16NPC Slot
2SinglePosition X
6SinglePosition Y
10SingleVelocity X
14SingleVelocity Y
18ByteTarget
19ByteFlags:
BitMeaning
0Facing Direction
1Facing Y Direction
2AI 0 present
3AI 1 present
4AI 2 present
5AI 3 present
6Sprite Direction
20Int32Life
24Single[4]AI (depends on flags)
*Int16NPC ID

An NPC with Life of 0 means the NPC is not active.

AI is a series of floats that somehow determine how the NPC moves

$18 — Strike NPC (client ↔ server)

Hit an NPC with your currently equiped item

Payload

OffsetTypeDescription
0Int16NPC Slot
2BytePlayer Slot

Client → Server

The client does this when the player hits an NPC. The server will enforce the Player slot, so you cannot force another player to hit something.

Client ← Server

The server sends this when another player hits an NPC. This may even be your own player, the server is able to force that.

$19 — Chat (client ↔ server)

Text chat

Payload

OffsetTypeDescription
0BytePlayer Slot
1ColorText Color
4StringChat Text

Client → Server

The client sends this when the player says something. The client doesn't parse any special commands.

Client ← Server

The server sends this when another player (or the server) says something. The server will not prefix the player's name in the text, it's up to the client to do that. A player slot of 255 means the client should not prefix the player's name since it is either a server message, or a player action.

$1A — Damage Player or PvP (client ↔ server)

Player takes damage, or attacks another player

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteHit Direction
2Int16Damage
4BytePvP (0=self damage, 1=PvP)
5ByteCritical Hit (0=No, 1=Yes)
6StringDeath Text

Client → Server

Client sends this to attack another player. The server will ignore this message unless both players have PvP enabled.

Client ← Server

The server will send this if you or another player takes damage for any reason.

$1B — Update Projectile (client ↔ server)

Create or modify a projectile

Payload

OffsetTypeDescription
0Int16Projectile Identity
2SinglePosition X
6SinglePosition Y
10SingleVelocity X
14SingleVelocity Y
18SingleKnock Back
22Int16Damage
24ByteOwner Player Slot
25Int16Projectile Type
27Single[4]AI

Projectiles have Identities rather than slots because they are so numerous. Projectiles instead are identified by their identity (random id), and owner slot

Client → Server

Client sends this when a player creates or somehow modifies a projectile.

Client ← Server

The server sends this whenever another player creates or modifies a projectile.

$1C — Damage NPC (client ↔ server)

NPC is damaged, by projectile or other means. Passing a negative damage value will insta-kill the NPC.

Payload

OffsetTypeDescription
0Int16NPC Slot
2Int16Damage
4SingleKnockback
8ByteDirection 0=
9ByteCritical Hit (0 = no, 1 = yes)

Client → Server

The client sends this when an NPC is hit by a projectile or harmed by other means

Client ← Server

The server sends this when it determines the NPC is harmed

$1D — Destroy Projectile (client ↔ server)

Remove projectile

Payload

OffsetTypeDescription
0Int16Projectile Identity
1ByteOwner Player Slot

Client → Server

The client sends this when a projectile is destroyed. The server enforces the player slot, so you may not delete other players' projectiles

Client ← Server

The server sends this when a projectile is destroyed by another player.

$1E — Toggle PvP (client ↔ server)

Turns PvP on or off

Payload

OffsetTypeDescription
0BytePlayer Slot
1BytePvP (0 = off, 1 = on)

Client → Server

The client sends this when the player toggles PvP. The server enforces the player slot, so attempts to toggle someone elses' PvP will simply toggle your own.

Client ← Server

This is sent by the server, along with a chat message, whenever someone else toggles PvP.

$1F — Request Open Chest (client → server)

Requests the contents of a chest.

Payload

OffsetTypeDescription
0Int32Tile X
4Int32Tile Y

$20 — Set Chest Item (client ↔ server)

Identifies an item in a chest

Payload

OffsetTypeDescription
0Int16Chest Slot
2ByteItem Slot
3Int16Stack
5BytePrefix ID
6Int16Item ID

Client → Server

The client sends this whenever the player modifies the contents of a chest. Either by adding or removing something, or just moving items around.

Client ← Server

The server sends this when you request the contents of the chest. It does not broadcast other players' modifications of chests.

$21 — Open/Close chest (client ↔ server)

Flags a chest as open or closed.

Payload

OffsetTypeDescription
0Int16Chest Slot
2Int32Tile X
6Int32Tile Y

Client → Server

The client calls this with chest slot -1 to signify that they've closed the chest.

Client ← Server

The server sends this when it's finished sending the contents of a chest, to indicate that the chest is now opened by you. It may also send -1 if the chest is forced closed for any reason.

$22 — Destroy chest (client → server)

Breaks a chest, or does nothing if the chest is full

Payload

OffsetTypeDescription
0Int32Tile X
4Int32Tile Y

$23 — Heal Player (client ↔ server)

Heals a player

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int16Heal amount

Client → Server

Sent when the player uses a potion or heals himself somehow. The server enforces the player slot, so you cannot heal someone else.

Client ← Server

Sent by the server when another player heals himself, or if something out of the player's control heals the player.

$24 — Set Zones (client ↔ server)

Sets the player's zones

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteFlags:
BitMeaning
0Corruption
1Meteor
2Dungeon
3Jungle
4Hallow
5Snow
6Crimson
7Water Candle

Client → Server

Sent by the client to let the server know what zones are currently active based on the types of tiles in the area.

Client ← Server

Sent by the server to notify the client about the zones of other players.

$25 — Request Password (client ← server)

Server requires a password to join. After the server sends this, it will accept no other packets except for $26.

Payload

None

$26 — Login with Password (client → server) *

Sends the server password.

Payload

OffsetTypeDescription
0StringPassword

$27 — Unassign item (client ← server)

Unassigns an item on the ground. This works just like $16, except the new owner is always nobody (255).

Payload

OffsetTypeDescription
0Int16Item Slot

$28 — Talk to NPC (client ↔ server)

Talks to an NPC

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int16NPC Slot

Client → Server

The client sends this when the player talks to a friendly NPC. The server enforces the player slot, so you cannot force other players to talk to NPCs.

Client ← Server

The server sends this to notify you that other players (or yourself) are talking to an NPC.

$29 — Animate player flail (client ↔ server)

Animates an item carried by a player

Payload

OffsetTypeDescription
0BytePlayer Slot
1SingleItem Rotation
5Int16Item Animation

Client → Server

The client sends this to animate flails. The server enforces the player slot, so you may not animate other players' flails.

Client ← Server

The server sends this to notify the client of other player's animations.

$2A — Set Player Mana (client ↔ server) *

Sets player's mana and max mana

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int16Mana level
3Int16Max Mana

Client → Server

Client sends this as part of the login to specify the mana levels. The server enforces the player slot, so you may not set mana for another player.

Client ← Server

The server sends this to notify you of other player's mana levels, or to adjust your own.

$2B — Replenish Mana (client ↔ server)

Rejuvenates player mana

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int16Regeneration amount

Client → Server

Client sends this when the player takes a mana potion or some other mana regeneration. The server enforces the player slot so you can't rejuvenate another player's mana.

Client ← Server

Server sends this to notify you of other player's mana regeneration, or to affect your own.

$2C — Kill Player (client ↔ server)

Kills a player

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteHit Direction
2Int16Damage
4BytePvP (1 = Result of PvP)
5StringDeath Message

Client → Server

Client sends this if the player dies. The server enforces the player slot so you cannot kill another player.

Client ← Server

The server sends this to notify the client of another players' death. The client should ignore this message if the player slot is the clients.

$2D — Change Party (client ↔ server)

Changes the player's party

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteTeam:
ValueMeaning
0No Team
1Red Team
2Green Team
3Blue Team
4Yellow Team

Client → Server

Client sends this when the player changes parties. The server enforces the player slot so you cannot affect the parties of other players.

Client ← Server

Server sends this when another player changes parties, or if your party is changed somehow.

$2E — Read Sign (client → server)

Requests to read a sign

Payload

OffsetTypeDescription
0Int32Tile X
4Int32Tile Y

$2F — Set Sign Text (client ↔ server)

Changes a sign's text.

Payload

OffsetTypeDescription
0Int16Sign Slot
2Int32Sign X
6Int32Sign Y
10StringSign Text

Client → Server

The client sends this when the player changes the text on a sign.

Client ← Server

The server sends this when the player requests to read a sign.

$30 — Adjust Liquid (client ↔ server)

Adjust the liquid at a tile

Payload

OffsetTypeDescription
0Int32Tile X
4Int32Tile Y
8ByteLiquid Amount
9ByteLiquid Type (0 = water, 1 = lava)

Client → Server

Client sends this when a player dumps liquid on the ground.

Client ← Server

Server sends this to notify the client of flowing liquid.

$31 — Spawn (client ← server)

Initialization complete, request to spawn.

Payload

None.

$32 — Set Player Buffs (client ↔ server) *

Set's the player's active buffs

Payload

OffsetTypeDescription
0BytePlayer Slot
1Byte[10]Buff types

Client → Server

Client sends this during initialization, or when the player activates multiple buffs. The server enforces the player slot, so you cannot change the buffs of another player.

Client ← Server

Server sends this to notify you of other players' buffs. You should ignore this if the player slot is the clients', since the server is not allowed to modify your buffs.

$33 — Old Man's Answer (client ↔ server)

Answer's the old man's question to free him of the curse

Payload

OffsetTypeDescription
0BytePlayer Slot
1Byte1 = Spawn Skeletron, 2 = Don't.

Client → Server

Client sends this as a response to the old man's question, either to take on skeletron, or not.

Client ← Server

The server sends this if another player declined to break the curse.

$34 — Unlock Chest or Door (client ↔ server)

Unlocks a chest or door

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteUnlock (0 = no, 1 = yes)
2Int32Tile X
6Int32Tile Y

Client → Server

The client sends this to unlock a locked chest or door.

Client ← Server

The server sends this to notify the client that someone else unlocked a chest or door.

$35 — Add an NPC Buff (client ↔ server)

Adds a buff to an NPC

Payload

OffsetTypeDescription
0Int16NPC Slot
2ByteBuff Type
3Int16Buff Time

Client → Server

Client sends this to notify the server that an NPC was buffed.

Client ← Server

Server sends this whenever an NPC was buffed.

$36 — Set NPC Buffs (client ← server)

Sets all of an NPC's buffs

Payload

OffsetTypeDescription
0Int16NPC Slot
2Buff[5]NPC Buff

The structure of each Buff is:

OffsetTypeDescription
0ByteBuff Type
1Int16Buff Time

$37 — Add Player Buff (client ↔ server)

Adds a buff to a player

Payload

OffsetTypeDescription
0BytePlayer Slot
1ByteBuff Type
2Int16Buff Time

Client → Server

The client sends this when the player adds a single buff.

Client ← Server

The server sends this when your player was buffed. The client should ignore this if the player slot isn't the client's.

$38 — Set NPC Name (client ← server)

Sets the name of an NPC

Payload

OffsetTypeDescription
0Int16NPC Slot
2StringNPC Name

$39 — Sets Balance Stats (client ← server)

Sets the amount of hallowed vs corruption

Payload

OffsetTypeDescription
0ByteAmount of Hallowed
1ByteAmount of Corruption

$3A — Play Harp (client ↔ server)

Plays a harp

Payload

OffsetTypeDescription
0BytePlayer Slot
1SingleNote

Client → Server

Sent when the player plays a harp. The server enforces the player slot, so you cannot force another player to play a harp.

Client ← Server

Sent when another player plays a harp.

$3B — Flip Switch (client ↔ server)

Flips a switch

Payload

OffsetTypeDescription
0Int32Tile X
4Int32Tile Y

Client → Server

Sent when the player flips a switch.

Client ← Server

Sent when another player flips a switch.

$3C — Move NPC Home (client ↔ server)

Moves an NPC home

Payload

OffsetTypeDescription
0Int16NPC Slot
2Int16Home X
4Int16Home Y
6ByteHomeless (0 = no, 1 = yes)

Client → Server

Sent when the player moves an NPC's home, or makes an NPC homeless using the housing menu.

Client ← Server

Sent when another player moves an NPC's home, or an NPC moves in on its own.

$3D — Summon Boss or Invasion (client → server)

Summons a boss or invasion at player position

Payload

OffsetTypeDescription
0Int32Player ID
4Int32Boss/Invasion Type

$3E — Ninja/Shadow Dodge (client ↔ server)

Perform a Ninja or Shadow Dodge

Payload

OffsetTypeDescription
0Int32Player ID
4Int32Dodge Type

Client → Server

Sent when client performs the dodge

Client ← Server

Sent to announce to other players that the player dodged

$3F — Paint Tile (client ↔ server)

Paints a tile

Payload

OffsetTypeDescription
0Int32Tile X
4Int32Tile Y
8ByteColor

Client → Server

Sent when client paints a tile

Client ← Server

Sent to announce to other players of a paint change

$40 — Paint Wall (client ↔ server)

Paints a wall

Payload

OffsetTypeDescription
0Int32Wall X
4Int32Wall Y
8ByteColor

Client → Server

Sent when client paints a wall

Client ← Server

Sent to announce to other players of a paint change

$41 — Teleport Player/NPC (client ↔ server)

Teleports a player or NPC with an animation

Payload

OffsetTypeDescription
0byteFlags:
BitMeaning
0-1Player or NPC
2-3Animation type
1Int16Player Slot
3SingleDestination X
7SingleDestination Y

Client → Server

Sent when player teleports

Client ← Server

Sent when NPC or other player teleports

$42 — Heal Player (client ↔ server)

Quick heal player

Payload

OffsetTypeDescription
0BytePlayer Slot
1Int16Heal Amount

Client → Server

Sent when client heals himself

Client ← Server

Sent when other player heals

$44 — Unknown (client → server)

Unknown

Payload

OffsetTypeDescription
0StringUnknown

Message Flow

Certain messages expect certain responses, some messages take on different meanings when coming from the server or the client. I figured I'd cover the basics here.

Allowed messages

The client is only allowed to send messages marked with an asterisk until it goes through the login process and the server bumps your state up to Playing (10).

General server responses

When the client does something like notify the server of the player appearance (by sending $04), the server will take note of that information, and then echo that same information back to all connected clients... including the person who sent the information in the first place. This means for many messages, you might get an echo back.

Client logging into Server

When a client connects to a server, it sends $01 as the first message. The server will then respond with either $03 if your connection was approved or $25 if the server requires a password. The server may also respond with $02 if your IP was banned.

If a password is required, the client should then send the password with $26. The server will then respond as before; $03 if approved, $02 if there was a problem. Once you're approved, the server classifies your connection as Initializing (1).

Once the client receives $03, it should send $04 to notify the server of the player's appearance. Then, without waiting for a response, it should send $10 to set the player life, $2a to set the player's mana, and $32 to set the player's buffs. Next, the client should loop through the player's inventory slots (0 to 72) and send $05 for each one. Finally the client should send $06 to request world information.

If the server has a problem with your name set in $04, it will kick you with an error ($02).. otherwise the server will be echoing out your information to all other clients. Finally, the server will respond to your request for world information with $07. It will then bump your state up to Initialized (2).

Once the client receives $07, it should send request the initial tile data for the spawn with $08, giving it the spawn X and spawn Y it received with the world information.

The server will respond to $08 by sending a status update $09, followed by several $0A around the spawn. It will send $0B telling you to recalculate the areas that need recalculating. Then it will send $15 and $16 for items on the ground. It will also send $17 for all NPCs in the world. Then it will send $31 telling the client to spawn, $39 giving the balance stats for the world, and finally $38 for all Named NPCs.

When the client receives $31, it should then send $0C to spawn the character in the world. At this point the server kicks your state up to Playing (10). After this, any messages can be sent between the client and server.