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). +Xis the car’s forward axis,+Zis up.- Blue defends
-Y, Orange defends+Y(seeTeam::get_y_dir).
§Feature overview
Arena/ArenaConfig— create the game, add cars, step ticks.CarControls/CarState/BallState— drive cars, read state.ArenaEvent— ball/world, car/ball, car/car, boost-pickup callbacks returned byArena::step_tick/Arena::get_last_step_events.MutatorConfig/GameMode/Team— game rules.Arena::cast_rays+RaycastQuery— batched (multiples of 4 are fastest) raycasts.
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.
- Arena
Config - Settings used to build an
crate::Arena. - Arena
State - Point-in-time snapshot from
crate::Arena::get_arena_state. - BVec2
- A 2-dimensional
boolvector mask. - BVec3
- A 3-dimensional
boolvector mask. - BVec4
- A 4-dimensional
boolvector mask. - Ball
HitWorld Event - Ball touched a static surface this tick (wall, floor, ceiling, goal mesh).
- Ball
State - Ball physics + mode state.
- Boost
PadConfig - Static boost-pad layout entry: world position (uu) + size class.
- Boost
PadState - Dynamic boost-pad state: seconds of cooldown left (
0= active). - Car
- A car in the arena (physics body + cached state).
- CarBody
Config - Hitbox + suspension preset for a car body (all lengths in uu).
- CarControls
- Driver inputs applied on the next
crate::Arena::step_tick. - CarHit
Ball Event - A car touched the ball this tick.
- CarHit
CarEvent - Two cars collided this tick (tested both directions).
- CarHit
World Event - A car touched a static surface; also stored as
CarState::world_contact_normalfor that tick. - CarInfo
- Immutable identity for a car: arena index, team, and hitbox preset.
- CarLanded
Event - A car’s
is_on_groundflippedfalse→truethis tick. - CarPickup
Boost Event - A car collected a boost pad (
boost_pad_idxmatchesArena::get_boost_pad_configorder). - CarState
- Full mutable car simulation state.
- Collision
Mesh File - One parsed
.cmfarena component (triangles + vertices in Bullet units). - Dropshot
Info - Dropshot charge/damage state.
- Heatseeker
Info - 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.
- Mutator
Config - Tunable game physics. Start from
MutatorConfig::newfor a game mode, then override individual fields viacrate::ArenaConfig::with_mutators. - Phys
State - Rigid-body pose + velocity shared by balls and cars.
- Raycast
HitInfo - Closest hit along a
RaycastQuerysegment, in Unreal units. - Raycast
Query - One segment query for
crate::Arena::cast_rays, in Unreal units. - Tile
States - 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.
- Wheel
Pair Config
Enums§
- Arena
Event - One tick’s contact/pickup notifications.
- Arena
MemWeight Mode - Broadphase memory/performance tradeoff for
crate::Arena. - Demo
Mode - How demos are awarded on car-car contact (see
Arenabumper logic). - Game
Mode - Which Rocket League game mode to simulate.
- Team
- Blue (
0) or Orange (1). - Tile
Damage State - Dropshot tile health:
Full -> Damaged -> Broken(broken = no collision). - User
Info Type - 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§
- Vec2
Swizzles - Vec3
Swizzles - Vis
- Optional visualization hook, called with a snapshot after each tick.
Functions§
- get_
arena_ collision_ mesh_ files - Returns a copy of the loaded
.cmffiles 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
.cmfbyte buffers. - is_
initialized - Returns
trueafter a successfulinit/init_from_default/init_from_memcall.