Game Engine

General
The game engine works as a state machine working in discrete timesteps.

TimeStepping

 * 1) Both teams Action methods are called to get the actions the developer wants to perform.
 * 2) A team is selected at random to perform its actions first.
 * 3) The first team performs his actions on each player, actions are performed in the order Goalie $${\rightarrow}$$ Left Defender $${\rightarrow}$$ Right Defender $${\rightarrow}$$ Left Forward $${\rightarrow}$$ Striker $${\rightarrow}$$ Right Forward. Then the second team preforms his actions in the same order.
 * 4) The players are moved.
 * 5) Timers such as tackleTimer are updated

Player Movement
The movement of the players is governed by the following differance equations.

$${\mathbf{vel}(t_{n+1}) = (\mathbf{vel}(t_{n}) +\mathbf{dir} \cdot PlayerMaxVelocity \cdot PlayerAccelerateFactor) \cdot PlayerSlowdownFactor}$$

$${\mathbf{pos}(t_{n+1}) = \mathbf{pos}(t_{n})+\mathbf{vel}(t_{n+1})}$$

where:

$${\mathbf{dir} = \left\{ \begin{array}{ll}

{ (\mathbf{destination}-\mathbf{pos})/|\mathbf{destination}-\mathbf{pos}|} & \mbox{if ActionGo} \\

\mathbf{0} & \mbox{else}.\end{array} \right.}$$

Ball Movement
The movement of the ball is governed by the following differance equations. \newline

$${\mathbf{pos}(t_{n+1}) = \mathbf{pos}(t_{n})+\mathbf{vel}(t_{n})}$$

$${\mathbf{vel}(t_{n+1}) = \mathbf{vel}(t_{n}) \cdot BallSlowdownFactor}$$

If the ball hits a wall, it is reflected elastically.

Shooting
When a player shoots the ball its velocity is set to a new value according to: $${\mathbf{vel} = \mathbf{dir} \cdot GoalVel}$$ where: $${\mathbf{dir} = A(\theta) \cdot (\mathbf{target}-\mathbf{pos})/|\mathbf{target}-\mathbf{pos}|}$$

$${GoalVel =ShootStrength/PlayerMaxShootStr \cdot BallMaxVelocity}$$

$${A(\theta)}$$ is a rotation $${\theta}$$ radians where $${\theta}$$ is distributed as $${\mathcal{N}(0,{(ShootStrength \cdot BallStd)}^2)}$$, a Normal Distribution with average 0 and standard deviation $${ShootStrength/PlayerMaxShootStr \cdot BallMaxStrStd}$$.

Tackling
When a player tackles another player there is a chance, given by PlayerTackleChance that he will succeed. If he does, the other player falls down for PlayerTackleTime turns and cannot do any action. If he fails, he falls down himself.

After a player has attempted a tackle, there is a cooldown given by PlayerTackleTimer during which the player can not tackle any player, so use your tackles sparsely.