ashkitten / RocketSim

A C++ library for simulating Rocket League games at maximum efficiency

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

A C++ library for simulating Rocket League games at maximum efficiency

Progress

Coming Soon:

  • Bumps and demos
  • Auto-flip when upside-down
  • Significant collision optimizations
  • Decent half-percision 60tps simulation

Done:

  • Car suspension
  • Car driving
  • Car jumps and flips
  • Arena collision
  • Proper ball bounces
  • Car-ball collision with proper forces (will be refined more in the near future)
  • Boost usage and boost pads

Simulation Accuracy

RocketSim is not perfectly accurate, but it's close enough that it shouldnt matter. Bots that work well in RocketSim will work well in the actual game, and visa-versa.

Example Usage

#include "./RocketSim/src/Sim/Arena/Arena.h"

// Make an arena instance (this is where our simulation takes place, has its own btDynamicsWorld instance)
Arena arena = Arena(GameMode::SOCCAR);

// Make a new car
// NOTE: The ball and all cars are freed from memory when their arena is deconstructed, you don't need to do it yourself
Car* car = arena.AddCar(Team::BLUE);

// Set up an initial state for our car
CarState carState = {};
carState.pos = { 0.f, 0.f, 17.f };
carState.vel = { 50.f, 0.f, 0.f };
car->SetState(carState);

// Setup a ball state
BallState ballState = {};
ballState.pos = { 0.f, 400.f, 100.f };
arena.ball->SetState(ballState);

// Make our car drive forward and turn
car->controls.throttle = 1;
car->controls.steer = 1;

// Simulate for 100 ticks
arena.Step(100);

// Lets see where our car went!
std::cout << "After " << arena.tickCount << "ticks, our car is at: " << car->GetState().pos << std::endl;

Issues & PRs

Feel free to make issues and pull requests if you encounter any issues!

You can also contact me on Discord if you have questions: Zealan#5987

Legal Notice

RocketSim was written to replicate Rocket League's game logic, but does not actually contain any code from the game.

About

A C++ library for simulating Rocket League games at maximum efficiency

License:MIT License


Languages

Language:C++ 96.7%Language:C 3.2%Language:CMake 0.0%