Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
chapter designing the the ball down the field else

Chapter designing the the ball down the field else player-

168 |

Chapter 4

Designing the AI

When a player obtains control of the ball he immediately requests support by calling the PlayerBase::FindSupport method. FindSupport examines each team member in turn to determine which player is closest to the best supporting spot (calculated every few time steps by SupportSpot-Calculator) and messages that player to change state to SupportAttacker.

On entering this state, the player’s arrive behavior is switched on and its steering target is set to the location of the BSS.

If a player’s team loses control, the player should change state to move back toward its home position.

//if the best supporting spot changes, change the steering target if (player->Team()->GetSupportSpot() != player->Steering()->Target()) {
player->Steering()->SetTarget(player->Team()->GetSupportSpot());

As you have seen, the position of the best supporting spot changes accord-ing to many factors, so any supporting player must always make sure its steering target is kept updated with the latest position.

//if this player has a shot at the goal AND the attacker can pass //the ball to him the attacker should pass the ball to this player if( player->Team()->CanShoot(player->Pos(),
Prm.MaxShootingForce) )
{
player->Team()->RequestPass(player);
}

//if not threatened by another player request a pass if (!player->isThreatened())
{
player->Team()->RequestPass(player);
}
}
}

Finally, if the supporting player reaches the position of the BSS, it waits and makes sure it’s always facing the ball. If there are no opponents within its immediate vicinity and it doesn’t feel threatened, it requests a pass from the controlling player.

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Andrew Bates

PageId: ELI11776D9