CS378: Autonomous Multiagent Systems -- Fall 2003: Programming Assignment 1


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


 

The following instructions are designed to work once you have logged onto a publinux machine. Mac users, please also check this installation guide. I recommend using a fairly fast machine. You can access a list of some fast computers by invoking the command "cshosts linuxtea".

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 9.3.7 for this class. There is a tarred, gzipped version of the server at /projects/cs378.pstone/rcsoccersim-9.3.7.tar.gz . Note that there is a patch in that directory as well.

Get familiar with the soccer simulator

  1. First, change your shell's PATH variable to include the robocup soccer server directory:
      /projects/cs378.pstone/rcsoccersim-9.3.7/install/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 this line to the end of it:
      export PATH=$PATH:/projects/cs378.pstone/rcsoccersim-9.3.7/install/bin/
    
    If you are using tcsh, open the file in your home directory named ".tcshrc" and add this line to the end of it:
      set path = ( $path /projects/cs378.pstone/rcsoccersim-9.3.7/install/bin/ )
    
    If you are using csh, open the file in your home directory named ".login" and add this line to the end of it:
      setenv PATH ${PATH}:/projects/cs378.pstone/rcsoccersim-9.3.7/install/bin/
    
    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/cs378.pstone/sampleclient        
            % ./client
            Type "(init myteam (version 9.3))" 
    	[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 9.3))" 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.  This will only happen once.  One way around 
    	this problem is to wait until cycle 200 before starting to dash.
     
            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/cs378.pstone/logs
        % ls 
Pick at least one of the games to watch. They are the finals from the previous 6 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