Documentation ¶
Overview ¶
Code generated by gen_client. DO NOT EDIT.
Index ¶
- Variables
- func ReportPanic(p interface{})
- type Agent
- type AgentFunc
- type AgentInfo
- type Client
- func (c *Client) ClearDebugDraw()
- func (c *Client) Connect(address string, port int, timeout time.Duration) error
- func (c *Client) CreateGame(mapPath string, players []*api.PlayerSetup, realtime bool) error
- func (c *Client) Data() *api.ResponseData
- func (c *Client) GameInfo() *api.ResponseGameInfo
- func (c *Client) GetObservation() (*api.ResponseObservation, error)
- func (c *Client) HasUpgrade(upgrade api.UpgradeID) bool
- func (c *Client) Init() error
- func (c *Client) IsInGame() bool
- func (c *Client) IsRealtime() bool
- func (c *Client) LeaveGame()
- func (c *Client) Observation() *api.ResponseObservation
- func (c *Client) OnAfterStep(callback func())
- func (c *Client) OnBeforeStep(callback func())
- func (c *Client) OnObservation(callback func())
- func (c *Client) PlayerID() api.PlayerID
- func (c *Client) Proto() api.ResponsePing
- func (c *Client) Query(query api.RequestQuery) *api.ResponseQuery
- func (c *Client) ReplayInfo() *api.ResponseReplayInfo
- func (c *Client) RequestJoinGame(setup *api.PlayerSetup, options *api.InterfaceOptions, ports Ports) error
- func (c *Client) RequestLeaveGame() error
- func (c *Client) RequestReplayInfo(path string) (*api.ResponseReplayInfo, error)
- func (c *Client) RequestStartReplay(request api.RequestStartReplay) error
- func (c *Client) SendActions(actions []*api.Action) []api.ActionResult
- func (c *Client) SendDebugCommands(commands []*api.DebugCommand)
- func (c *Client) SendObserverActions(obsActions []*api.ObserverAction)
- func (c *Client) SetPerfInterval(steps uint32)
- func (c *Client) SetProcessInfo(pi ProcessInfo)
- func (c *Client) Step(stepSize int) error
- func (c *Client) TryConnect(address string, port int) error
- func (c *Client) Upgrades() []api.UpgradeID
- type PlayerSetup
- type Ports
- type ProcessInfo
Constants ¶
This section is empty.
Variables ¶
var MaxMessageSize = 2 * 1024 * 1024
MaxMessageSize is the largest protobuf message that can be sent without getting disconnected. The gorilla/websocket implementation fragments messages above it's write buffer size and the SC2 game doesn't seem to be able to deal with these messages. There is not a check in place to prevent large messages from being sent and warnings will be printed if a message size exceeds half of this limit. The default is now 2MB (up from 4kb) but can be overrided by modifying this value before connecting to SC2.
Functions ¶
Types ¶
type AgentInfo ¶
type AgentInfo interface { IsRealtime() bool PlayerID() api.PlayerID GameInfo() *api.ResponseGameInfo ReplayInfo() *api.ResponseReplayInfo Data() *api.ResponseData Observation() *api.ResponseObservation Upgrades() []api.UpgradeID HasUpgrade(upgrade api.UpgradeID) bool IsInGame() bool Step(stepSize int) error Query(query api.RequestQuery) *api.ResponseQuery SendActions(actions []*api.Action) []api.ActionResult SendObserverActions(obsActions []*api.ObserverAction) SendDebugCommands(commands []*api.DebugCommand) ClearDebugDraw() LeaveGame() OnBeforeStep(func()) OnObservation(func()) OnAfterStep(func()) SetPerfInterval(steps uint32) }
AgentInfo ...
type Client ¶
type Client struct { Agent Agent // contains filtered or unexported fields }
Client ...
func (*Client) ClearDebugDraw ¶
func (c *Client) ClearDebugDraw()
ClearDebugDraw sends an empty draw command if previous draw commands have been sent
func (*Client) CreateGame ¶
CreateGame ...
func (*Client) GetObservation ¶
func (c *Client) GetObservation() (*api.ResponseObservation, error)
GetObservation ...
func (*Client) IsRealtime ¶
IsRealtime returns true if the bot was launched in realtime mode.
func (*Client) Observation ¶
func (c *Client) Observation() *api.ResponseObservation
Observation ...
func (*Client) OnObservation ¶
func (c *Client) OnObservation(callback func())
OnObservation is called after every observation. This is generally equivalent to OnAfterStep except in realtime mode when multiple observations may occur to reach the desired step size. This can be used to observe transient data that only appears in a single observation (actions, events, chat, etc).
func (*Client) RequestJoinGame ¶
func (c *Client) RequestJoinGame(setup *api.PlayerSetup, options *api.InterfaceOptions, ports Ports) error
RequestJoinGame ...
func (*Client) RequestReplayInfo ¶
func (c *Client) RequestReplayInfo(path string) (*api.ResponseReplayInfo, error)
RequestReplayInfo ...
func (*Client) RequestStartReplay ¶
func (c *Client) RequestStartReplay(request api.RequestStartReplay) error
RequestStartReplay ...
func (*Client) SendActions ¶
func (c *Client) SendActions(actions []*api.Action) []api.ActionResult
SendActions ...
func (*Client) SendDebugCommands ¶
func (c *Client) SendDebugCommands(commands []*api.DebugCommand)
SendDebugCommands ...
func (*Client) SendObserverActions ¶
func (c *Client) SendObserverActions(obsActions []*api.ObserverAction)
SendObserverActions ...
func (*Client) SetPerfInterval ¶
SetPerfInterval determines how often perfornace data will be updated. Values less than or equal to 0 will disable display (defalts to zero).
func (*Client) TryConnect ¶
TryConnect ...
type PlayerSetup ¶
type PlayerSetup struct { *api.PlayerSetup Agent }
PlayerSetup ...
func NewComputer ¶
func NewComputer(race api.Race, difficulty api.Difficulty, build api.AIBuild) PlayerSetup
NewComputer ...
func NewParticipant ¶
func NewParticipant(race api.Race, agent Agent, name string) PlayerSetup
NewParticipant ...