make a new function called timewallexsrap this is an exstraption version that uses logic…
- User
make a new function called timewallexsrap this is an exstraption version that uses logic like this // New reward cutoff logic float goalY = RLConst::SOCCAR_GOAL_SCORE_BASE_THRESHOLD_Y * (player.team == Team::BLUE ? 1 : -1); float distToGoalY = std::abs(ball.pos.y - goalY); float extrapScoreTime = distToGoalY / std::max(std::abs(ball.vel.y), 0.01f); Vec extrapScorePos = ball.pos + ball.vel * extrapScoreTime; extrapScorePos.z += CommonValues::GRAVITY_Z * (extrapScoreTime * extrapScoreTime) / 2; if (extrapScoreTime <= MIN_SCORE_TIME || extrapScorePos.z >= MAX_EXTRAP_Z) { reward = 0.0f; // Disable reward if the ball is about to score or go too high } but just for the car and the walls the nwhen its done finding the closest wall it then renders to rlbot a line from the car too the point on the wall the exstraption logic thinks is the spot the player is landing on GameState ToGameState(rlbot::GameTickPacket& gameTickPacket, int ticksElapsed, int tickSkip, const std::vectorRocketSim::Car*& rocketSimCars, uint64_t tickCount, const RLGSC::Action& controls) { GameState gs = {};
codeconst rlbot::flat::Touch* latestTouch = gameTickPacket->ball()->latestTouch(); float currentTime = gameTickPacket->gameInfo()->secondsElapsed(); auto players = gameTickPacket->players(); for (int i = 0; i < players->size(); i++) { RocketSim::Car* rocketSimCar = (i < rocketSimCars.size()) ? rocketSimCars[i] : nullptr; PlayerData player = ToPlayer(players->Get(i), rocketSimCar, tickCount, tickSkip, gameTickPacket, controls); if (latestTouch != nullptr && latestTouch->gameSeconds() > 0 && i == latestTouch->playerIndex() && currentTime - latestTouch->gameSeconds() < tickSkip / 120.0f) { player.ballTouchedStep = true; } else { player.ballTouchedStep = false; } gs.players.push_back(player); } gs.ball = ToPhysObj(gameTickPacket->ball()->physics()); gs.ballInv = gs.ball.Invert(); auto boostPadStates = gameTickPacket->boostPadStates(); if (boostPadStates->size() != CommonValues::BOOST_LOCATIONS_AMOUNT) { if (rand() % 20 == 0) { RG_LOG( "RLBotClient ToGameState(): Bad boost pad amount, expected " << CommonValues::BOOST_LOCATIONS_AMOUNT << " but got " << boostPadStates->size() ); } std::fill(gs.boostPads.begin(), gs.boostPads.end(), 1); } else { for (int i = 0; i < CommonValues::BOOST_LOCATIONS_AMOUNT; i++) { gs.boostPads[i] = boostPadStates->Get(i)->isActive(); gs.boostPadsInv[CommonValues::BOOST_LOCATIONS_AMOUNT - i - 1] = gs.boostPads[i]; gs.boostPadTimers[i] = boostPadStates->Get(i)->timer(); gs.boostPadTimersInv[CommonValues::BOOST_LOCATIONS_AMOUNT - i - 1] = gs.boostPadTimers[i]; } } return gs; - Assistant