soccer_strategy.game_engine_2d.GameEngine2D
- class soccer_strategy.game_engine_2d.GameEngine2D(display=True, team_1_strategy: type = <class 'soccer_strategy.strategy.strategy_dummy.StrategyDummy'>, team_2_strategy: type = <class 'soccer_strategy.strategy.strategy_dummy.StrategyDummy'>, team_1: ~soccer_strategy.team.Team | None = None, team_2: ~soccer_strategy.team.Team | None = None, game_duration: float = 20, set_to_ready_location=False)[source]
Bases:
object
2D simualtor for the game engine, used for testing strategy quickly without interfacing with webots
- __init__(display=True, team_1_strategy: type = <class 'soccer_strategy.strategy.strategy_dummy.StrategyDummy'>, team_2_strategy: type = <class 'soccer_strategy.strategy.strategy_dummy.StrategyDummy'>, team_1: ~soccer_strategy.team.Team | None = None, team_2: ~soccer_strategy.team.Team | None = None, game_duration: float = 20, set_to_ready_location=False)[source]
- Parameters:
display – Whether to show the visualizer
team_1_strategy – What strategy the team 1 will use
team_2_strategy – What strategy the team 2 will use
game_duration – How long to run the game (in minutes)
Methods
__init__
([display, team_1_strategy, ...])- param display:
Whether to show the visualizer
Reset's the robot and the team back to their initial state, so a new game happen
run
()Main loop for the 2D strategy executor, runs the strategies for both team against a vispy simulator
update_estimated_physics
(robots, ball)Executes the world physics step, robot's movement, ball movement, and for fairness it runs through the priority for kicks in a random fashion.
Attributes
DISPLAY_UPDATE_INTERVAL
PHYSICS_UPDATE_INTERVAL
- reset_robots()[source]
Reset’s the robot and the team back to their initial state, so a new game happen
- run()[source]
Main loop for the 2D strategy executor, runs the strategies for both team against a vispy simulator
- update_estimated_physics(robots: [<class 'soccer_strategy.robot_controlled_2d.RobotControlled2D'>], ball: ~soccer_strategy.ball.Ball)[source]
Executes the world physics step, robot’s movement, ball movement, and for fairness it runs through the priority for kicks in a random fashion.
- Parameters:
robots – The list of all robots including enemy robots
ball – The ball in the game