Packet Structures

The following code sample includes the packet structures that you must use in the multiplayer system.

// You must use the following structure as a header for all multiplayer packets to be sent.

typedefstructMULTIPLAYER_PACKET_HEADER

{

MULTIPLAYER_PACKET_IDpacket_id;

UINT32data_size;

VAR8data[];

} MULTIPLAYER_PACKET_HEADER;

// Use the following structure to hold lat, lon, alt, pbh data.

typedefstructREDUCED_LLAPBH_DATA

{

VAR32pbh;

SINT32lat_i;

SINT32lon_hi;

SINT32alt_i;

UINT16lat_f;

UINT16lon_lo;

UINT16alt_f;

} REDUCED_LLAPBH_DATA;

// Template for changing to player packet.

typedefstructMULTIPLAYER_PACKET_CHANGE_TO_PLAYER

{

DPIDplayer_id;

} MULTIPLAYER_PACKET_CHANGE_TO_PLAYER;

// Template for changing to observer packet.

typedefstructMULTIPLAYER_PACKET_CHANGE_TO_OBSERVER

{

DPIDplayer_id;

} MULTIPLAYER_PACKET_CHANGE_TO_OBSERVER;

// Template for the "player changed planes" packet.

typedef structMULTIPLAYER_PACKET_CHANGE_PLAYER_PLANE

{

ENUMengine_type;

STRINGZaircraft_name[];

} MULTIPLAYER_PACKET_CHANGE_PLAYER_PLANE;

// Template for the basic position packet.

typedefstructMULTIPLAYER_PACKET_POSITION_LLAPBH

{

UINT32application_time;

UINT32packet_index;

REDUCED_LLAPBH_DATAreduced_llapbh;

} MULTIPLAYER_PACKET_POSITION_LLAPBH;

// Template for the plane's position and velocities.

typedefstructMULTIPLAYER_PACKET_POSITION_VELOCITY

{

UINT32packet_index;

UINT32application_time;

SIF32lat_velocity;

SIF32lon_velocity;

SIF32alt_velocity;

UIF32ground_velocity;

REDUCED_LLAPBH_DATAreduced_llapbh;

} MULTIPLAYER_PACKET_POSITION_VELOCITY;

// Template for the chat message data packet.

typedefstructMULTIPLAYER_PACKET_CHAT_TEXT

{

STRINGZchat_data;

} MULTIPLAYER_PACKET_CHAT_TEXT;