User Tools

Site Tools


hosting:netpackets

This is an old revision of the document!


Network packets


Network packets are a way of contacting to the host or client via sending or receiving data. The amount of defined network packets has been changing ever since the implementation of Http Dll 2.11) in Brick Hill Legacy Beta. This article is about the latest Brick Hill Legacy network packets.

Before you'll start implementing Brick Hill network packets: Client and Host should send the Network Packet Type ID before sending other data, listed on next tables.

What client receives?


Network Packet type What does the network packet contain?
3 (New player packet, client creates the obj_figure Object, defined by Node Hill as SendPlayers) Amount of players (8-bit integer)
Network ID (32-bit integer)
Username (string)
User ID2) (32-bit integer)
Is new player an admin?3) (8-bit integer)
Membership type (8-bit integer)
4 (Client Data Packet, defined in GameMaker Client via packet_handler script; defined by Node Hill as Figure) ID type (string)
Network ID (32-bit integer)
ID types, defined in GameMaker client:
A - Position by X (float int)
B - Position by Y (float int)
C - Position by Z (float int)
D - ? (float int, unused)
E - Camera Rotation (float int, unused)
F - Player rotation by Z (float int)
G - Player scale by X (float int)
H - Player scale by Y (float int)
I - Player scale by Z (float int)
K - Head color (32-bit integer)
L - Torso color (32-bit integer)
M - Left Arm color (32-bit integer)
N - Right arm color (32-bit integer)
O - Left leg color (32-bit integer)
P - Right Leg color (32-bit integer)
Q - Face Item ID (string)
R - Shirt Item ID4) (string)
S - Pants Item ID (string)
T - T-Shirt Item ID (string)
U - First Equipped Hat Item ID, receives Mesh UUID (string) and Texture UUID (string)
V - Second Equipped Hat Item ID, receives Mesh UUID (string) and Texture UUID (string)
W - Third Equipped Hat Item ID, receives Mesh UUID (string) and Texture UUID (string)
X - Score (32-bit integer, can be negative)
Y - Team (32-bit integer)

The next ID Types are defined by GameMaker client as Local Changes:
1 - Walking Speed (32-bit integer)
2 - Jump Height (32-bit integer)
3 - Field of View (32-bit integer)
4 - Camera distance (32-bit integer, can be negative)
5 - Camera position by X (float int)
6 - Camera position by Y (float int)
7 - Camera position by Z (float int)
8 - Camera rotation by X (float int)
9 - Camera rotation by Y (float int)
a - Camera rotation by Z (float int)
b - Camera Type (string)
c - Camera Object (32-bit integer)
e - Health (float int)
f - Speech5) (string, limited to 500 characters6))
g - Equipped tool: Slot ID (32-bit integer), Mesh UUID (string), Texture UUID (string)
h - Sets Arm value to -1
i - Is player alive?7) (8-bit integer)

