CS344M: Autonomous Multiagent Systems -- Fall 2008: Programming Assignment 1


Programming Assignment 1 - Part A for Autonomous Multiagent Systems (cs344M)


 

The following instructions are designed to work once you have logged onto a publinux machine. You can see a list of such machines by doing "cshosts publinux". Mac users, please also check this installation guide.

If you would like to work remotely and have a slow connection, you should look into installing the RoboCup Soccer Server System on your local machine. We will be using version 11 for this class. There are tarred, gzipped versions of the server components at /projects/cs344M.pstone/rcss_11/ . You can also get them from http://sourceforge.net/project/showfiles.php?group_id=24184 . Note that if you'd like to install the server on your laptop or home machine, there are instructions at the top of http://www.cs.utexas.edu/~mtaylor/instructions.htm .

Get familiar with the soccer simulator

  1. First, change your shell's PATH variable to include the robocup soccer server directory:
      /projects/cs344M.pstone/rcss_11/bin/
    
    To do this, first determine which shell you are using by typing
            % echo $SHELL
    
    at the command prompt. If you are using bash, open the file in your home directory named ".bashrc" and add these line to the end of it:
      export RCSSBASE=/projects/cs344M.pstone/rcss_11
      export BOOST_ROOT=/projects/cs344M.pstone/boost_1_34_1
      export PATH=$PATH:$RCSSBASE/bin/
      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BOOST_ROOT/lib:$RCSSBASE/lib
    
    or (if you don't already have a LD_LIBRARY_PATH set):
      export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$RCSSBASE/lib
    
    If you are using csh or tcsh, open the file in your home directory named ".login" and add this line to the end of it:
      setenv BOOST_ROOT /projects/cs344M.pstone/boost_1_34_1
      setenv RCSSBASE /projects/cs344M.pstone/rcss_11
      setenv PATH ${PATH}:${RCSSBASE}/bin
      setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BOOST_ROOT}/lib:${RCSSBASE}/lib
    
    or (if you don't already have a LD_LIBRARY_PATH set):
      setenv LD_LIBRARY_PATH ${BOOST_ROOT}/lib:${RCSSBASE}/lib
    
    Note: You will need to restart your shell (or just log out and log back in again) for these changes to take effect! For more information on setting your shell's environment variables, see this shell intro page.
  2. Make sure nobody else is running the simulator on the machine you're on:
    	% ps aux | grep rcss
    
    If someone is on, you will see a line with the word "rcssserver" in it. (For future reference, there IS a way to run multiple servers on the same machine.)
  3. If you are not running the server on the local muchine, run the following command:
    	% xhost a.cs.utexas.edu 
    	    where 'a' is the name of the machine you are using.
    
  4. In one shell, start the simulator:
            % rcsoccersim
    
    If the command rcsoccersim cannot be found, make sure that your PATH environment variable is set correctly (see the instructions above).
  5. In another shell, start a player:
    	% cd /projects/cs344M.pstone/sampleclient        
            % ./client
            Type "(init myteam (version 11))" 
    	[instead of myteam, use your own name] and watch the new agent's sensory information stream by. 
    
            Kill the client (ctrl-C). 
    
  6. Now start the player again, but pipe the output to a file:
            % ./client > ~/myteam.out    
            Type "(init myteam (version 11))" and see a 2nd agent appear on the field. 
            Type "(move -10 0)" and see the player move onto the field. 
            Press the "kickoff" button on the simulator window. 
            Type "(turn 45)" and see the player turn. 
            Type "(turn -45)" and see the player turn back. 
            Type "(dash 100)" and see the player move. 
            Type "(dash 100)" several more times until the player is next to the ball. 
            Type "(kick 100 0)" and see the ball move towards the goal. 
    
    	NOTE:  If you don't get the player to the ball by cycle 200, it may jump
    	back to where it started.  If you can't enter the dashes
    	quickly enough, you could try again, modifying the "(move -10
    	0)" command above to something like "(move -3 0)" so that the
    	player starts closer to the ball.
     
            Notice that all this time, the clock at the top of the simulator has been. 
            running.  When you kicked off, the play mode changed to "play_on". 
    
            Now middle-click with your mouse somewhere on the field and give. 
            a free kick to one of the teams.  Notice that the play mode changes. 
     
            Kill the client (ctrl-C). 
    
            Kill the simulator by hitting ctrl-C in the window that you
            started the server from.
     
            Now inspect the file ~/myteam.out to see the player's sensations 
            during the above sequence.   
             -- Search for "ball" (it should have become visible after the "move"). 
             -- Search for "referee" (changes to the play mode are announced). 
    	The flags are all static markers that help the player figure out where 
    	it is on the field.
    

NOTE that if you just close the soccer server window, you probably will just stop the monitor. The actual soccer server process ("rcssserver") will probably still be running, unless you stopped everything by hitting ctrl-c in the terminal window it started in. This can be annoying; if you want to kill the soccer server you'll probably have to find the process (ps aux | grep "rcss") and kill it manually.

In this exercise, you controlled the player by typing. Your sensations came from an overhead view of the field. Your task during this class will be to program agents to control players. Their sensations will be exactly what you saw in the file myteam.out.

Watch a game

In a shell, go to the game logs directory
        % cd /projects/cs344M.pstone/logs
        % ls 
Pick at least two of the games to watch, one recent and one older (to notice the difference in play). They are the finals from 8 previous RoboCup competitions.
        % rcsslogplay <game>  (e.g. "rcsslogplay 99final.rcg") 
(A full game lasts to cycle 6000. The 98 final is divided into 2 halves. The 2001 final goes into extra time.) If the log player doesn't work, see the instructions above to make sure that nobody is running the soccer server on your computer.

Create a game log

Now repeat the sequence from "Get familiar with the soccer simulator." After killing the server, notice that there will be a log file in the directory from which you ran the server:
	% ls *.rcg
replay your log:
        % rcsslogplay <file>.rcg  
(where <file> is the name of the log displayed by the previous command) Turn in the logfile as directed on the main assignments page. During this course, you will often be sending us such logfiles as the results of your programming assignments.

[Back to Department Homepage]

Page maintained by Peter Stone
Questions? Send me mail