wiki:ServerProgrammingDirector

Version 1 (modified by jpawlick, 13 years ago) (diff)

--

FIXME: This page is obsolete, we now have many director commands.

The Director

I should have all the framework we want in place for the GOD / Director functionality. Try connecting to Quagents on port 6002 and typing stuff. Currently, it'll just echo every command to stdout. I think pretty much anything we want a "configuration file" for, we should build through the director instead. Here's the points:

  • Assuming we implement all the commands, anything a config file can do, we could do by piping it in command form into the director with an easy script (that we could even configure to run on startup or something). Can't quite pipe into telnet, but not hard to write a small program that reads a file and fires it over the socket, or just use netcat.
    cat initialcommands.txt | nc localhost 6002
    
  • If we put more general options here, we can do things a config file can't, such as change the configuration on the fly. Sure, it's not a huge feature, but it might be nice to add more items to the world as it ran, or something like that.
  • The major drawback is that it's not blindingly obvious how to buffer commands the user issues as soon as Quake starts up (say, before the map is loaded). Then again, I'd be surprised if people choose not to just start Quake using the +map option. At least, that's what everyone I know did in the previous Quagents. Actually, I take this back, maybe. We just have it wait on the "hasn't had a read call yet" bit.

If you want to edit director effects, check out the BotHandleDirectorCommand(char* cmdbuff) function in game/ai_main.c. Currently, it just echoes any director commands to stdout, but it gets called once per command with the command string in cmdbuff (see the comments). So you'll need to add stuff to parse out the commands from whatever format they are in and then evaluate them. I decided it might be nice to keep all the director command functions in ai_directorcommands.c and ai_directorcommands.h. Hopefully that won't be a problem.

The director commands uses a similar format to the bot commands. The only difference is that instead of adding the commands to the command queue, the function that performs the actions is called directly and executed. This is handled in the BotHandleDirectorCommand(char* cmdbuff) function in game/ai_main.c. All of the director commands are in ai_directorcommands.c