wiki:Quagents AINodes

THIS ARTICLE IS OBSOLETE

Please see ProtocolZero or ioquake3 instead.












Under the hood all behaviors are implemented as AINodes.

Each Bot in Q3A has an active AINode at all times. An AINode is a function that takes a botstate and implements a certain behavior. They basically represent states in a finite state machine, and contain instructions for what to do while the bot is in that state. More information about the default AINodes in Q3A can be found at http://dev.johnstevenson.co.uk/bots/20585341-The-Quake-III-Arena-Bot.pdf, chapter 15.

The built in Q3 AINodes all return qtrue or qfalse (indicating whether to continue running the AINode loop), but Quagents AINodes may return more codes to signal termination behaviors to the command parser. FIXME: This is probably a bad idea - better to pass the socket and write permissions down to the AINodes?

Quagents do not use any of the built-in AINodes, since all these behaviors are tailored to playing Quake. The following is a list and description of Quagents AINodes. Throughout the Quake code, you will find that Quagents AINodes are prefixed with a "G" for quaGent. The source for all these is contained in code/game/ai_quagentsnodes.c. Generally these nodes will have a one-to-one correspondence with commands in ProtocolZero.

In this file, lines prefixed with an "@" are yet to be implemented.

AINode_GWalkForever

This node sends the quagent walking forward at a speed of 400. The agent will stop before it walks off cliffs, into walls, or into slime or lava. The bot will stop with a "blocked" message if it hits the ground enough to slide and there's a gap in the vicinity.

Parameters:

  • val1: obstacle flag: 1 if the agent should hop over low obstacles, 0 if it should report blocked when it encounters them.
  • valf1: theta, the heading in which the agent should walk relative to its current facing. 0 is straight ahead, 90 is strafe left, etc.
  • valf2: speed, 1.0 = normal maximum bot movement speed, 0 = stopped. In the current version, sending values greater than 1 will often lead to immediate "blocked" returns, and don't make the bot go faster.

Reports:

  • blocked if movement ended due to cliff/wall/slime/lava/blocking entity.

AINode_GJumpOnce

This node asks the quagent to make a single directional jump. It won't jump off (or even near) cliffs, into walls, bounce pads, or into slime or lava. The behavior ends only when the quagent has landed and is ready to jump again (Quake introduces a small delay), even if this does not occur for some time. The behavior ends on the NEXT landing, too, so if called while the bot is already jumping (or otherwise in the air), it will have no effect. FIXME: This seems a little buggy - sometimes he jumps twice!

Parameters:

  • val1: state, used as internal state tracking.
  • valf1: theta, the heading in which the agent should jump relative to its current facing. 0 is straight ahead, 90 is strafe left, etc.
  • valf2: speed, 1.0 = normal maximum bot movement speed, 0 = stopped. 2.25 is as fast a rocket, 5 is as fast as a plasma ball. Increasing movement speed also increases how far the bot looks ahead to see if it should say it is blocked.

Reports:

  • done when the quagent lands and is ready to jump again. Even if the quagent encountered an obstacle during flight, this is reported.

AINode_GPop

This node immediately removes itself and the next command, if such a command exists. Intuitively, one might expect a pop node to report done after the popped command reports popped, but this is incompatible with the assertion that commands report in order with respect to the command queue. It is still safe to assume that any order sent over the socket will be manipulating the queue after the popped command is gone - once pop has begun its execution the socket is not read until after it has completed.

Parameters:

  • none used.

Reports:

  • done when the pop begins (removes itself from the stack).
  • causes the next command to report popped

AINode_GPause

This node does nothing forever.

Parameters:

  • none used.

Reports:

  • never halts, though it may be popped/forgotten.

AINode_GForgetAllTasks

This node immediately removes itself, reporting 'done', then removes all tasks. Intuitively, 'done' would signal that all other tasks have been removed, but this is not compatible with the assertion that tasks report completion in the same order that they are removed from the queue. It is still safe for a user to do something immediately after a done - see pop.

Parameters:

  • none used.

Reports:

  • done immediately.
  • causes all other commands to report forgotten, in the order that they would have normally been executed.
Last modified 13 years ago Last modified on Jun 20, 2011 4:52:03 PM