SAMPLE_TEAM.gcreceiver
This module shows how the GameController Communication protocol can be used in python and also allows to be changed such that every team using python to interface with the GC can utilize the new protocol.
Modded by Egor Davydenko egordv@gmail.com for elsiros league
Module Contents
Classes
This class puts up a simple UDP Server which receives the |
|
This class puts up a simple UDP Server which receives the |
|
This class puts up a simple UDP Server which receives the |
Attributes
- SAMPLE_TEAM.gcreceiver.logger[исходный код]
- SAMPLE_TEAM.gcreceiver.console_handler[исходный код]
- SAMPLE_TEAM.gcreceiver.DEFAULT_LISTENING_HOST = 0.0.0.0[исходный код]
- SAMPLE_TEAM.gcreceiver.GAME_CONTROLLER_LISTEN_PORT = 3838[исходный код]
- SAMPLE_TEAM.gcreceiver.GAME_CONTROLLER_ANSWER_PORT = 3939[исходный код]
- SAMPLE_TEAM.gcreceiver.parser[исходный код]
- class SAMPLE_TEAM.gcreceiver.GameStateReceiver(team, player, is_goalkeeper, addr=(DEFAULT_LISTENING_HOST, GAME_CONTROLLER_LISTEN_PORT), answer_port=GAME_CONTROLLER_ANSWER_PORT)[исходный код]
Bases:
object
This class puts up a simple UDP Server which receives the addr parameter to listen to the packages from the game_controller.
If it receives a package it will be interpreted with the construct data structure and the
on_new_gamestate()
will be called with the content.After this we send a package back to the GC
- _open_socket(self)[исходный код]
Erzeugt das Socket
- receive_forever(self)[исходный код]
Waits in a loop that is terminated by setting self.running = False
- receive_once(self)[исходный код]
Receives a package and interprets it. Calls
on_new_gamestate()
Sends an answer to the GC
- answer_to_gamecontroller(self, peer)[исходный код]
Sends a life sign to the game controller
- abstract on_new_gamestate(self, state)[исходный код]
Is called with the new game state after receiving a package Needs to be implemented or set :param state: Game State
- get_last_state(self)[исходный код]
- get_time_since_last_package(self)[исходный код]
- stop(self)[исходный код]
- set_manual_penalty(self, flag)[исходный код]
- class SAMPLE_TEAM.gcreceiver.SampleGameStateReceiver(team, player, is_goalkeeper, addr=(DEFAULT_LISTENING_HOST, GAME_CONTROLLER_LISTEN_PORT), answer_port=GAME_CONTROLLER_ANSWER_PORT)[исходный код]
Bases:
GameStateReceiver
This class puts up a simple UDP Server which receives the addr parameter to listen to the packages from the game_controller.
If it receives a package it will be interpreted with the construct data structure and the
on_new_gamestate()
will be called with the content.After this we send a package back to the GC
- on_new_gamestate(self, state)[исходный код]
Is called with the new game state after receiving a package Needs to be implemented or set :param state: Game State
- class SAMPLE_TEAM.gcreceiver.ThreadedGameStateReceiver(team, player, is_goalkeeper, addr=(DEFAULT_LISTENING_HOST, GAME_CONTROLLER_LISTEN_PORT), answer_port=GAME_CONTROLLER_ANSWER_PORT)[исходный код]
Bases:
GameStateReceiver
This class puts up a simple UDP Server which receives the addr parameter to listen to the packages from the game_controller.
If it receives a package it will be interpreted with the construct data structure and the
on_new_gamestate()
will be called with the content.After this we send a package back to the GC
- start(self)[исходный код]
- on_new_gamestate(self, state)[исходный код]
Is called with the new game state after receiving a package Needs to be implemented or set :param state: Game State