The next ID Types are defined by GameMaker client as “new clothing system”:
j - Clothe1 (string)
k - Clothe2 (string)
l - Clothe3 (string)
m - Clothe4 (string)
n - Clothe5 (string)
5 (Remove Player Packet, defined by Node Hill as RemovePlayer) User's Network ID (32-bit integer) and client removes its obj_figure object from the game.
6 (Chat Message Packet, defined by Node Hill as Chat) A formed by Host chat Message (string, 500 limit)
7 (Environment Data, GUI; defined by Node Hill as PlayerModification) Data Type (string):
topPrint - Top Text: Message (string), Time (32-bit integer)
centerPrint - Middle Text: Message (string), Time (32-bit integer)
bottomPrint - Bottom Text: Message (string), Time (32-bit integer)
Ambient - Ambient color (32-bit integer)
Sky - Sky color (32-bit integer)
BaseCol - Baseplate color (32-bit integer)
BaseSize - Baseplate size (32-bit integer)
Sun - Sun intensity (32-bit integer)
kick - Kicks the client8)
prompt - Prompt message (string)
WeatherSnow - Sets the weather to snow
WeatherRain - Sets the weather to rain
WeatherSun - Sets the weather to sun
TweakDisableFigureCulling - Disables the Figure culling option
TweakDisableLighting - Disables lighting
TweakRaySpacing - ? (float int)
MoreClickInfo - enables more information on click (8-bit integer)
8 (Kill Packet, defined by Node Hill as Kill) User's Network ID (32-bit integer), then client sets the alive variable to 0 to its corresponding obj_figure object.
9 (Brick Modification Packet, defined by Node Hill as Brick) The obj_brick's Network ID (32-bit integer)
Type of Modification (string).
Brick Modifications:
pos9) - Position by X (float int)
Position by Y (float int)
Position by Z (float int)
rot10) - Rotation by Z (float int)
scale11) - Scale by X (float int)
Scale by Y (float int)
Scale by Z (float int)
kill12) - Time until destruction (32-bit integer)
destroy - Removes the brick
col13) - Color (32-bit integer)
alpha14) - Alpha (float int)
lightcol15) - Color (32-bit integer)
lightrange16) - Range (32-bit integer)
model17) - Mesh UUID (string)
Texture UUID (string)
collide18) - Collision state (8-bit integer)
clickable19) - Clickable state (8-bit integer)
Clickable distance (32-bit integer)
global - ?
ignoreLight20) - makes ignoreLight variable true
10 (New team packet, defined by Node Hill as Team) Team ID (32-bit integer)
Name (string)
Color (32-bit integer)
11 (New tool packet, defined by Node Hill as Tool) Active state (8-bit integer)
Slot ID (32-bit integer)
Name (string)
12 (Bot Data packet, defined in GameMaker Client via packet_handler_figure script; defined by Node Hill as Bot) String ID (string)
Figure ID (32-bit integer)
Regarding the packet_handler_figure Script: It generally contains the same information as packet_handler Script, except it does not need Local Changes.
13 (New Projectile Packet, defined by Node Hill as Projectile) Active state (8-bit integer)
Projectile ID (32-bit integer)
Diameter (32-bit integer)
Color (32-bit integer)
Position by X (float int)
Position by Y (float int)
Position by Z (float int)
Direction (32-bit integer)
Direction by Z (32-bit integer)
Velocity (32-bit integer)
14 (Clear Map Packet, defined by Node Hill as ClearMap) Client removes all the bricks after it has received this packet
15 (Remove Bot packet, defined by Node Hill as DestroyBot) Figure ID (32-bit integer), then client removes the bot by its Network ID
16 (Remove Brick packet, defined by Node Hill as DeleteBrick)Client receives the Brick ID (32-bit integer) and removes the brick by its ID.
17 (SendBrick Packet, Node Hill definition) Network ID (32-bit integer)
Position by X (float int)
Position by Y (float int)
Position by Z (float int)
Scale by X (float int)
Scale by Y (float int)
Scale by Z (float int)
Color (32-bit integer)
Transparency (float int)

What client sends?

Network Packet type What does the network packet contain?
1 (Authentication packet, defined by Node Hill as Authentication) Token21) (string)
Client version (string)
What Host sends22):
Network ID23) (32-bit integer)
Brick Count (32-bit integer)
User ID24) (32-bit integer)
Username (string)
Are you an admin?25) (8-bit integer)
Membership type (8-bit integer)
Game ID (32-bit integer)
Game Name (string)
2 (Player position Packet, defined by Node Hill as Position)26) Position by X (float int)
Position by Y (float int)
Position by Z (float int)
Rotation by Z (float int)
Camera rotation by Z (float int)
3 (Command Packet) Command (via /, string)
4 (Projectile Packet)27) The projectile ID, the client has made a collision with (32-bit integer)
It's own Network ID (32-bit integer)
5 (ClickDetection Packet) Brick Network ID (32-bit integer)
6 (PlayerInput Packet) Mouse click (8-bit integer)
Current Keyboard Key (string)
18 (Heartbeat packet, sent in Brick Hill Legacy Client via update_delta script)28) Message (sent via socket_write_message29) )

Notes

1)
GameMaker 8.1 extension with better networking features.
2)
Retrieved via Brick Hill site API server-side.
3) , 7) , 25)
1 - true, 0 - false.
4)
unused, old. Same with Pants, T-Shirt
5)
bubble chat message
6)
If this packet function didn't check the length of the chat message then hosts using Game.on('chat') could cause clients to crash by relaying very large chat messages.
8)
This will become a vulnerability if the player socket will not be destroyed by Host itself.
9)
Changes brick position.
10)
Changes brick rotation by Z.
11)
Changes the scale of brick.
12)
Unanchors the brick.
13)
Changes the brick color.
14)
Changes the brick's transparency.
15)
Changes the light color.
16)
Changes the light range.
17)
Sets the custom model to brick.
18)
Changes the brick collision.
19)
Changes the click state and distance for a brick.
20)
Logically, this should ignore the light, Client source code got its option commented out (was supposed to support 8-bit integer).
21)
User's authentication key.
22)
should be received by client
23)
Object id of a obj_client, assigned server-side.
24)
Retrieved via Brick Hill site API, hence the auth key must be verified.
26)
Earlier: unused method of loading bricks. Exists yet commented out in the game code of latest Brick Hill Legacy Client.
27)
Node Hill does not have an implementation for this packet (it's empty).
28)
The client should send this packet constantly (every 10 seconds).
29)
Http Dll 2.1 citation: Sends a message. A message is sent by first sending the size of the message (as uintv), followed by the actual message data. This is handled automatically by the DLL, you don't need to do anything special if the receiver also uses Http Dll 2..
hosting/netpackets.1764933353.txt.gz · Last modified: by blamedenny