(as bots do not need to download the map, they have no chance of getting hold of it )
It allows up to 16 bots (MAX_BOTS) to connect. Each bot needs to "register" the updates (BotUpdateType) it wants to receive at a desired frequency (BotUpdateFrequency), however, polling (BOTPACKET_BOT_POLL) is also supported.
The protocol is designed to not disconnect bots when they have sent wrong packets, instead they will be prompted with a packet named BOTPACKET_SERVER_NOT_SUPPORTED which holds details of the packet the bot sent causing the error.
Feel free to mention protocol additions / changes, in case you find data you would like bots to be able to get hold of.
Note: Influencing Industries and/or Towns is not scope of this thread.
Following config file additions to be watched out for:
network.server_bot_port, the port the bot network will open for incoming bot connections, defaults to 3977
network.server_bot_chat, allow private chat to the server to be also distributed to bots
network.bot_password, bots can only join if a password is set. not password, no bots!
As bots are required to join with a password, the bot's rcon command packet does not require any additional passwords to be sent.
Update Types are bound to possible Update Frequencies, all Update Types allow UPDATE_FREQUENCY_NONE:
BOT_UPDATE_DAILY supports also the Frequencies: Daily, Weekly, Monthly, Quarterly, Anually
BOT_UPDATE_CLIENT_INFO supports also the Frequency: Automatic
BOT_UPDATE_COMPANY_INFO supports also the Frequency: Automatic
BOT_UPDATE_COMPANY_ECONOMY supports also the Frequencies: Weekly, Monthly, Quarterly, Anually
BOT_UPDATE_COMPANY_STATS supports also the Frequencies: Weekly, Monthly, Quarterly, Anually
BOT_UPDATE_CHAT supports also the Frequency: Automatic
BOT_UPDATE_CONSOLE supports also the Frequency: Automatic
Update types bots can register
Code: Select all
enum BotUpdateType {
BOT_UPDATE_DATE,
BOT_UPDATE_CLIENT_INFO,
BOT_UPDATE_COMPANY_INFO,
BOT_UPDATE_COMPANY_ECONOMY,
BOT_UPDATE_COMPANY_STATS,
BOT_UPDATE_CHAT,
BOT_UPDATE_CONSOLE,
BOT_UPDATE_END
};
Code: Select all
enum BotUpdateFrequency {
BOT_FREQUENCY_NONE = 0x01,
BOT_FREQUENCY_DAILY = 0x02,
BOT_FREQUENCY_WEEKLY = 0x04,
BOT_FREQUENCY_MONTHLY = 0x08,
BOT_FREQUENCY_QUARTERLY = 0x10,
BOT_FREQUENCY_ANUALLY = 0x20,
BOT_FREQUENCY_AUTOMATIC = 0x40,
BOT_FREQUENCY_END = 0x80
};
Code: Select all
enum TCPBotPacketType {
BOTPACKET_SERVER_FULL,
BOTPACKET_SERVER_ERROR,
BOTPACKET_BOT_JOIN,
BOTPACKET_SERVER_WELCOME,
BOTPACKET_BOT_DATE,
BOTPACKET_SERVER_DATE,
BOTPACKET_SERVER_CLIENT_JOIN,
BOTPACKET_SERVER_CLIENT_INFO,
BOTPACKET_SERVER_CLIENT_UPDATE,
BOTPACKET_SERVER_CLIENT_QUIT,
BOTPACKET_SERVER_CLIENT_ERROR,
BOTPACKET_SERVER_COMPANY_NEW,
BOTPACKET_SERVER_COMPANY_INFO,
BOTPACKET_SERVER_COMPANY_UPDATE,
BOTPACKET_SERVER_COMPANY_ECONOMY,
BOTPACKET_SERVER_COMPANY_STATS,
BOTPACKET_SERVER_COMPANY_REMOVE,
BOTPACKET_BOT_UPDATE_FREQUENCY,
BOTPACKET_BOT_POLL,
BOTPACKET_BOT_CHAT,
BOTPACKET_SERVER_CHAT,
BOTPACKET_SERVER_NEWGAME,
BOTPACKET_SERVER_SHUTDOWN,
BOTPACKET_BOT_QUIT,
BOTPACKET_BOT_RCON,
BOTPACKET_SERVER_RCON,
BOTPACKET_SERVER_NOT_SUPPORTED,
BOTPACKET_SERVER_PROTOCOL,
BOTPACKET_SERVER_CONSOLE,
BOTPACKET_END ///< Must ALWAYS be on the end of this list!! (period)
};
Bot sends BOTPACKET_BOT_JOIN
(if the limit of joined bots has been reached, the server will send BOTPACKET_SERVER_FULL and close the connection)
(if the password is wrong, the server will send BOTPACKET_SERVER_ERROR and disconnect the bot)
Server sends BOTPACKET_SERVER_PROTOCOL
Server sends BOTPACKET_SERVER_WELCOME
(it is up to the bot to decide weather or not it can handle the bot protocol version mentioned in the BOTPACKET_SERVER_PROTOCOL packet)
As of here the bot is free to register for update packets, or to poll data and do what it would like to do.
Please read the patch in order to understand the structure of the separate packets.