The purpose of this lab is to give you experience with simple reactive agents using potential fields as a form of “intelligence.” You will do the following:
No internal states will be allowed for your agent. All actions should be based purely on the current state of the world. With two exceptions 1) when coding the PD controller, you will need to compute the derivative of (change in) the error, so you can keep your previous error, and 2) You can use the fact that you are holding the flag to know that it is time to return to your base.
Assuming you already completed the BZFlag Tutorial Homework, you should have everything you need for this lab. Jonathan Nielsen got BZRFlag to work on Windows and was nice enough to share his accomplishment with everyone else. A tutorial for setting it up is at BZRFlag on Windows.
In contrast to the BZFlag Tutorial Homework where you used telnet and your own intelligence to control the tanks, in this lab you will build a program to control the tanks. You can do this in any language you want and you can even run it on a variety of platforms. HOWEVER, we can only help you on Linux and in Python and C++. You are welcome to try other things but you will be more or less on your own.
You will be responsible for building code to open a socket, sending commands and listening for the responses. You are strongly encouraged to hunt around on the web for resources. If you find something useful please post a link on the discussion tab of this page. The sample code we give you is intended to be one such resource. As you write your networking code, start simple. Just use a synchronous model, you can add threads later, but you can build a successful agent without them. Go on a date instead of adding threads!
A sample agent in Python has been provided in the bzrflag/bots directory, agent0.py. Please appreciate this code for what it is. While bzrc.py is a separate file that looks like a library, it is not intended to be a polished product. Depending on your language and programming environment, this code will serve as either a starting point or a helpful outline. From now on, this is your code.
There are also other pre-compiled bots in the ~cs470s/bzrflag/bzagents/compiled directory (agent1.pyc, agent2.pyc, and agent3.pyc). Throughout the labs, feel free to run these pre-compiled versions to have simple agents to test your code against. runme.sh shows how to use the pre-compiled agents. agent1.py is smarter than agent0.py, and agent2.py is smarter than agent1.py. agent3.py currently is only very slightly better than agent2.py; you probably can't tell the difference between them. None of them are particularly intelligent - by the end of class I imagine you should be able to beat each of them, especially in complicated worlds.
Some sample code has also been written in C++: 470bot.h and Lab1_Main.cpp. Unfortunately, this code is much less cool than the sample Python agent, but again, it is a starting point to help you write your agent.
In addition to the code you will need to communicate with your tank and to determine what it should do (potential fields), you will also need code to visualize your potential fields. Use gnuplot for this visualization. See the Gnuplot hints page for more information.
Once you have the basic socket communication working build a really dumb agent. This agent should repeat the following forever:
In addition to this movement your really dumb agent should also shoot every 2 seconds (random between 1.5 and 2.5 seconds) or so.
Once you have one tank doing this, create a team that has two such agents.
Now create a simple reactive agent. You will do this using potential fields. Refer to the potential field tutorial on the schedule. You must build a potential fields based reactive agent (the “pf” agent) which implements the following fields:
Use all three fields to help a BZRFlag agent capture an enemy flag and return it to your base. N
Use the visualization code described above so that you can see your fields. You will also need visualization for your lab report.
You will need to test your pf agent as follows:
Do each of these tests in the four l's world and in the rotated box world (both of these are already in bzrflag/maps).
To pass off this lab, you will need to do the following:
It is NOT required that the you demonstrate in person to the TA that your agent (using potential fields) can capture the enemy flag (guarded by two “Really Dumb Agents”).
The writeup should describe in detail what all of the fields do and why you coded them in the manner that you did. Do not just say, “I used an attractive field,” Go into detail. Plot graphs of what the field looks like and put those into the paper. Plot them individually (attractive, repulsive, tangential, and any others that you came up with) and together. Explain your tuning process and what alternative you considered.
You must also comment on your results for each of the test scenarios listed above. Do not just say “we won”. What cool behaviors have you been able to create in your implementation? How did you do against someone else's dumb agent?
You must report (briefly) on the results the “other group” had against you. Include their names to so that we can verify that everyone “passed off” against someone. Also give the names of the people you passed off against, again, make sure you say how you did.
Though the paper need not be very long, do a nice job and make it look professional. I sort of expect to see a couple of pages of text and many graphs of your fields. One of the best ways to get a professional looking paper nearly for free is to use LaTeX, so that is what I recommend. PDF files are always appreciated, Postscript, Word, and Open Office are fine as well.
The lab will be graded out of 100 points, with break downs in the following way:
Failing to follow directions in other areas (like saying how much time was spent and submitting code) will take away points.
Thanks to Chris Monson, Andrew McNabb, David Wingate and Kirt Lillywhite