Skip to main content

Crate rocketsim

Crate rocketsim 

Source
Expand description

Simulate Rocket League games at maximum efficiency.

RocketSim steps a full game (Arena) at 120 Hz using Unreal units (1 uu = 1 cm in-game, see consts::TICK_RATE).

§Quick start

Collision meshes must be loaded once before creating an Arena. init_from_default loads them from ./collision_meshes/:

use rocketsim::{Arena, CarBodyConfig, GameMode, Team, init_from_default};

init_from_default(true).unwrap();
let mut arena = Arena::new(GameMode::Soccar);
let car_idx = arena.add_car(Team::Blue, CarBodyConfig::OCTANE);
arena.reset_to_random_kickoff(None);

for _ in 0..120 {
    arena.step_tick();
}

§Units and coordinates

  • Positions, velocities, and dimensions are in Unreal units (uu) unless an item says otherwise (BT = Bullet physics meters, BT_TO_UU = 50).
  • +X is the car’s forward axis, +Z is up.
  • Blue defends -Y, Orange defends +Y (see Team::get_y_dir).

§Feature overview

Modules§

collision_mesh_file
consts
Game constants: tick rate, unit scales, per-mode arena/car/ball/goal tuning.
shared

Structs§

Arena
A full Rocket League game: ball, cars, boost pads/tiles, and physics.
ArenaConfig
Settings used to build an crate::Arena.
ArenaState
Point-in-time snapshot from crate::Arena::get_arena_state.
BVec2
A 2-dimensional bool vector mask.
BVec3
A 3-dimensional bool vector mask.
BVec4
A 4-dimensional bool vector mask.
BallHitWorldEvent
Ball touched a static surface this tick (wall, floor, ceiling, goal mesh).
BallState
Ball physics + mode state.
BoostPadConfig
Static boost-pad layout entry: world position (uu) + size class.
BoostPadState
Dynamic boost-pad state: seconds of cooldown left (0 = active).
Car
A car in the arena (physics body + cached state).
CarBodyConfig
Hitbox + suspension preset for a car body (all lengths in uu).
CarControls
Driver inputs applied on the next crate::Arena::step_tick.
CarHitBallEvent
A car touched the ball this tick.
CarHitCarEvent
Two cars collided this tick (tested both directions).
CarHitWorldEvent
A car touched a static surface; also stored as CarState::world_contact_normal for that tick.
CarInfo
Immutable identity for a car: arena index, team, and hitbox preset.
CarLandedEvent
A car’s is_on_ground flipped false → true this tick.
CarPickupBoostEvent
A car collected a boost pad (boost_pad_idx matches Arena::get_boost_pad_config order).
CarState
Full mutable car simulation state.
CollisionMeshFile
One parsed .cmf arena component (triangles + vertices in Bullet units).
DropshotInfo
Dropshot charge/damage state.
HeatseekerInfo
Heatseeker targeting state: which goal is targeted and how fast.
IVec2
A 2-dimensional vector.
IVec3
A 3-dimensional vector.
IVec4
A 4-dimensional vector.
Mat2
A 2x2 column major matrix.
Mat3
A 3x3 column major matrix.
Mat4
A 4x4 column major matrix.
Mat3A
A 3x3 column major matrix.
MutatorConfig
Tunable game physics. Start from MutatorConfig::new for a game mode, then override individual fields via crate::ArenaConfig::with_mutators.
PhysState
Rigid-body pose + velocity shared by balls and cars.
RaycastHitInfo
Closest hit along a RaycastQuery segment, in Unreal units.
RaycastQuery
One segment query for crate::Arena::cast_rays, in Unreal units.
TileStates
All Dropshot tiles: states[0] = Blue (70), states[1] = Orange (70).
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector.
Vec3A
A 3-dimensional vector.
WheelPairConfig

Enums§

ArenaEvent
One tick’s contact/pickup notifications.
ArenaMemWeightMode
Broadphase memory/performance tradeoff for crate::Arena.
DemoMode
How demos are awarded on car-car contact (see Arena bumper logic).
GameMode
Which Rocket League game mode to simulate.
Team
Blue (0) or Orange (1).
TileDamageState
Dropshot tile health: Full -> Damaged -> Broken (broken = no collision).
UserInfoType
What kind of physics body something is.

Constants§

BACK_WHEELS_OFFSET
BACK_WHEEL_RADS
BACK_WHEEL_SUS_REST
FRONT_WHEELS_OFFSET
FRONT_WHEEL_RADS
FRONT_WHEEL_SUS_REST
HITBOX_OFFSETS
Hitbox center offsets in uu (same preset order as HITBOX_SIZES).
HITBOX_SIZES
Full hitbox extents in uu for the 7 presets (Octane, Dominus, Plank, Breakout, Hybrid, Merc, Psyclops).

Traits§

Vec2Swizzles
Vec3Swizzles
Vis
Optional visualization hook, called with a snapshot after each tick.

Functions§

get_arena_collision_mesh_files
Returns a copy of the loaded .cmf files for a game mode.
init
Initializes RocketSim from a custom collision-mesh folder.
init_from_default
Initializes RocketSim from the default ./collision_meshes/ folder.
init_from_mem
Initializes RocketSim from already-loaded .cmf byte buffers.
is_initialized
Returns true after a successful init/init_from_default/init_from_mem call.