Autopilot/Development
From #openttdcoop wiki
Outline of future autopilot development
Contents
Aims
Information and automation
The original goal of the first autopilot was to provide some necessary feaures which weren't present in the OpenTTD dedicated server at that time, such that the server's admin did not have to be at or near the console at all times to keep things on track. An autopilot in the sense of not having to sit at the yoke of your aeroplane all the time. The first features implemented were as follows:
- Set some game parameters which weren't in the game's config file (such as net_frame_freq)
- Keep a count of connected players, and pause the game if there weren't any
- Greet each player and show the location of a web page giving the rules, etc
- Periodically change the server's password
All of these are now possible without autopilot. This is a good thing; it shows that the features are widely desirable. Now it falls to autopilot to provide additional features. They're more of a luxury than a necessity now, but should include the following:
- Saving the game regularly; specifically, when people leave or join, or when somebody requests it by command from within the game.
- Storing information in a database, so that a web page can query this information and display it (including the password)
- Including a log of in-game chat
bridge to irc / irc bot
modular / customizable (without the need of editing ap source directly)
IRC bot
RFC compliance
- use irc package (0.6 or later) from tcllib (1.10 or later)
- standard eol-style: crlf (handled by irc package, however allow this to be configured as some networks are not rfc conform e.g. euirc.net)
- ping reply asap (handeld by irc package)
- join channel only after /end of MOTD received
Important callbacks
- 376 /end of MOTD (code to join channel in this callback)
- 332 joined channel (send /NAMES to keep internal nick list of channel)
- 353 reply from /NAMES (/NAMES response can appear multiple times depending on the number of clients in the channel, accumulate them)
- 366 /end of NAMES (process the accumulated list of channel nicks)
- MODE a mode change occured, send /NAMES to update the internal list
- NICK nickchange, send /NAMES
- QUIT a user from our channel quit, send /NAMES
- PART a user from our channel left, send /NAMES
- KICK we were kicked from the channel
- INVITE we have been invited to a channel
- PRIVMSG a channel or private message (detect private message by comparing [target] with the bot's irc nick name, do this case insensitive)