RLBotGo

package module
v0.0.0-...-d6d2b11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2022 License: MIT Imports: 7 Imported by: 0

README

RLBotGo

GoDoc

This repository holds a library for making Rocket League bots in Go!

It provides:

  • An easy to use interface for writing bots
  • An example bot using this library

Table of Contents:

GoBots

Here is a list of public bots made using the RLBotGo package.

About

This project was made to make it easy to write RL Bots in Go. Instead of using flatbuffer's datatypes, this library converts everything to Go types for ease of use.

Todo

Here are some things that could use some work in this repository's current state:

  • Add support for render groups
  • Add support for desired game state
  • Add game message support
  • Add some (potentially) useful math functions
  • Get #Go channel in RLBot Discord

Usage

The suggested starting point for using this library is using the RLBotGoExample repository as a template for your bot.

If you don't start with the example repository, start out with a connection to RLBot:

	rlBot, err := RLBot.Connect(23234)
	if err != nil {
		panic(err)
	}

After that, send your bot's ready message:

	err = rlBot.SendReadyMessage(true, true, true)
	if err != nil {
		panic(err)
	}

Call SetGetInput with the name of your desired callback function:

    rlBot.SetGetInput(tick)

Finally, write a function to return the player input every tick:

// getInput takes in a GameState which contains the gameTickPacket, ballPredidctions, fieldInfo and matchSettings
// it also takes in the RLBot object. And returns a PlayerInput
func getInput(gameState *RLBot.GameState, rlBot *RLBot.RLBot) *RLBot.ControllerState {
	PlayerInput := &RLBot.ControllerState{}

	// Count ball touches up to 10 and on 11 clear the messages and jump
	wasjustTouched := false
	if gameState.GameTick.Ball.LatestTouch.GameSeconds != 0 && lastTouch != gameState.GameTick.Ball.LatestTouch.GameSeconds {
		totalTouches++
		lastTouch = gameState.GameTick.Ball.LatestTouch.GameSeconds
		wasjustTouched = true
	}

	if wasjustTouched && totalTouches <= 10 {
    // DebugMessage is a helper function to let you quickly get debug text on screen. it will automaticaly place it so text will not overlap
		rlBot.DebugMessageAdd(fmt.Sprintf("The ball was touched %d times", totalTouches))
		PlayerInput.Jump = false
	} else if wasjustTouched && totalTouches > 10 {
		rlBot.DebugMessageClear()
		totalTouches = 0
		PlayerInput.Jump = true
	}
	return PlayerInput

}

After that, you should have a functional bot!

Some other useful things:

// Sending a quick chat
// (QuickChatSelection, teamOnly) refer to the godocs or RLBot documentation for all QuickChatSelection types
rlBot.SendQuickChat(RLBot.QuickChat_Custom_Toxic_404NoSkill, false)

// Sending a desired game state
// view https://pkg.go.dev/github.com/Trey2k/RLBotGo#DesiredGameState for more info
// Most fields are optional
desiredState := &RLBot.DesiredGameState{}
desiredState.BallState.Physics.Velocity = RLBot.Vector3{X: 0, Y: 0, Z: 1000}
rlBot.SendDesiredGameState(desiredState)

// Getting ball predictions
// This will be in the gameState sturct that you recive when the getInput callback is called
func getInput(gameState *RLBot.GameState, rlBot *RLBot.RLBot) *RLBot.ControllerState {
	// Loop through all the predictions we have and print the position and predicted time.
	// There should be a total of 6 * 60 predictions. 60 for every secound and a total of 6 secounds
	for i := 0; i < len(gameState.BallPrediction.Slices); i++ {
		prediction := gameState.BallPrediction.Slices[i]
		fmt.Printf("The ball will be at pos (%f, %f, %f) at %f game time", prediction.Physics.Location.X,
			prediction.Physics.Location.Y, prediction.Physics.Location.Z, prediction.GameSeconds)
	}
	return nil
}


