Dribbling is the skill which allows the player to move down the field while keeping the ball close to the player the entire time. The basic idea is fairly simple: alternate kicks and dashes so that after one of each, the ball is still close to the player.
Every cycle, the agent looks to see that if it dashes this cycle, the ball will be in its kickable area (and not be a collision) at the next cycle. If so, then the agent dashes, otherwise it kicks. A kick is always performed assuming that on the next cycle, the agent will dash. As an argument, the low-level dribbling code takes the angle relative to the direction of travel at which the player should aim the ball (see Figure 4). This is called the ``dribble angle'' and its valid values are . Deciding what the dribble angle should be is discussed in Section 4.3.
Figure 4: The basic dribbling skill.
First the predicted position of the agent (in 2 cycles) is calculated:
where is the predicted player position, is the current position of the player, v is the current velocity of the player, pdecay is the server parameter player_decay, and a is the acceleration that a dash gives. The a value is usually just the dash power times the dash_power_rate in the direction the player is facing, but stamina may need to be taken into account.
Added to is a vector in the direction of the dribble angle and length such that the ball is in the kickable area. This is the target position of the ball. Then the agent gets the desired ball trajectory by the following formula:
where traj is the target trajectory of the ball, is the current ball position, and bdecay is the server parameter ball_decay. This process is illustrated in Figure 4.
If for some reason this kick can not be done (it would be a collision for example), then a turnball kick is done to get the ball in the right position. Then the next cycle, a normal dribble kick should work.
As can be seen from these calculations, the basic dribbling is highly predictive of the positions and velocities of the ball and player. It is also quite local in that it only looks 2 cycles ahead and recomputes the best action every cycle.