The dTank /Jess API is a Java library that makes it possible to write intelligent tanks for dTank using Jess. In the dTank game a user’s tank wages battle with one to many agent-controlled tanks or other users. dTank was developed to help students learn how to create intelligent agents using a variety of programming evironments including: Soar, Java, and Jess.
What is the dTank/Jess API?
The dTank/Jess API is a Java library that makes it possible to write intelligent tanks for dTank using Jess. This library adds several custom functions to Jess that allow Jess agents to control a running dTank. The dTank/Jess API was created by Mark Cohen, an Instructor in the Business Adminstration, Computer Science, and Information Technology Department at Lock Haven University.
What is Jess?
Jess is a tool for building expert systems. Jess was written by Ernest Friedman-Hill at Sandia National Laboratories and is available at no cost for academic use. A special academic license must be obtained by contacting Sandia’s Technology Transfer Office. For more information about Jess, and details about how to obtain an academic license see the Jess website.
What is dTank?
dTank is a simulation game, created by Isaac Councill, a PhD student in the Applied Cognitive Science Lab at at the Pennsylvania State University’s school of Information Sciences and Technology. In the dTank game a user’s tank wages battle with one to many agent-controlled tanks or other users. dTank was developed to help students learn how to create intelligent agents using a variety of programming evironments including: Soar, Java, and Jess. To learn more about dTank, and to download it for free, visit the dTank website.
Installing the interface is easy. Create a directory named dTankJess and extract the contents of the dTankJess.zip file into this directory. This will create the following folder hierarchy:
dist - the dTankJess jarfile and the dTankJess zipfile. docs - the API documentation examples - example Jess programs that demonstrate how to drive a tank src - all the source code
Running the Examples
There are currently two examples located in the examples subfolder:
- FactFinder.clp – creates a tank and then just sits around reporting the facts in the Jess knowledge base that have been added by the dTank server. This is a great example to run when you want to see what types of facts are avialble to you when creating an intelligent tank.
- SimpleTank.clp – creates a very simple tank that will attempt to move to the same x-location of an enemy tank, and then fire away. If the tank does not see an enemy it will randomly change its location, and its turret angle until it sees an enemy, and then it will go after it. Finally, if the tank is near death, and it cannot see a tank, it will sit still and turn on its sheilds.
To run either of these examples you first must execute Jess, making sure that the dTankJess jarfile is in Jess’s classpath. For example, assuming the Jess jarfile is installed in jess and the current directory is the dTankJess installation folder, the following command will execute Jess so that it can find the dTankJess interface library:
java -classpath jessjess.jar;distdTankJess.jar jess.Main
Once Jess has been started, the next step is to execute a dTank server. See the dTank website for instructions on how to run a dTank server.
With Jess and dTank running, you are now in a position to test out one of the examples. You can use the Jess “batch” command to load either example. From the Jess command line shell type one of the following two commands:
(batch examples/FactFinder.clp) (batch examples/SimpleTank.clp)
The best way to discover the facts that are made available to Jess by this interface is to run the FactFinder.clp example. This Jess program will print the facts as they are added to the knowledge base by the dTank server. To see all the facts, create a human tank and move it into the visual range of the Jess tank. As soon as the Jess tank sees the human tank, additional facts will be added to the knowledge base, and printed on the screen.
It is important to realize that as information is received from the server, all old facts are retracted, before new facts are asserted. This means that even if the x location of the tank did not change, the fact that represents the x location will be retracted and reasserted in the Jess knowledge base.
Building the dTank/Jess API
The dTank/Jess distribution includes an Apache Ant build file. If you have ant installed, building the API is as simple as making the dTank/Jess installation directory the current directory, and then typing “ant” from the command line.
This current implementation is limited by the fact that it only records visual and status messages received from the dTank server. All other dTank server messages are ignored. Future versions of this interface will support all of the dTank messages.