4.4 Walking

The 3 low-level actions an agent can perform are to stand, walk, and kick. We will start with walk. Navigate to the strategy.cc file inside the codebase. This file can be found by navigating or using Crtl-F which allows you to type a search query.

In this example we utilise the prebuilt function goToTarget(). This function takes in an object of type VecPosition which is a size 3 vector which stores the x,y,z coordinate positions. For this example we are going to get the agent to constantly want to move to the balls position. To do this inside selectSkill() we return the following statement:

return goToTarget(ball); // Walk to the ball

Here we use the goToTarget() function with an input parameter ball. ball is an inherited variable of type VecPosition which represents the position of the ball. By returning goToTarget(ball) in selectSkill() the agent will move directly towards the ball without trying to avoid any other obstacles along the way.


Now goToTarget() is good and all but it does not account for an collision avoidance. To handle such needs as to not walk into your teammates or opponents you should look into using SmartGoToTarget which takes in both a VecPosition target location and a double proximity, which indicates how much the agent should avoid obstacles.