About: | This document contains editing information for the Gladiator bot. The Gladiator bot is an artificial player for Quake2. |
|
Author: | Mr Elusive (MrElusive@demigod.demon.nl) |
|
Gladiator page: | http://www.botepidemic.com/gladiator |
|
Last update: | 1999-05-05 |
Gladiator bot chat system
The bot chat system has five parts:
Below is shown how the several parts are used in sequence.
environmental change -> initial chat + random strings -> synonyms -> output
console message -> | synonym -> | match template strings | - (match) -> | action | ||
- (no match) -> | reply chat + random strings -> | synonyms -> | output |
Synonyms
The synonyms are used to unify strings before processing and also used to create some variation when outputting a message. The synonyms are stored in the file syn.c in the .pak file included with the bot. The bot uses context dependent synonyms. Every context has a flag which is defined in the file syn.h in the .pak file included with the bot.
A context with synonyms is constructed as follows:
context flag
{
[("first synonym", X), ("second synonym", Y), ...]
...
}
The X and Y are values in the range [0-1]. These values are chances the synonyms are used in chat messages the bot creates.
A few examples:
CONTEXT_NEARBYITEM
{
[("Body Armor", 1), ("red armor", 1), ("armor red", 0), ("armor body", 0)]
}
CONTEXT_NORMAL
{
[("do not", 1), ("don't", 1), ("dont", 1)]
[("checkpoint", 1), ("check-point", 1), ("cp", 1)]
}
Random strings
The random strings are used in the initial and replay chat messsage to add some variation. The random strings are stored in the file rnd.c in the .pak file included with the bot.
A random string is constructed as follows:
name = {"first random string", "second random string", ...}
A random string is used in a chat message as follows:
" part of the chat message ", randomstringname, " part of the chat message ";
Multiple random strings can be used in a chat messages. Multiple random strings seperated by commas can also be used directly after each other.
Match templates
The bot uses the match templates to 'understand' chat- and other console messages. The match templates are stored in the file match.c in the .pak file included with the bot.
A match template is constructed as follows:
match template = (id, type flags);
The id is used to identify the message. The type flags specify certain characteristics of the message. The id and type flags are defined in the file match.h in the .pak file included with the bot.
The bot uses context dependent match templates. Every context has an id flag and several match templates are grouped with a context. The id flags are stored in the match.h file.
context flag
{
...
}
An example:
MTCONTEXT_INITIALTEAMCHAT
{
"(", NETNAME, "): ", ADDRESSEE, " camp at ", KEYAREA, " for ", TIME = (MSG_CAMP, $evalint(ST_ADDRESSED|ST_NEARITEM|ST_TIME));
...
}
Before using the match templates the synonyms in the templates are replaced.
The bot tries to match the templates in the order they are listed in the
match.c file. The first found match is used.
Initial chats
The initial chats are used by the bot to initiate a chat when something in the environment changes or the bot just feels like chatting. Each bot has a personal set of initial chats. The initial chats are stored with the bot characters in the 'bots' sub-folder in the .pak file included with the bot. In the characteristics of a bot there's a reference to the file with the initial chats for that bot and the name of the initial chats.
The initial chats for a bot are constructed as follows:
chat "name"
{
type "type name"
{
"initial chat message";
"another initial chat message";
...
}
type "type name"
{
}
...
}
Reply chats
The bot uses the reply chats to reply to chat messages from other players. All bots use the same reply chats because the number of reply chats tends to get pretty large. Creating different reply chats for each bot character would be too much work and also take up to much memory.
The reply chats are stored in the file rchats.c in the .pak file included with the bot. The reply chats in this file have keys, a priority and several reply chat messages.
[key1, key2, ...] = priority
{
"reply chat message";
"another reply chat message";
...
}
key prefixes:
& | key must be true |
! | key may not be true |
keys:
name | key is true when the name of the bot is present in the chat message the bot wants to reply to |
female | key is true when the bot is female |
male | key is true when the bot is male |
it | key is true when the bot is genderless |
{""} | key is true when the bot has this name |
"" | key is true when the string is present in the message to reply to |
( ) |
Key is true when the chat message to reply to matches the template between the
( ) The match templates work in exactly the same way as the match templates described above. The matched variables can be used in the reply chat messages. For instance: "yes you are ", 0; where the variable 0 might be "crazy" |
The bot evaluates the keys to find out if the reply chat can be used
to reply to a certain chat message.
When all the keys with the prefix &
are true and all the keys with the prefix !
are not true and there's at least one key true then the bot may use the reply chat.
When several reply chats could be used to reply to a message the one with the
highest priority is chosen.