Quagent Programming

This page is to help with details of using the Quagent Protocol in user-written code.

Configuration Files

Configure the world

There are two sorts of configuration files. There is at most one of the first type, which sets up the world and is called when the game is launched. It populates the environment with items in locations you select. You can spawn items into your quake world from the console or you can use a configuration file. The file should be called quagent_world_config.dat (or maybe we'll let you name it what you want and give it to the game when you start it up). It has a simple format: it has one line per item you want spawned and each line looks like

[item name] [x] [y] [z]

Where [item name] is one of BOX, TOFU, BATTERY, GOLD, DATA, KRYPTONITE, and [x] etc are strings to be interpreted as numbers giving (x,y,z) absolute Quake coordinates. Now this means you need a map of the room you're in so you'll have a picture of where things are, and so you won't spawn things inside walls or out of the room entirely.

With no configuration file you get the standard items the game spawns.

Configure your Bots

Each time you spawn a bot you may supply its individual config file. This lets you do experiments with bots of different capabilities. The bot configuration file has lines allowing initialization of certain bot state levels and thresholds. They usually look like

[variable] [value]

Where [variable] is one of LIFETIME, INITIALWISDOM, INITIALENERGY, INITIALWEALTH, INITIALHEALTH, ENERGYLOWTHRESHOLD, AGEHIGHTHRESHOLD, and [value] is a string to be interpreted as a number.

An important one is slightly different, taking three values giving (x,y,z) location of bot.

INITIALLOCATION [x] [y] [z]

With no configuration file a bot is spawned in a default room (in fact the first room in the game) at a default spot with default values.

Here is a sample configuration file:

quagent { type CB lifetime 5000 initialenergy 1000}
quagent { type Lane lifetime 6000 initialenergy 2000}
quagent { type Randal lifetime 3000 initialenergy 3000}

tofu 128 -236 24.03
data 150 -200 55
battery 50 50 100
gold 300 -200 30
kryptonite 100 50 100

Console Commands

The file game/g_cmds.c implements console commands.

Moving Around in Quake

A tip for mapping out coords in a room/map. Walk the client (FPS) around and type ]viewpos at the console. It will give your current world vector coord.

In csc242/quake/baseq2/maps.lst (front part of this path may be wrong) is a list of location names (the sometimes-mysterious symbols) and somewhate-descriptive names. You can explore different locations by using the console map command, as in ]map mine4 .

You might well want to explore to find a usable space for your bots to move around and inteact in. Then you are going to have to map it so you can spawn items and bots correctly.

To start in a different room, do, for example: run-quake.sh +set game quagent +map city2

Java Example

Encapsulating the Command Interface

You might want to insulate yourself from the details of dealing with messages by providing objects and methods that encapsulate the parsing details. For example:


      Command cmd = new WalkCommand(20);
      this.send(cmd);

      Query query = new RadiusQuery(33.0);
      Answer answer = this.ask(query);
      if (answer.isOK()) {
          ... extract answer.value() and cast or something ...
      }


---
242 Home Page

This page is maintained by Nature Lover

Last update: 1.13.04.