2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef ENGINE_SHARED_PROTOCOL_H
|
|
|
|
#define ENGINE_SHARED_PROTOCOL_H
|
|
|
|
|
|
|
|
#include <base/system.h>
|
|
|
|
|
|
|
|
/*
|
2018-07-10 09:29:02 +00:00
|
|
|
Connection diagram - How the initialization works.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Client -> INFO -> Server
|
|
|
|
Contains version info, name, and some other info.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Client <- MAP <- Server
|
|
|
|
Contains current map.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Client -> READY -> Server
|
|
|
|
The client has loaded the map and is ready to go,
|
2018-02-04 15:00:47 +00:00
|
|
|
but the mod needs to send it's information as well.
|
2010-05-29 07:25:38 +00:00
|
|
|
modc_connected is called on the client and
|
|
|
|
mods_connected is called on the server.
|
|
|
|
The client should call client_entergame when the
|
2018-07-10 09:29:02 +00:00
|
|
|
mod has done it's initialization.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Client -> ENTERGAME -> Server
|
|
|
|
Tells the server to start sending snapshots.
|
|
|
|
client_entergame and server_client_enter is called.
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
NETMSG_EX = 0,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// the first thing sent by the client
|
|
|
|
// contains the version info for the client
|
2020-09-26 19:41:58 +00:00
|
|
|
NETMSG_INFO = 1,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// sent by server
|
2020-09-26 19:41:58 +00:00
|
|
|
NETMSG_MAP_CHANGE, // sent when client should switch map
|
|
|
|
NETMSG_MAP_DATA, // map transfer, contains a chunk of the map file
|
|
|
|
NETMSG_CON_READY, // connection is ready, client should send start info
|
|
|
|
NETMSG_SNAP, // normal snapshot, multiple parts
|
|
|
|
NETMSG_SNAPEMPTY, // empty snapshot
|
|
|
|
NETMSG_SNAPSINGLE, // ?
|
|
|
|
NETMSG_SNAPSMALL, //
|
|
|
|
NETMSG_INPUTTIMING, // reports how off the input was
|
|
|
|
NETMSG_RCON_AUTH_STATUS, // result of the authentication
|
|
|
|
NETMSG_RCON_LINE, // line that should be printed to the remote console
|
|
|
|
|
|
|
|
NETMSG_AUTH_CHALLANGE, //
|
|
|
|
NETMSG_AUTH_RESULT, //
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// sent by client
|
2020-09-26 19:41:58 +00:00
|
|
|
NETMSG_READY, //
|
2010-05-29 07:25:38 +00:00
|
|
|
NETMSG_ENTERGAME,
|
2020-09-26 19:41:58 +00:00
|
|
|
NETMSG_INPUT, // contains the inputdata from the client
|
|
|
|
NETMSG_RCON_CMD, //
|
|
|
|
NETMSG_RCON_AUTH, //
|
|
|
|
NETMSG_REQUEST_MAP_DATA, //
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
NETMSG_AUTH_START, //
|
|
|
|
NETMSG_AUTH_RESPONSE, //
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// sent by both
|
|
|
|
NETMSG_PING,
|
|
|
|
NETMSG_PING_REPLY,
|
2011-07-14 20:07:21 +00:00
|
|
|
NETMSG_ERROR,
|
|
|
|
|
|
|
|
// sent by server (todo: move it up)
|
|
|
|
NETMSG_RCON_CMD_ADD,
|
|
|
|
NETMSG_RCON_CMD_REM,
|
2017-05-21 23:07:13 +00:00
|
|
|
|
|
|
|
NUM_NETMSGS,
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// this should be revised
|
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
SERVER_TICK_SPEED = 50,
|
|
|
|
SERVER_FLAG_PASSWORD = 1 << 0,
|
|
|
|
SERVER_FLAG_TIMESCORE = 1 << 1,
|
2020-06-23 19:33:18 +00:00
|
|
|
SERVERINFO_LEVEL_MIN = 0,
|
|
|
|
SERVERINFO_LEVEL_MAX = 2,
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
MAX_CLIENTS = 64,
|
|
|
|
VANILLA_MAX_CLIENTS = 16,
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
MAX_INPUT_SIZE = 128,
|
|
|
|
MAX_SNAPSHOT_PACKSIZE = 900,
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
MAX_NAME_LENGTH = 16,
|
|
|
|
MAX_CLAN_LENGTH = 12,
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
// message packing
|
2020-09-26 19:41:58 +00:00
|
|
|
MSGFLAG_VITAL = 1,
|
|
|
|
MSGFLAG_FLUSH = 2,
|
|
|
|
MSGFLAG_NORECORD = 4,
|
|
|
|
MSGFLAG_RECORD = 8,
|
|
|
|
MSGFLAG_NOSEND = 16
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
2014-01-30 15:49:15 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-05-22 15:58:41 +00:00
|
|
|
VERSION_NONE = -1,
|
2014-01-30 15:49:15 +00:00
|
|
|
VERSION_VANILLA = 0,
|
|
|
|
VERSION_DDRACE = 1,
|
|
|
|
VERSION_DDNET_OLD = 2,
|
|
|
|
VERSION_DDNET_WHISPER = 217,
|
2014-02-19 20:55:37 +00:00
|
|
|
VERSION_DDNET_GOODHOOK = 221,
|
2014-04-12 09:12:29 +00:00
|
|
|
VERSION_DDNET_EXTRATUNES = 302,
|
2014-08-22 11:54:13 +00:00
|
|
|
VERSION_DDNET_RCONPROTECT = 408,
|
2014-12-05 16:46:32 +00:00
|
|
|
VERSION_DDNET_ANTIPING_PROJECTILE = 604,
|
2014-12-27 11:05:02 +00:00
|
|
|
VERSION_DDNET_HOOKDURATION_TUNE = 607,
|
2015-02-12 14:20:22 +00:00
|
|
|
VERSION_DDNET_FIREDELAY_TUNE = 701,
|
2015-07-04 12:12:49 +00:00
|
|
|
VERSION_DDNET_UPDATER_FIXED = 707,
|
2017-02-28 23:08:56 +00:00
|
|
|
VERSION_DDNET_GAMETICK = 10042,
|
2021-02-24 16:09:39 +00:00
|
|
|
VERSION_DDNET_MSG_LEGACY = 15040,
|
2021-10-16 16:58:33 +00:00
|
|
|
VERSION_DDNET_SWITCH = 15060,
|
2014-01-30 15:49:15 +00:00
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#endif
|