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:
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.
% cp -r /projects/cs344M.pstone/2d/agent2d-3.1.1 .Go into the resulting directory:
% cd agent2d-3.1.1Run configure to generate an appropriate Makefile:
% ./configure --with-librcsc=/projects/cs344M.pstone/2d/librcsc-4.1.0/libsRun make to compile the code:
% makeIf everything worked, you should now have a player binary in the "src/" directory called "sample_player". Go into the "src/" directory:
% cd srcYou can start a whole team of players by running the "start.sh" script:
% ./start.shOpen 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 myTeamNow 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.
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.// 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:
What to turn in:
Page maintained by
Patrick MacAlpine
Questions? Send me
mail