#define UDP_MDATA_STOR_QUEUE_SIZE 500 // Store up to 500 MDATA packets
#define UDP_OBJ_PACKETS_PER_FRAME 20
// Following are static defines for the buffer size of various packets. IF you change the packets, you must change the size, too.
#define UPKT_MAX_SIZE 1024 // Max size for a packet - just for the buffers
#define UPKT_GAME_INFO_REQ_SIZE 9
#define UPKT_SEQUENCE_SIZE 14
#define UPKT_PING_SIZE 33
#define UPKT_PONG_SIZE 6
#define UPKT_MBUF_SIZE 454
// UDP-Packet identificators (ubyte)
#define UPID_VERSION_DENY 1 // Netgame join or info has been denied due to version difference.
#define UPID_GAME_INFO_REQ 2 // Requesting all info about a netgame.
#define UPID_GAME_INFO 3 // Packet containing all info about a netgame.
#define UPID_GAME_INFO_LITE_REQ 4 // Requesting lite info about a netgame. Used for discovering games.
#define UPID_GAME_INFO_LITE 5 // Packet containing lite netgame info.
#define UPID_DUMP 6 // Packet containing why player cannot join this game.
#define UPID_ADDPLAYER 7 // Packet from Host containing info about a new player.
#define UPID_REQUEST 8 // New player says: "I want to be inside of you!" (haha, sorry I could not resist) / Packet containing request to join the game actually.
#define UPID_QUIT_JOINING 9 // Packet from a player who suddenly quits joining.
#define UPID_SYNC 10 // Packet from host containing full netgame info to sync players up.
#define UPID_OBJECT_DATA 11 // Packet from host containing object buffer.
#define UPID_PING 12 // Packet from host containing his GameTime and the Ping list. Client returns this time to host as UPID_PONG and adapts the ping list.
#define UPID_PONG 13 // Packet answer from client to UPID_PING. Contains the time the initial ping packet was sent.
#define UPID_ENDLEVEL_H 14 // Packet from Host to all Clients containing connect-states and kills information about everyone in the game.
#define UPID_ENDLEVEL_C 15 // Packet from Client to Host containing connect-state and kills information from this Client.
#define UPID_PDATA_H 16 // Packet from Host to all Clients containing all players movement data.
#define UPID_PDATA_C 17 // Packet from Client to Host containing his movement data.
#define UPID_MDATA_P0 18 // Packet containing multi buffer from a player. Priority 0 - no ACK needed.
#define UPID_MDATA_P1 19 // Packet containing multi buffer from a player. Priority 1 - ACK needed. Also contains pkt_num
#define UPID_MDATA_ACK 20 // ACK packet for UPID_MDATA_P1.
// Structure keeping lite game infos (for netlist, etc.)
typedefstructUDP_netgame_info_lite
{
struct_sockaddrgame_addr;
int32_tprogram_iver;
chargame_name[NETGAME_NAME_LEN+1];
charmission_title[MISSION_NAME_LEN+1];
charmission_name[9];
int32_tlevelnum;
ubytegamemode;
ubyteRefusePlayers;
ubytedifficulty;
ubytegame_status;
ubytenumplayers;
ubytemax_numplayers;
ubytegame_flags;
ubyteteam_vector;
}__pack__UDP_netgame_info_lite;
typedefstructUDP_sequence_packet
{
ubytetype;
netplayer_infoplayer;
}__pack__UDP_sequence_packet;
// player position packet structure
typedefstructUDP_frame_info
{
ubytetype;
ubytePlayer_num;
ubyteconnected;
ubyteobj_render_type;
shortpospos;
}__pack__UDP_frame_info;
// packet structure for multi-buffer
typedefstructUDP_mdata_info
{
ubytetype;
ubytePlayer_num;
uint32_tpkt_num;
ushortmbuf_size;
ubytembuf[UPKT_MBUF_SIZE];
}__pack__UDP_mdata_info;
// structure to store MDATA to maybe resend
typedefstructUDP_mdata_store
{
intused;
fixpkt_initial_timestamp;// initial timestamp to see if packet is outdated
fixpkt_timestamp[MAX_PLAYERS];// Packet timestamp
intpkt_num;// Packet number
ubytePlayer_num;// sender of this packet
ubyteplayer_ack[MAX_PLAYERS];// 0 if player has not ACK'd this packet, 1 if ACK'd or not connected
ubytedata[UPKT_MBUF_SIZE];// extra data of a packet - contains all multibuf data we don't want to loose
ushortdata_size;
}__pack__UDP_mdata_store;
// structure to keep track of MDATA packets we've already got