Skip to content

Manipulating Game State

Tyler edited this page Sep 19, 2018 · 2 revisions

Overview

For a general description of the feature and its possibilities, please see https://github.com/RLBot/RLBot/wiki/Manipulating-Game-State

Usage

The basic call takes this form:

GameState gameState = new GameState();
RLBotDll.setGameState(gameState.buildPacket());

You can do that from anywhere in your bot code. That example doesn't do anything because nothing was specified on the GameState object. You can specify parts of your desired game state like this:

GameState gameState = new GameState()
        .withCarState(this.playerIndex, new CarState()
                .withPhysics(new PhysicsState()
                        .withVelocity(new DesiredVector3().withZ(300F))
                        .withRotation(new DesiredRotation((float) Math.PI, 0F, 0F))))
        .withBallState(new BallState().withPhysics(new PhysicsState().withLocation(new DesiredVector3(null, null, 500F))));

RLBotDll.setGameState(gameState.buildPacket());

With the above code, the bot will fling itself upward with its front pointed to the ceiling, and warp the ball to an elevation of 500 but without altering its x position, y position, or velocity.

Clone this wiki locally