wiki:ServerProgrammingDealingWithIO

Quake Filesystem

Quake uses a private, isolated filesystem for all file I/O. This means that all data generated directly from the game - screenshots, log files, etc., will be stored in this filesystem. The "home directory" for this filesystem, where all loads and stores occur by default, is located at ~/.quagents3/quagents3. The '.' prefix on the directory indicates a hidden directory, which means you will not be able to see it from your standard GUI filesystem browser. Instead, use your terminal to access it.

For more information, see the "files.c" file located in code/qcommon.

Sockets

We have patched in our own sockets for Quagent use. They live outside any of the VMs (as the VM security (that is, lack of power) prevents you from doing this inside the VMs). There are various trap functions that we have added for this purpose. The "end" of these trap functions live in qcommon/net_ip.c. The functions are

  • trap_Com_QuagentsReadStr : Reads from a socket into the memory provided.
  • trap_Com_QuagentsWriteStr : Writes the string to a socket (automatically sized).
  • trap_Com_QuagentsWriteBuff : Writes a number of bytes to a socket.

All of our sockets are non-blocking. The game periodically calls reads, and certain events or actions can precipitate writes. Reads are sourced in two places:

  • All active quagents call trap_Com_QuagentsReadStr as part of their AI_Frame in ai_main.c.
  • All initializing quagents and the director deal with reads in the BotAI_QuagentsDirectorRead function in ai_main.c. This function is called every game frame (by a VM_Call) whether or not the game is paused.
Last modified 9 years ago Last modified on Aug 26, 2011 4:24:37 PM