CS344M: Autonomous Multiagent Systems -- Fall 2012: 2D Programming Assignment 4
This assignment is designed to get you familiar with the code
base that you will be using for your final project.
-
Helios.
Helios won the 2012 RoboCup competition and took second place at the
2011 competition.
This team includes all of the parsing, server interaction,
and individual skills (such as passing, dribbling, intercepting,
etc.). It also contains logic and action chains for high-level strategy.
Your goal is to create a team of agents that can play a full game of
soccer as follows:
-
Each player should be given a "home position" where it returns when
the ball is not near. You choose the home positions. Specifically, you should change the home positions from the defaults.
-
When the player thinks that no teammate could get to the ball
more quickly, it should try to get to the ball.
-
Once it has the ball, it should choose to dribble, pass, or shoot
(kick). In all cases you will need to specify a direction/target..
When your team is ready, have it play 2 games and turn in the
logfiles. One game should be against a team of agents that all go to
the ball (for example 11 of your assignment 2 agents). The other should be against itself.
Using Helios
To begin using the Helios code, follow these steps. First, copy
the code to your account:
% cp -r /projects/cs344M.pstone/2d/agent2d-3.1.1 .
Go into the resulting directory:
% cd agent2d-3.1.1
Run configure to generate an appropriate Makefile:
% ./configure --with-librcsc=/projects/cs344M.pstone/2d/librcsc-4.1.0/libs`getconf LONG_BIT`
Run make to compile the code:
% make
If everything worked, you should now have a player binary in the
"src/" directory called "sample_player". Go into the "src/" directory:
% cd src
You can start a whole team of players by running the "start.sh"
script:
% ./start.sh
Open up the "start.sh" script for details on usage. For example, you
can specify the team name with '-t' argument (use the '--help'
argument for a list of all command line options):
% ./start.sh -t myTeam
Now you can watch a real game! Of course, if you try to just run the
"start.sh" script in two seperate shells, you will get errors since
you are trying to start two teams with the same name. Also, don't
forget that you need to start the soccer server (run rcsoccsersim
) before you run the "start.sh" script.
Help on Helios
You can edit the base formation (home positions) used by the agents by editing the
.conf files in the formations directory. The different files
represent formations for different play modes, however for the scope of
this assignment you only need to worry about editing
normal-formation.conf (all the other .conf files are currently place
holders symlinked to normal-formation.conf and so editing
normal-formation.conf controls all formations). Entrys in the .conf
files are the following:
PlayerNumber PlayerRole XPos YPos
For this assignment you can just leave all roles as Sample but
you should change the default X and Y positions.
To edit the behavior of the agent go to
the RoleSample::execute()
method in role_sample.cc. This
is where the default behavior of standing in place after a kickoff
occurs. You'll want to edit this to have agents either go to their
home positions or run to the ball and kick it.
You don't need to do any parsing of messages as this is already
handled by the agent with all information stored in
a WorldModel.
The different functions of the WorldModel can be found in
/projects/cs344M.pstone/2d/librcsc-4.1.0/rcsc/player/world_model.*
To get information about server parameters such as field dimensions
check out /projects/cs344M.pstone/2d/librcsc-4.1.0/rcsc/common/server_param.h
The following are some useful pieces of code for the assignment:
// Get a pointer to the world model
const WorldModel & wm = agent->world();
// Agent's position in the world
Vector2D myPos = wm.self().pos();
// Position of the ball
Vector2D myBall = wm.ball().pos();
// Check if ball is kickable (should always be done before attempting to kick)
bool kickable = agent->world().self().isKickable();
// Current target position of agent in formation
const Vector2D formation_position = Strategy::i().getPosition( wm.self().unum() );
// Move to a point on the field
Body_GoToPoint( target_point, dist_thr, dash_power).execute( agent );
// A way to kick the ball at Vector2D target
Body_KickOneStep( target, ServerParam::i().ballSpeedMax() ).execute( agent );
// A list of teammates sorted in ascending order by their distance from the ball
agent->world().teammatesFromBall()
// Set neck to scan the field (you should always specify some neck turn)
agent->setNeckAction( new Neck_ScanField() );
You should look at the following files (and are encouraged to go
through others files as well) to understand their functionality, but not necessarily every detail.
1. The world model where the agent gets lots of information about its surroundings:
/projects/cs344M.pstone/2d/librcsc-4.1.0/rcsc/player/world_model.*
2. Low to mid level action behaviors:
/projects/cs344M.pstone/2d/librcsc-4.1.0/rcsc/action/*
3. High level behaviors (although these are not necessary to complete
this assignment):
src/bhv_*
4. Roles that an agent can assume that determine its behavior (for this
assignment all agents use the Sample role):
src/role_*
What to turn in:
- 2 logfiles of games as described above. The one against the team
of players that all go to the ball should be called
[yourlogin]-vs-herd.rcg. The one against itself should be called
[yourlogin]-vs-self.rcg. In both cases, run the game until two goals are
scored or your game reaches 1000 cycles (whichever comes first).
- Your tarred, gzipped source code,
[yourlogin]-source.tar.gz. You only need include files you've
modified.
- To turn in your files, use the turnin
program with grader "eladlieb" and assignment label "prog4". When the
assignment is there, send us an
email to that effect
with a brief description of what your team does.
[Back to Department Homepage]
Page maintained by
Elad Liebman
Questions? Send me
mail