Categorygithub.com/Trey2k/RLBotGo
modulepackage
0.0.0-20220520034821-d6d2b1184b4d
Repository: https://github.com/trey2k/rlbotgo.git
Documentation: pkg.go.dev

# 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.

# Packages

No description provided by the author

# Functions

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

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Depercated!!!.
No description provided by the author
Depercated!!!.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Never restart an existing match, just try to remove or spawn cars to match the configuration.
Always restart the match, even if config is identical.
Restart the match if any match settings differ.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
You're the GC of Bots.
Are you <Insert Pro>Bot? *.
Your programmer should be proud.
Who upped your skill level?.
The chances of that was 47525 to 1*.
Yeet!.
Ghost inputs.
Lag.
RIGGED.
404: Your skill not found.
Get a virus.
De-Allocate Yourself.
Git gud*.
Mafia plays!.
Waste of CPU cycles.
BOOPING.
Demoing!.
Faking!.
Passing!.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Custom text chats made by bot makers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

BallInfo The physics last touch and etc on the ball.
BallPrediction Contains a slice of predictions.
BoostPad Location and tpye of a boost pad.
BoostPadState The state of a given boost pad.
BoxShape Defines a shap of a box.
Color color in a RGBA format.
ControllerState Define the state of a controller.
DesiredBallState The desired ball state for a desired game state.
DesiredBoostState The desired boost state for a desired game state.
DesiredCarState the desired car state for a desired game state.
DesiredGameInfoState the desired fam info for a desired game state.
DesiredGameState Send a desired game state.
DropShotBallInfo info on a dropshot ball.
DropshotTile info on a dropshot tile.
FieldInfo BoostPad and goal info.
GameInfo info about the game.
No description provided by the author
No description provided by the author
GameState the game state struct.
GameTickPacket Send every tick and describes the current state of the game.
GoalInfo where are the goals??.
LoadoutPaint The paint information about a player.
MatchSettings The current match settings.
MutatorSettings What mutator settings are set.
Physics Describes where when and how a thing is.
PlayerClass A player type and skill level if psy bot.
PlayerConfiguration Information about a given player.
PlayerInfo Info on a specific player.
PlayerInput rlData for a player input.
PlayerInputChange information about a players input changing.
PlayerLoadout The aperance information about a player.
Notification when the local player is spectating another player.
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;.
PredictionSlice ball prediction for a given time.
QuickChat rlData for a qucikcaht.
ReadyMessage rlData for ready message.
No description provided by the author
No description provided by the author
No description provided by the author
Rotator Defines a rotation.
ScoreInfo score info on a specific player.
SphereShape Defines a shape of a sphere.
TeamInfo Info on a team.
Touch Anything you would want to know on a ball touch.
Vector3 Defines a point in space.