JESS and Quagents.
There is a good demo located at /u/cs242/jess_demo.
First load up the Quake II engine, and then open up a new terminal.
The main file to run is DrunkenMasterII.clp. (Be careful of the final period in the cp code - it denotes your current directory).
> cp -r /u/cs242/jess_demo .
> setenv CLASSPATH ${PWD}:/u/cs242/jess
> /usr/staff/bin/java jess.Main DrunkenMasterII.clp
To understand what is going on, continue reading (shamelessly taken from the readme):
From the bottom up:
- DrunkenMasterII.class acts via three methods, walk, probe, and turn.
- BasicQuagentII.class creates a connection to the Quake server, and interacts with it with an instance of the DrunkenMasterII class. To make things easier in Jess, only six basic methods are used.
- void initialize() - Connects to the server and creates a quagent
- void close() - Disconnects from the server
- Response walk(int dist) - Has the quagent walk in a straight line
- Response probe(int radius) - Has the quagent probe its surroundings
- Response turn(int angle) - Has the quagent turn
- int randInt() - Generates random ints from 0-100 with minimal fuss
- DrunkenMasterII.clp is the brains behind the quagent. It creates an instance of BasicQuagentII, and interacts with the environment with a series of rules. It doesn't keep track of it's position or orientation, and will easily run into walls and get stuck. The DrunkenMasterII will wander around randomly until it gets tired, then look around with "probe."
There are several things to think about in the basic DrunkenMasterII code.
- The agent's opinion of its current heading is variable, and will not match up with the Quake world.
- The agent moves in integers, while the Quake world works in floating points. Integers are easier to work with in Jess, but the conversion could lead to gradual loss of precision, if you want to keep track of the agent's position.
- The agent probes the world, but doesn't listen for a response, nor does it check to see if it managed to walk the entire distance it meant to without being stopped.
- The agent can only have a single goal at a time, and as such, cannot complete very complex tasks. Using multiple Jess facts could increase the intelligence substantially.
- The agent has only one need, which is if it's too tired to walk. A different behavior system could involve several needs, or even none at all. The agent can be made to simply react to it's environment directly, or else have a variety of different internal states as well as memory of past events.