wiki:Quagents AINodes

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

--

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.

Parameters:

  • val1: unused
  • 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: unused

Reports:

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

AINode_GJumpOnce

This node asks the quagent to make a single forward 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.

Parameters:

  • val1: state, used as internal state tracking.
  • valf1: unused
  • valf2: unused

Reports:

  • blocked if movement ended (or wouldn't begin) due to cliff/wall/slime/lava/blocking entity.
  • done if jump completes otherwise.