Documentation ¶
Index ¶
- Variables
- func LoadSettings() bool
- func MapPath() string
- func NewComputer(race api.Race, difficulty api.Difficulty, build api.AIBuild) *api.PlayerSetup
- func NewParticipant(race api.Race, name string) *api.PlayerSetup
- func ProcessPathForBuild(build uint32) string
- func Random1v1Map() string
- func Set(name, value string)
- func SetConnectTimeout(timeout time.Duration)
- func SetExecutable(exePath string)
- func SetGameVersion(baseBuild uint32, dataVersion string)
- func SetInterfaceOptions(options *api.InterfaceOptions)
- func SetMap(name string)
- func SetRealtime()
- func StartProcess(path string, args []string) int
- type Client
- func (c *Client) Action(action api.RequestAction) (*api.ResponseAction, error)
- func (c *Client) AvailableMaps() (*api.ResponseAvailableMaps, error)
- func (c *Client) Connect(address string, port int, timeout time.Duration) error
- func (c *Client) CreateGame(createGame api.RequestCreateGame) (*api.ResponseCreateGame, error)
- func (c *Client) Data(data api.RequestData) (*api.ResponseData, error)
- func (c *Client) Debug(debug api.RequestDebug) error
- func (c *Client) Dial(address string, port int) error
- func (c *Client) GameInfo() (*api.ResponseGameInfo, error)
- func (c *Client) JoinGame(joinGame api.RequestJoinGame) (*api.ResponseJoinGame, error)
- func (c *Client) LeaveGame() error
- func (c *Client) MapCommand(mapCommand api.RequestMapCommand) (*api.ResponseMapCommand, error)
- func (c *Client) ObsAction(obsAction api.RequestObserverAction) error
- func (c *Client) Observation(observation api.RequestObservation) (*api.ResponseObservation, error)
- func (c *Client) Ping() (*api.ResponsePing, error)
- func (c *Client) Query(query api.RequestQuery) (*api.ResponseQuery, error)
- func (c *Client) QuickLoad() error
- func (c *Client) QuickSave() error
- func (c *Client) Quit() error
- func (c *Client) ReplayInfo(replayInfo api.RequestReplayInfo) (*api.ResponseReplayInfo, error)
- func (c *Client) Request(r *api.Request) (*api.Response, error)
- func (c *Client) RequestCreateGame(mapPath string, players []*api.PlayerSetup, realtime bool) error
- func (c *Client) RequestJoinGame(setup *api.PlayerSetup, options *api.InterfaceOptions, ports Ports) error
- func (c *Client) RestartGame() (*api.ResponseRestartGame, error)
- func (c *Client) SaveMap(saveMap api.RequestSaveMap) (*api.ResponseSaveMap, error)
- func (c *Client) SaveReplay() (*api.ResponseSaveReplay, error)
- func (c *Client) StartReplay(startReplay api.RequestStartReplay) (*api.ResponseStartReplay, error)
- func (c *Client) Step(step api.RequestStep) (*api.ResponseStep, error)
- func (c *Client) TryConnect(address string, port int) error
- type GameConfig
- func (config *GameConfig) Connect(port int)
- func (config *GameConfig) CreateGame(mapPath string) bool
- func (config *GameConfig) JoinGame() bool
- func (config *GameConfig) LaunchAndAttach(path string, c *Client) ProcessInfo
- func (config *GameConfig) LaunchProcess(client *Client) ProcessInfo
- func (config *GameConfig) LaunchStarcraft()
- func (config *GameConfig) SetupPorts(startPort int)
- func (config *GameConfig) StartGame(mapPath string)
- type Ports
- type ProcessInfo
Constants ¶
This section is empty.
Variables ¶
var ( LadderGamePort = 0 LadderStartPort = 0 LadderServer = "" LadderOpponentID = "" MapName = Random1v1Map() )
var (
LaunchPortStart = 8168
)
var Maps2021season1 = []string{
"DeathAura506",
"EternalEmpire506",
"EverDream506",
"GoldenWall506",
"IceandChrome506",
"PillarsofGold506",
"Submarine506",
}
var Maps2021season2 = []string{
"2000AtmospheresAIE",
"BlackburnAIE",
"JagannathaAIE",
"LightshadeAIE",
"OxideAIE",
"RomanticideAIE",
}
var MaxMessageSize = 10 * 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 10MB (up from 4kb) but can be overrided by modifying this value before connecting to SC2.
Functions ¶
func LoadSettings ¶
func LoadSettings() bool
func NewComputer ¶
func NewComputer(race api.Race, difficulty api.Difficulty, build api.AIBuild) *api.PlayerSetup
func NewParticipant ¶
func NewParticipant(race api.Race, name string) *api.PlayerSetup
func ProcessPathForBuild ¶
func Random1v1Map ¶
func Random1v1Map() string
Random1v1Map returns a random map name from the current 1v1 ladder map pool.
func SetConnectTimeout ¶
SetConnectTimeout sets how long to wait for a connection to the game.
func SetExecutable ¶
func SetExecutable(exePath string)
SetExecutable sets the default executable path to use.
func SetGameVersion ¶
SetGameVersion specifies a specific base game and data version to use when launching.
func SetInterfaceOptions ¶
func SetInterfaceOptions(options *api.InterfaceOptions)
SetInterfaceOptions sets the interface launch options when starting a game.
func StartProcess ¶
Types ¶
type Client ¶
type Client struct { api.ResponsePing Status api.Status Realtime bool // contains filtered or unexported fields }
func (*Client) Action ¶
func (c *Client) Action(action api.RequestAction) (*api.ResponseAction, error)
func (*Client) AvailableMaps ¶
func (c *Client) AvailableMaps() (*api.ResponseAvailableMaps, error)
func (*Client) CreateGame ¶
func (c *Client) CreateGame(createGame api.RequestCreateGame) (*api.ResponseCreateGame, error)
func (*Client) Data ¶
func (c *Client) Data(data api.RequestData) (*api.ResponseData, error)
func (*Client) JoinGame ¶
func (c *Client) JoinGame(joinGame api.RequestJoinGame) (*api.ResponseJoinGame, error)
func (*Client) MapCommand ¶
func (c *Client) MapCommand(mapCommand api.RequestMapCommand) (*api.ResponseMapCommand, error)
func (*Client) Observation ¶
func (c *Client) Observation(observation api.RequestObservation) (*api.ResponseObservation, error)
func (*Client) Query ¶
func (c *Client) Query(query api.RequestQuery) (*api.ResponseQuery, error)
func (*Client) ReplayInfo ¶
func (c *Client) ReplayInfo(replayInfo api.RequestReplayInfo) (*api.ResponseReplayInfo, error)
func (*Client) RequestCreateGame ¶
func (*Client) RequestJoinGame ¶
func (c *Client) RequestJoinGame(setup *api.PlayerSetup, options *api.InterfaceOptions, ports Ports) error
func (*Client) RestartGame ¶
func (c *Client) RestartGame() (*api.ResponseRestartGame, error)
func (*Client) SaveMap ¶
func (c *Client) SaveMap(saveMap api.RequestSaveMap) (*api.ResponseSaveMap, error)
func (*Client) SaveReplay ¶
func (c *Client) SaveReplay() (*api.ResponseSaveReplay, error)
func (*Client) StartReplay ¶
func (c *Client) StartReplay(startReplay api.RequestStartReplay) (*api.ResponseStartReplay, error)
func (*Client) Step ¶
func (c *Client) Step(step api.RequestStep) (*api.ResponseStep, error)
type GameConfig ¶
type GameConfig struct { Client *Client // contains filtered or unexported fields }
func LaunchAndJoin ¶
func LaunchAndJoin(bot, cpu *api.PlayerSetup) *GameConfig
func NewGameConfig ¶
func NewGameConfig(participants ...*api.PlayerSetup) *GameConfig
func (*GameConfig) Connect ¶
func (config *GameConfig) Connect(port int)
func (*GameConfig) CreateGame ¶
func (config *GameConfig) CreateGame(mapPath string) bool
func (*GameConfig) JoinGame ¶
func (config *GameConfig) JoinGame() bool
func (*GameConfig) LaunchAndAttach ¶
func (config *GameConfig) LaunchAndAttach(path string, c *Client) ProcessInfo
func (*GameConfig) LaunchProcess ¶
func (config *GameConfig) LaunchProcess(client *Client) ProcessInfo
func (*GameConfig) LaunchStarcraft ¶
func (config *GameConfig) LaunchStarcraft()
func (*GameConfig) SetupPorts ¶
func (config *GameConfig) SetupPorts(startPort int)
func (*GameConfig) StartGame ¶
func (config *GameConfig) StartGame(mapPath string)