Compiling

In order to use this library, you'll need to install and configure the following:

To compile your bot the first thing you will want to do is take a look at the bot folder in the Example Repo. Modify the config files to your liking and make sure you point to the correct executable file. After that you can simply use go build ./ and your bot should be built.

To add it to RLBot simply click the +Add button in RL Bot GUI and select the folder that contains the bot folder.

If sending your bot for a tournament it will probably be easiest to place the exe in the bot/src/ folder. Give the bot folder a more unique(Your bots name) name and zip that folder. Make sure to change the path to the exe in the bot.cfg file as well!

Contributing

Contributions are always welcome. If you're interested in contributing feel free to submit a PR.

License

This project is currently licensed under the permissive MIT license. Please refer to the license file for more information.

Documentation

Index

Constants

View Source
const (
	DropshotTile_Unkown = iota
	DropshotTile_Filled
	DropshotTile_Damaged
	DropshotTile_Open
)
View Source
const (
	PlayerClassType_RLBotPlayer = iota
	PlayerClassType_HumanPlayer
	PlayerClassType_PsyonixBotPlayer
	PlayerClassType_PartyMemberBotPlayer
)
View Source
const (
	DataType_TickPacket = iota + 1
	DataType_FieldInfo
	DataType_MatchSettings
	DataType_PlayerInput
	// Depercated!!!
	DataType_ActorMapping
	// Depercated!!!
	DataType_ComputerId
	DataType_DesiredGameState
	DataType_RenderGroup
	DataType_QuickChat
	DataType_BallPrediction
	DataType_ReadyMessage
	DataType_MessagePacket
)
View Source
const (
	GameMode_Soccer = iota
	GameMode_Hoops
	GameMode_Dropshot
	GameMode_Hockey
	GameMode_Rumble
	GameMode_Heatseeker
	GameMode_Gridiron
)
View Source
const (
	MatchLength_Five_Minutes = iota
	MatchLength_Ten_Minutes
	MatchLength_Twenty_Minutes
	MatchLength_Unlimited
)
View Source
const (
	MaxScore_Unlimited = iota
	MaxScore_One_Goal
	MaxScore_Three_Goals
	MaxScore_Five_Goals
)
View Source
const (
	OvertimeOption_Unlimited = iota
	OvertimeOption_Five_Max_First_Score
	OvertimeOption_Five_Max_Random_Team
)
View Source
const (
	SeriesLengthOption_Unlimited = iota
	SeriesLengthOption_Three_Games
	SeriesLengthOption_Five_Games
	SeriesLengthOption_Seven_Games
)
View Source
const (
	GameSpeedOption_Default = iota
	GameSpeedOption_Slo_Mo
	GameSpeedOption_Time_Warp
)
View Source
const (
	BallMaxSpeedOption_Default = iota
	BallMaxSpeedOption_Default_Slow
	BallMaxSpeedOption_Default_Fast
	BallMaxSpeedOption_Default_Super_Fast
)
View Source
const (
	BallTypeOption_Default = iota
	BallTypeOption_Cube
	BallTypeOption_Puck
	BallTypeOption_Basketball
)
View Source
const (
	BallWeightOption_Default = iota
	BallWeightOption_Light
	BallWeightOption_Heavy
	BallWeightOption_Super_Light
)
View Source
const (
	BallSizeOption_Default = iota
	BallSizeOption_Small
	BallSizeOption_Large
	BallSizeOption_Gigantic
)
View Source
const (
	BallBouncinessOption_Default = iota
	BallBouncinessOption_Low
	BallBouncinessOption_High
	BallBouncinessOption_Super_High
)
View Source
const (
	BoostOption_Normal_Boost = iota
	BoostOption_Unlimited_Boost
	BoostOption_Slow_Recharge
	BoostOption_Rapid_Recharge
	BoostOption_No_Boost
)
View Source
const (
	RumbleOption_No_Rumble = iota
	RumbleOption_Default
	RumbleOption_Slow
	RumbleOption_Civilized
	RumbleOption_Destruction_Derby
	RumbleOption_Spring_Loaded
	RumbleOption_Spikes_Only
	RumbleOption_Spike_Rush
)
View Source
const (
	BoostStrengthOption_One = iota
	BoostStrengthOption_OneAndAHalf
	BoostStrengthOption_Two
	BoostStrengthOption_Ten
)
View Source
const (
	GravityOption_Default = iota
	GravityOption_Low
	GravityOption_High
	GravityOption_Super_High
)
View Source
const (
	DemolishOption_Default = iota
	DemolishOption_Disabled
	DemolishOption_Friendly_Fire
	DemolishOption_On_Contact
	DemolishOption_On_Contact_FF
)
View Source
const (
	RespawnTimeOption_Three_Seconds = iota
	RespawnTimeOption_Two_Seconds
	RespawnTimeOption_One_Seconds
	RespawnTimeOption_Disable_Goal_Reset
)
View Source
const (
	// Restart the match if any match settings differ. This is the default because old RLBot always worked this way.
	ExistingMatchBehavior_Restart_If_Different = iota

	// Always restart the match, even if config is identical
	ExistingMatchBehavior_Restart

	// Never restart an existing match, just try to remove or spawn cars to match the configuration.
	// If we are not in the middle of a match, a match will be started. Handy for LAN matches.
	ExistingMatchBehavior_Continue_And_Spawn
)
View Source
const (
	GameMap_DFHStadium = iota
	GameMap_Mannfield
	GameMap_ChampionsField
	GameMap_UrbanCentral
	GameMap_BeckwithPark
	GameMap_UtopiaColiseum
	GameMap_Wasteland
	GameMap_NeoTokyo
	GameMap_AquaDome
	GameMap_StarbaseArc
	GameMap_Farmstead
	GameMap_SaltyShores
	GameMap_DFHStadium_Stormy
	GameMap_DFHStadium_Day
	GameMap_Mannfield_Stormy
	GameMap_Mannfield_Night
	GameMap_ChampionsField_Day
	GameMap_BeckwithPark_Stormy
	GameMap_BeckwithPark_Midnight
	GameMap_UrbanCentral_Night
	GameMap_UrbanCentral_Dawn
	GameMap_UtopiaColiseum_Dusk
	GameMap_DFHStadium_Snowy
	GameMap_Mannfield_Snowy
	GameMap_UtopiaColiseum_Snowy
	GameMap_Badlands
	GameMap_Badlands_Night
	GameMap_TokyoUnderpass
	GameMap_Arctagon
	GameMap_Pillars
	GameMap_Cosmic
	GameMap_DoubleGoal
	GameMap_Octagon
	GameMap_Underpass
	GameMap_UtopiaRetro
	GameMap_Hoops_DunkHouse
	GameMap_DropShot_Core707
	GameMap_ThrowbackStadium
	GameMap_ForbiddenTemple
	GameMap_RivalsArena
	GameMap_Farmstead_Night
	GameMap_SaltyShores_Night
	GameMap_NeonFields
	GameMap_DFHStadium_Circuit
)
View Source
const (
	QuickChat_Information_IGotIt = iota
	QuickChat_Information_NeedBoost
	QuickChat_Information_TakeTheShot
	QuickChat_Information_Defending
	QuickChat_Information_GoForIt
	QuickChat_Information_Centering
	QuickChat_Information_AllYours
	QuickChat_Information_InPosition
	QuickChat_Information_Incoming
	QuickChat_Compliments_NiceShot
	QuickChat_Compliments_GreatPass
	QuickChat_Compliments_Thanks
	QuickChat_Compliments_WhatASave
	QuickChat_Compliments_NiceOne
	QuickChat_Compliments_WhatAPlay
	QuickChat_Compliments_GreatClear
	QuickChat_Compliments_NiceBlock
	QuickChat_Reactions_OMG
	QuickChat_Reactions_Noooo
	QuickChat_Reactions_Wow
	QuickChat_Reactions_CloseOne
	QuickChat_Reactions_NoWay
	QuickChat_Reactions_HolyCow
	QuickChat_Reactions_Whew
	QuickChat_Reactions_Siiiick
	QuickChat_Reactions_Calculated
	QuickChat_Reactions_Savage
	QuickChat_Reactions_Okay
	QuickChat_Apologies_Cursing
	QuickChat_Apologies_NoProblem
	QuickChat_Apologies_Whoops
	QuickChat_Apologies_Sorry
	QuickChat_Apologies_MyBad
	QuickChat_Apologies_Oops
	QuickChat_Apologies_MyFault
	QuickChat_PostGame_Gg
	QuickChat_PostGame_WellPlayed
	QuickChat_PostGame_ThatWasFun
	QuickChat_PostGame_Rematch
	QuickChat_PostGame_OneMoreGame
	QuickChat_PostGame_WhatAGame
	QuickChat_PostGame_NiceMoves
	QuickChat_PostGame_EverybodyDance
	// Custom text chats made by bot makers
	QuickChat_MaxPysonixQuickChatPresets
	// Waste of CPU cycles
	QuickChat_Custom_Toxic_WasteCPU
	// Git gud*
	QuickChat_Custom_Toxic_GitGut
	// De-Allocate Yourself
	QuickChat_Custom_Toxic_DeAlloc
	// 404: Your skill not found
	QuickChat_Custom_Toxic_404NoSkill
	// Get a virus
	QuickChat_Custom_Toxic_CatchVirus
	// Passing!
	QuickChat_Custom_Useful_Passing
	// Faking!
	QuickChat_Custom_Useful_Faking
	// Demoing!
	QuickChat_Custom_Useful_Demoing
	// BOOPING
	QuickChat_Custom_Useful_Bumping
	// The chances of that was 47525 to 1*
	QuickChat_Custom_Compliments_TinyChances
	// Who upped your skill level?
	QuickChat_Custom_Compliments_SkillLevel
	// Your programmer should be proud
	QuickChat_Custom_Compliments_proud
	// You're the GC of Bots
	QuickChat_Custom_Compliments_GC
	// Are you <Insert Pro>Bot? *
	QuickChat_Custom_Compliments_Pro
	// Lag
	QuickChat_Custom_Excuses_Lag
	// Ghost inputs
	QuickChat_Custom_Excuses_GhostInputs
	// RIGGED
	QuickChat_Custom_Excuses_Rigged
	// Mafia plays!
	QuickChat_Custom_Toxic_MafiaPlays
	// Yeet!
	QuickChat_Custom_Exclamation_Yeet
)
View Source
const (
	RenderType_DrawLine2D = iota + 1
	RenderType_DrawLine3D
	RenderType_DrawLine2D_3D
	RenderType_DrawRect2D
	RenderType_DrawRect3D
	RenderType_DrawString2D
	RenderType_DrawString3D
	RenderType_DrawCenteredRect3D
)
View Source
const (
	GamesMessageType_PlayerStatEvent = iota
	GamesMessageType_PlayerSpectate
	GamesMessageType_PlayerInputChange
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BallInfo

type BallInfo struct {
	Physics      Physics
	LatestTouch  Touch
	DropShotInfo DropShotBallInfo
	Shape        SphereShape
}

BallInfo The physics last touch and etc on the ball

type BallPrediction

type BallPrediction struct {
	// A list of places the ball will be at specific times in the future.
	// It is guaranteed to sorted so that time increases with each slice.
	// It is NOT guaranteed to have a consistent amount of time between slices.
	Slices []PredictionSlice
}

BallPrediction Contains a slice of predictions. Expected size is 6 * 60. 6 secounds 60 predictions for every secound

type BoostPad

type BoostPad struct {
	Location    Vector3
	IsFullBoost bool
}

BoostPad Location and tpye of a boost pad

type BoostPadState

type BoostPadState struct {
	// True if the boost can be picked up
	IsActive bool

	// The number of seconds since the boost has been picked up, or 0.0 if the boost is active.
	Timer float32
}

BoostPadState The state of a given boost pad

type BoxShape

type BoxShape struct {
	Length float32
	Width  float32
	Height float32
}

BoxShape Defines a shap of a box

type Color

type Color struct {
	A uint8
	R uint8
	G uint8
	B uint8
}

Color color in a RGBA format

type ControllerState

type ControllerState struct {
	// -1 for full reverse, 1 for full forward
	Throttle float32

	// -1 for full left, 1 for full right
	Steer float32

	// -1 for nose down, 1 for nose up
	Pitch float32

	// -1 for full left, 1 for full right
	Yaw float32

	// -1 for roll left, 1 for roll right
	Roll float32

	// true if you want to press the jump button
	Jump bool

	// true if you want to press the boost button
	Boost bool

	// true if you want to press the handbrake button
	Handbrake bool

	// true if you want to press the 'use item' button, used in rumble etc.
	UseItem bool
}

ControllerState Define the state of a controller

type DesiredBallState

type DesiredBallState struct {
	Physics Physics
}

DesiredBallState The desired ball state for a desired game state

type DesiredBoostState

type DesiredBoostState struct {
	RespawnTime float32
}

DesiredBoostState The desired boost state for a desired game state

type DesiredCarState

type DesiredCarState struct {
	Physics      Physics
	BoostAmount  float32
	Jumped       bool
	DoubleJumped bool
}

DesiredCarState the desired car state for a desired game state

type DesiredGameInfoState

type DesiredGameInfoState struct {
	WorldGravityZ float32
	GameSpeed     float32
	Paused        bool
	EndMatch      bool
}

DesiredGameInfoState the desired fam info for a desired game state

type DesiredGameState

type DesiredGameState struct {
	BallState       DesiredBallState
	CarStates       []DesiredCarState
	BoostStates     []DesiredBoostState
	GameInfoState   DesiredGameInfoState
	ConsoleCommands []string
}

DesiredGameState Send a desired game state. useful for repeating the same scnerio

type DropShotBallInfo

type DropShotBallInfo struct {
	AbsorbedForce    float32
	DamageIndex      int32
	ForceAccumRecent float32
}

DropShotBallInfo info on a dropshot ball

type DropshotTile

type DropshotTile struct {
	// The amount of damage the tile has sustained.
	TileState int8
}

DropshotTile info on a dropshot tile

type FieldInfo

type FieldInfo struct {
	BoostPads []BoostPad // These will be sorted according to (y * 100 + x), and BoostInfo will be provided in the same order.
	Goals     []GoalInfo
}

FieldInfo BoostPad and goal info

type GameInfo

type GameInfo struct {
	SecondsElapsed    float32
	GameTimeRemaining float32
	IsOvertime        bool
	IsUnlimitedTime   bool
	// True when cars are allowed to move, and during the pause menu. False during replays.
	IsRoundActive bool
	// True when the clock is paused due to kickoff, but false during kickoff countdown. In other words, it is true
	// while cars can move during kickoff. Note that if both players sit still, game clock start and this will become false.
	IsKickoffPause bool
	// Turns true after final replay, the moment the 'winner' screen appears. Remains true during next match
	// countdown. Turns false again the moment the 'choose team' screen appears.
	IsMatchEnded  bool
	WorldGravityZ float32
	// Game speed multiplier, 1.0 is regular game speed.
	GameSpeed float32
	// Tracks the number of physics frames the game has computed.
	// May increase by more than one across consecutive packets.
	// Data type will roll over after 207 days at 120Hz.
	FrameNum int32
}

GameInfo info about the game. Alot of these are self explainitory

type GameMessagePacket

type GameMessagePacket struct {
	Messages     []GameMessageStruct
	GameSecounds float32
	FrameNum     int32
}

type GameMessageStruct

type GameMessageStruct struct {
	GameMessageType   int
	PlayerStatEvent   *PlayerStatEvent
	PlayerSpectate    *PlayerSpectate
	PlayerInputChange *PlayerInputChange
}

type GameState

type GameState struct {
	GameTick       *GameTickPacket
	BallPrediction *BallPrediction

	MatchSettings   *MatchSettings
	MatchSettingsOK bool
	FieldInfo       *FieldInfo
	FieldInfoOK     bool

	GameMessage   *GameMessagePacket
	GameMessageOK bool
}

GameState the game state struct

type GameTickPacket

type GameTickPacket struct {
	Players         []PlayerInfo
	BoostPadStates  []BoostPadState
	Ball            BallInfo
	GameInfo        GameInfo
	TileInformation []DropshotTile
	Teams           []TeamInfo
}

GameTickPacket Send every tick and describes the current state of the game

type GoalInfo

type GoalInfo struct {
	TeamNum   int32
	Location  Vector3
	Direction Vector3
	Width     float32
	Height    float32
}

GoalInfo where are the goals??

type LoadoutPaint

type LoadoutPaint struct {
	CarPaintId           int32
	DecalPaintId         int32
	WheelsPaintId        int32
	BoostPaintId         int32
	AntennaPaintId       int32
	HatPaintId           int32
	TrailsPaintId        int32
	GoalExplosionPaintId int32
}

LoadoutPaint The paint information about a player

type MatchSettings

type MatchSettings struct {
	PlayerConfigurations  []PlayerConfiguration
	GameMode              int8
	GameMap               int8
	SkipReplays           bool
	InstantStart          bool
	MutatorSettings       MutatorSettings
	ExistingMatchBehavior int8
	EnableLockstep        bool
	EnableRendering       bool
	EnableStateSetting    bool
	AutoSaveReplay        bool
	// The name of a upk file, like UtopiaStadium_P, which should be loaded.
	// If specified, this overrides gameMap. On Steam version of Rocket League,
	// this can be used to load custom map files, but on Epic version it only
	// works on the Psyonix maps. Still useful because maintaining the gameMap
	// enum as new Psyonix maps are added is annoying.
	GameMapUpk string
}

MatchSettings The current match settings

type MutatorSettings

type MutatorSettings struct {
	MatchLength          int8
	MaxScore             int8
	OvertimeOption       int8
	SeriesLengthOption   int8
	GameSpeedOption      int8
	BallMaxSpeedOption   int8
	BallTypeOption       int8
	BallWeightOption     int8
	BallSizeOption       int8
	BallBouncinessOption int8
	BoostOption          int8
	RumbleOption         int8
	BoostStrengthOption  int8
	GravityOption        int8
	DemolishOption       int8
	RespawnTimeOption    int8
}

MutatorSettings What mutator settings are set

type Physics

type Physics struct {
	Location        Vector3
	Rotation        Rotator
	Velocity        Vector3
	AngularVelocity Vector3
}

Physics Describes where when and how a thing is

type PlayerClass

type PlayerClass struct {
	Type     int
	BotSkill float64
}

PlayerClass A player type and skill level if psy bot

type PlayerConfiguration

type PlayerConfiguration struct {
	// Cannot be named 'class' because that breaks Java.
	// Cannot be named 'playerClass' because that breaks C#.
	Variety PlayerClass
	Name    string
	Team    int32
	Loadout PlayerLoadout
	// In the case where the requested player index is not available, spawnId will help
	// the framework figure out what index was actually assigned to this player instead.
	SpawnId int32
}

PlayerConfiguration Information about a given player

type PlayerInfo

type PlayerInfo struct {
	Physics      Physics
	ScoreInfo    ScoreInfo
	IsDemolished bool
	// True if your wheels are on the ground, the wall, or the ceiling. False if you're midair or turtling.
	HasWheelContact bool
	IsSupersonic    bool
	IsBot           bool
	// True if the player has jumped. Falling off the ceiling / driving off the goal post does not count.
	Jumped bool
	//  True if player has double jumped. False does not mean you have a jump remaining, because the
	//  aerial timer can run out, and that doesn't affect this flag.
	DoubleJumped bool
	Name         string
	Team         int32
	Boost        int32
	Hitbox       BoxShape
	HitboxOffset Vector3
	// In the case where the requested player index is not available, spawnId will help
	// the framework figure out what index was actually assigned to this player instead.
	SpawnId int32
}

PlayerInfo Info on a specific player

type PlayerInput

type PlayerInput struct {
	PlayerIndex     int32
	ControllerState ControllerState
}

PlayerInput rlData for a player input

type PlayerInputChange

type PlayerInputChange struct {
	PlayerIndex     int32
	ControllerState ControllerState

	// These are provided by Rocket League, and I'm passing them through. Theoretically they could be
	// inferred by jump + pitch + roll, but nice to have clarity.
	DodgeForward float32
	DodgeRight   float32
}

PlayerInputChange information about a players input changing

type PlayerLoadout

type PlayerLoadout struct {
	TeamColorId     int32
	CustomColorId   int32
	CarId           int32
	DecalId         int32
	WheelsId        int32
	BoostId         int32
	AntennaId       int32
	HatId           int32
	PaintFinishId   int32
	CustomFinishId  int32
	EngineAudioId   int32
	TrailsId        int32
	GoalExplosionId int32
	LoadoutPaint    LoadoutPaint
	// Sets the primary color of the car to the swatch that most closely matches the provided
	// RGB color value. If set, this overrides teamColorId.
	PrimaryColorLookup Color
	// Sets the secondary color of the car to the swatch that most closely matches the provided
	// RGB color value. If set, this overrides customColorId.
	SecondaryColorLookup Color
}

PlayerLoadout The aperance information about a player

type PlayerSpectate

type PlayerSpectate struct {
	PlayerIndex int32
}

/ Notification when the local player is spectating another player.

type PlayerStatEvent

type PlayerStatEvent struct {
	PlayerIndex int32
	StatType    string
}

/ Notification that a player triggers some in-game event, such as: / Win, Loss, TimePlayed; / Shot, Assist, Center, Clear, PoolShot; / Goal, AerialGoal, BicycleGoal, BulletGoal, BackwardsGoal, LongGoal, OvertimeGoal, TurtleGoal; / AerialHit, BicycleHit, BulletHit, JuggleHit, FirstTouch, BallHit; / Save, EpicSave, FreezeSave; / HatTrick, Savior, Playmaker, MVP; / FastestGoal, SlowestGoal, FurthestGoal, OwnGoal; / MostBallTouches, FewestBallTouches, MostBoostPickups, FewestBoostPickups, BoostPickups; / CarTouches, Demolition, Demolish; / LowFive, HighFive;

type PredictionSlice

type PredictionSlice struct {
	// The moment in game time that this prediction corresponds to.
	// This corresponds to 'secondsElapsed' in the GameInfo table.
	GameSeconds float32

	// The predicted location and motion of the object.
	Physics Physics
}

PredictionSlice ball prediction for a given time

type QuickChat

type QuickChat struct {
	QuickChatSelection int8

	// The index of the player that sent the quick chat
	PlayerIndex int32

	// True if the chat is team only false if everyone can see it.
	TeamOnly bool

	MessageIndex int32

	TimeStamp float32
}

QuickChat rlData for a qucikcaht

type RLBot

type RLBot struct {
	PlayerIndex int32
	// contains filtered or unexported fields
}

func Connect

func Connect(port int) (*RLBot, error)

Connect (port int) (Socket, error) Initiate the connection to RLBot returns a socket and a error on failure. Default port is 23234

func (*RLBot) DebugMessageAdd

func (socket *RLBot) DebugMessageAdd(text string) error

func (*RLBot) DebugMessageClear

func (socket *RLBot) DebugMessageClear() error

func (*RLBot) SendDesiredGameState

func (socket *RLBot) SendDesiredGameState(desiredGameState *DesiredGameState) error

SendDesiredGameState Send a specific game state. Good for testing

func (*RLBot) SendMessage

func (socket *RLBot) SendMessage(dataType uint16, data rlData) error

SendMessage (dataType uint16, data rlData) error Send a data payload to RLBot, returns a error on failure

func (*RLBot) SendQuickChat

func (socket *RLBot) SendQuickChat(quickChatSelection int8, teamOnly bool) error

SendQuickChat This will allow your bot to be toxic. Who doesn't want that?

func (*RLBot) SendReadyMessage

func (socket *RLBot) SendReadyMessage(wantsBallPredictions, wantsQuickChat, wantsGameMessages bool) error

SendReadyMessage Send the ready message to RLBot

func (*RLBot) SetGetInput

func (socket *RLBot) SetGetInput(handler func(gameState *GameState, socket *RLBot) *ControllerState) error

SetGetInput (handler func(gameState *GameState, socket *Socket) Set your tick handler function and start listening for gameTickPackets

type ReadyMessage

type ReadyMessage struct {
	// If this is set, RLBot will send BallPrediction data back to the client when available.
	WantsBallPredictions bool
	// If this is set, RLBot will send QuickChatMessages to the client when available.
	WantsQuickChat bool
	// If this is set, RLBot will send MessagePacket data back to the client when available.
	WantsGameMessages bool
}

ReadyMessage rlData for ready message

type RenderGroup

type RenderGroup struct {
	RenderMessages []RenderMessage
	/// The id of the render group
	Id int32
}

type RenderMessage

type RenderMessage struct {
	RenderType int8
	Color      Color
	/// For 2d renders this only grabs x and y
	Start Vector3
	/// For 2d renders this only grabs x and y
	End Vector3
	/// Scales the x size of the text/rectangle, is used for rectangles assuming an initial value of 1
	ScaleX int32
	/// Scales the y size of the text/rectangle, is used for rectangles assuming an initial value of 1
	ScaleY int32
	Text   string
	/// Rectangles can be filled or just outlines.
	IsFilled bool
}

type Rotator

type Rotator struct {
	Pitch float32
	Yaw   float32
	Roll  float32
}

Rotator Defines a rotation

type ScoreInfo

type ScoreInfo struct {
	Score       int32
	Goals       int32
	OwnGoals    int32
	Assists     int32
	Saves       int32
	Shots       int32
	Demolitions int32
}

ScoreInfo score info on a specific player

type SphereShape

type SphereShape struct {
	Diameter float32
}

SphereShape Defines a shape of a sphere

type TeamInfo

type TeamInfo struct {
	TeamIndex int32
	// number of goals scored.
	Score int32
}

TeamInfo Info on a team

type Touch

type Touch struct {
	// The name of the player involved with the touch.
	PlayerName string

	// Seconds that had elapsed in the game when the touch occurred.
	GameSeconds float32

	// The point32 of contact for the touch.
	Location Vector3

	// The direction of the touch.
	Normal Vector3

	// The Team which the touch belongs to, 0 for blue 1 for orange.
	Team int32

	// The index of the player involved with the touch.
	PlayerIndex int32
}

Touch Anything you would want to know on a ball touch

type Vector3

type Vector3 struct {
	X float32
	Y float32
	Z float32
}

Vector3 Defines a point in space

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL