Golang Implementation of RLBot

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:

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:

10 { rlBot.DebugMessageClear() totalTouches = 0 PlayerInput.Jump = true } return PlayerInput } ">
// 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.

Owner
Trey Moller
Someone who likes to think they can code.
Trey Moller
Comments
  • How to read PlayerInputChange?

    How to read PlayerInputChange?

    Hi. I was trying to get a bot to to double jump (or flip) as quickly as possible, and intended to use PlayerInputChange to track what the game thinks our jump-button state is, but couldn't find any way to read the PlayerInputChange events.

    Is this something that's not fully implemented yet, or did I miss how PlayerInputChange is intended to be used?

    Without this information, it seems that I need to add some arbitrary delay between the release of the jump button and the second jump, but it seems slightly suboptimal, and reducing the delay too much seems to cause the second jump to not always register.

    Has anyone else dealt with the same issue? Thanks!

  • Rotator Data Issue

    Rotator Data Issue

    Pitch, Yaw, and Roll show as 0 rather than the actual value. Uncommenting lines panics: panic: runtime error: invalid memory address or nil pointer dereference

    https://github.com/Trey2k/RLBotGo/blob/687d586163b22c7f55ca858784ff8d1a8662d1ca/unmarshal.go#L289-L291

  • small fixes for debug.go and socket.go

    small fixes for debug.go and socket.go

    • fixed typo
    • renamed InnitConnection -> Connect
    • renamed faltFieldInfo -> flatFieldInfo
    • made all method receivers the same for all methods build on the RLBot struct because debug was using (rlbot *RLBot) and socket was using (socket *RLBOT)
  • Fix Ball predictions, faltbuffers fails GetRootAsBallPrediction for some reason

    Fix Ball predictions, faltbuffers fails GetRootAsBallPrediction for some reason

    https://github.com/Trey2k/RLBotGo/blob/fb191151745528f9a99b21a06e23f7265c43cb97/socket.go#L84-L87


    This issue was generated by todo based on a TODO comment in fb191151745528f9a99b21a06e23f7265c43cb97. It's been assigned to @Trey2k because they committed the code.
  • Figure out why we are not sent MatchSettings

    Figure out why we are not sent MatchSettings

    https://github.com/Trey2k/RLBotGo/blob/fb191151745528f9a99b21a06e23f7265c43cb97/socket.go#L78-L83


    This issue was generated by todo based on a TODO comment in fb191151745528f9a99b21a06e23f7265c43cb97. It's been assigned to @Trey2k because they committed the code.
  • For some reason these 2 fail

    For some reason these 2 fail

    https://github.com/Trey2k/RLBotGo/blob/3cc18778d33760c2b8f0ec033b5ed7d9741e06a5/unmarshal.go#L195-L198


    This issue was generated by todo based on a TODO comment in 3cc18778d33760c2b8f0ec033b5ed7d9741e06a5. It's been assigned to @Trey2k because they committed the code.
Related tags
A golang implementation of a console-based trading bot for cryptocurrency exchanges
A golang implementation of a console-based trading bot for cryptocurrency exchanges

Golang Crypto Trading Bot A golang implementation of a console-based trading bot for cryptocurrency exchanges. Usage Download a release or directly bu

Jun 4, 2022
Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)
Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)

Telego • Go Telegram Bot API Telego is Telegram Bot API library for Golang with full API implementation (one-to-one) The goal of this library was to c

Jan 5, 2023
Full-native go implementation of Telegram API
Full-native go implementation of Telegram API

MTProto Full-native implementation of MTProto protocol on Golang! english русский 简体中文 Features Full native implementation All code, from sending requ

Jan 1, 2023
DingTalk (dingding) is the go implementation of the DingTalk robot. DingTalk(dingding) 是钉钉机器人的 go 实现
DingTalk (dingding) is the go implementation of the DingTalk robot. DingTalk(dingding) 是钉钉机器人的 go 实现

DingTalk (dingding) is the go implementation of the DingTalk robot. Support Docker, Jenkinsfile, command line mode, module mode, signature security settings, chain syntax to create messages, support text, link, markdown,ActionCard,FeedCard message types.

Jan 3, 2023
GoAlgoTrade is a Go implementation of PyAlgoTrade.

GoAlgoTrade is a Go implementation of PyAlgoTrade.

Dec 6, 2022
Golang-kraken - Golang client for Kraken API

golang-kraken Golang client for the Kraken API. Getting Started Installing go ge

Oct 20, 2022
Golang telegram bot API wrapper, session-based router and middleware

go-tgbot Pure Golang telegram bot API wrapper generated from swagger definition, session-based routing and middlewares. Usage benefits No need to lear

Nov 16, 2022
Golang Framework for writing Slack bots

hanu - Go for Slack Bots! The Go framework hanu is your best friend to create Slack bots! hanu uses allot for easy command and request parsing (e.g. w

Oct 24, 2022
Golang bindings for the Telegram Bot API

Golang bindings for the Telegram Bot API All methods are fairly self explanatory, and reading the godoc page should explain everything. If something i

Jan 6, 2023
Golang Based Account Generator Telegram Bot

Account Generator Bot Account Generator Bot, written in GoLang via gotgbot library. Variables Env Vars - BOT_TOKEN - Get it from @BotFather CHANNEL_ID

Nov 21, 2022
telegram客户端for golang,本程序用于使用自己账号定时发送tg消息给指定用户/组/channe

使用说明 此项目主要用于tg自己账号登录 定时发送消息给某人 当前容器支持 amd64、i386、arm64、armhf 特别说明!!! tg的验证码不是发的手机短信,是发送到了tg客户端上!!!!国内手机号需要加上+86!! 首次使用需要进行登录 需要使用docker run进行登录处理 dock

Aug 18, 2021
its the same idea as bruh-bot, but with golang, and add more bots
its the same idea as bruh-bot, but with golang, and add more bots

bruh-bot but more powerful! requirements python go you can used on mac and linux the idea its really simple, can make a lot of bots with the same task

Jul 7, 2021
Library for working with golang telegram client + bot based on tdlib. This library was taken from the user Arman92 and changed for the current version of tdlib.

go-tdlib Golang Telegram TdLib JSON bindings Install To install, you need to run inside a docker container (it is given below) go get -u github.com/ka

Dec 2, 2022
discord exploit tools written in golang

The ultimate CLI tool for TiKV

Aug 19, 2021
Check for new github releases of your Golang application 🎊

whatsnew Check for new github releases of your Golang application ?? whatsnew provides a simple way to check GitHub for new releases of your Go applic

Dec 1, 2021
A bot based on Telegram Bot API written in Golang allows users to download public Instagram photos, videos, and albums without receiving the user's credentials.

InstagramRobot InstagramRobot is a bot based on Telegram Bot API written in Golang that allows users to download public Instagram photos, videos, and

Dec 16, 2021
Bot para o discord escrito em Golang durante o workshop ministrado na Codecon 2021

Codecon Bot Bot para o discord escrito em Golang durante o workshop ministrado na Codecon 2021 Primeiramente no arquivo main.go coloque o TOKEN do bot

Oct 4, 2021
企业微信群机器人接口 Golang 封装

wxwork-bot-go 企业微信群机器人接口 Golang 封装 Usage package main import ( "fmt" "log" "github.com/vimsucks/wxwork-bot-go" ) func main() { bot :

Jan 3, 2023
Golang bot that connects to slack using Socketclient to read and write messages.
Golang bot that connects to slack using Socketclient to read and write messages.

?? (not)simple go project ?? Golang bot that connects to slack using Socketclient to read and write messages. ?? Use ?? @SquidBot : Mentions your name

Aug 23, 2022