Add track recovery, fix Arctic Land bridge & 9-map sim/render, harden security & optimize runtime
- Add manual track recovery (R / Backspace / Gamepad Back), document controls in README.md, fix Track 8 (Arctic Land) bridge jump/clearance physics, and fix Track 5 respawn invincibility & Track 6 off-track AI recovery across all 9 maps - Verify 9-map sector morphing, combat (swept projectiles/LOS), pitstop chargers, and overpass/bridge surface sampling - Fix Overpass Bottom (-Y) diagonal split and AO, add TerrainChunk frustum culling, O(1) 3D Classic uPaletteLut, atlas gutter/bleed UVs, cached uniform locations, and reusable render scratch buffers - Harden VFS path traversal, RNC decompression bombs/truncated headers, asset/WAV parsers, GameConfig, save loaders, CLI args, and FLIC lifecycle - Optimize 48 kHz OPL3/SoundFont synthesis (trig LUTs, cached envelopes/filters), 64-bit XMI ticks, and audio parameter/thread safety - Add security, rendering, physics, and gameplay regression tests across all test suites
This commit is contained in:
1 parent
5c2ac8e70f
commit
db788a2739
50 files changed
+3522
-1100
No files matched your search
@@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
using namespace top_octane;
|
||||
|
||||
@@ -271,6 +272,9 @@ int main() {
|
||||
std::cout << " Track " << l << " 1-lap autopilot: finished=" << p1.finished
|
||||
<< " time=" << p1.race_time << "s\n";
|
||||
CHECK(p1.finished);
|
||||
if (l == 8) {
|
||||
CHECK(p1.race_time < 45.0f);
|
||||
}
|
||||
}
|
||||
std::cout << "[PASS] 1-lap autopilot completion verified across all 9 tracks\n";
|
||||
|
||||
@@ -479,5 +483,145 @@ int main() {
|
||||
CHECK(cruise[3] - cruise[2] >= 8.5f); // Vampyr vs Jugga
|
||||
std::cout << "[PASS] Vehicle top speeds & boost velocities strictly differentiate all 6 crafts\n";
|
||||
}
|
||||
|
||||
// 11. Track recovery placement from deep pit & under overhead tunnel ceiling
|
||||
{
|
||||
assets::LevelData lvl1, lvl2;
|
||||
CHECK(lvl1.load(vfs, 1));
|
||||
CHECK(lvl2.load(vfs, 2));
|
||||
|
||||
// 11a. Pit trap in Level 1 (32.5, 57.5) between cp 0 and cp 1 stays on outbound leg (x < 25, y > 0)
|
||||
sim::CraftState pit_car;
|
||||
pit_car.id = 0;
|
||||
pit_car.vehicle_idx = 0;
|
||||
pit_car.next_checkpoint = 1;
|
||||
pit_car.curr_pose.pos = Vec3(32.5f, lvl1.sample_height_world(32.5f, 57.5f) + 0.28f, 57.5f);
|
||||
pit_car.prev_pose = pit_car.curr_pose;
|
||||
pit_car.vel = Vec3(3.0f, -2.0f, 1.0f);
|
||||
pit_car.wrong_way = true;
|
||||
|
||||
std::vector<sim::CraftState> peers{pit_car};
|
||||
CHECK(sim::place_craft_on_track(pit_car, lvl1, peers, true));
|
||||
CHECK(pit_car.curr_pose.pos.y > 0.0f);
|
||||
CHECK(pit_car.curr_pose.pos.x < 25.0f);
|
||||
CHECK(pit_car.vel.len() < 1e-4f);
|
||||
CHECK(!pit_car.wrong_way);
|
||||
int ix = static_cast<int>(std::floor(pit_car.curr_pose.pos.x));
|
||||
int iz = static_cast<int>(std::floor(pit_car.curr_pose.pos.z));
|
||||
CHECK(!lvl1.is_cell_solid_at_point(ix, iz, pit_car.curr_pose.pos.x,
|
||||
pit_car.curr_pose.pos.z, pit_car.curr_pose.pos.y));
|
||||
CHECK(!lvl1.is_cliff_blocking_at_y(ix, iz, pit_car.curr_pose.pos.y));
|
||||
|
||||
// 11b. High-Y craft above Level 2 tunnel waypoint (126.5, 23.5) recovers on road beneath roof
|
||||
float gy2 = lvl2.sample_height_world(126.5f, 23.5f);
|
||||
sim::CraftState tun_car;
|
||||
tun_car.id = 0;
|
||||
tun_car.vehicle_idx = 0;
|
||||
tun_car.next_checkpoint = 1;
|
||||
tun_car.curr_pose.pos = Vec3(126.5f, gy2 + 5.0f, 23.5f);
|
||||
tun_car.prev_pose = tun_car.curr_pose;
|
||||
std::vector<sim::CraftState> peers2{tun_car};
|
||||
CHECK(sim::place_craft_on_track(tun_car, lvl2, peers2, true));
|
||||
float road_y2 = lvl2.sample_height_world(tun_car.curr_pose.pos.x, tun_car.curr_pose.pos.z);
|
||||
CHECK(tun_car.curr_pose.pos.y < road_y2 + 0.60f);
|
||||
CHECK(tun_car.curr_pose.pos.y >= road_y2 + 0.14f);
|
||||
std::cout << "[PASS] Track placement from pit & tunnel clearance verified\n";
|
||||
}
|
||||
|
||||
// 12. Track 8 (Arctic Land) ramp jump & bridge deck clearance across all 6 vehicles
|
||||
{
|
||||
assets::LevelData lvl8;
|
||||
CHECK(lvl8.load(vfs, 8));
|
||||
const float dt = static_cast<float>(FixedStepClock::kFixedDt);
|
||||
const float jump_yaw = std::atan2(90.5f - 56.0f, 70.5f - 69.5f);
|
||||
|
||||
auto run_bridge_jump = [&](int veh_idx, float start_x, float start_spd, int max_ticks) -> int {
|
||||
sim::CraftState c;
|
||||
c.id = 0;
|
||||
c.vehicle_idx = veh_idx;
|
||||
c.curr_pose.pos = Vec3(start_x, lvl8.sample_height_world(start_x, 69.5f) + sim::kVehicleSpecs[veh_idx].hover_offset, 69.5f);
|
||||
c.curr_pose.yaw = jump_yaw;
|
||||
c.prev_pose = c.curr_pose;
|
||||
c.vel = Vec3(std::sin(jump_yaw) * start_spd, 0.0f, std::cos(jump_yaw) * start_spd);
|
||||
c.fuel = c.max_fuel = 100.0f;
|
||||
|
||||
CraftInput in;
|
||||
in.throttle = 1.0f;
|
||||
float max_y = c.curr_pose.pos.y;
|
||||
float min_y_over_gap = 1e6f;
|
||||
for (int t = 0; t < max_ticks && c.curr_pose.pos.x < 79.0f; ++t) {
|
||||
sim::step_craft_physics(c, in, lvl8, dt, false);
|
||||
max_y = std::max(max_y, c.curr_pose.pos.y);
|
||||
if (c.curr_pose.pos.x >= 68.0f && c.curr_pose.pos.x <= 77.5f) {
|
||||
min_y_over_gap = std::min(min_y_over_gap, c.curr_pose.pos.y);
|
||||
}
|
||||
}
|
||||
CHECK(c.curr_pose.pos.x >= 78.5f);
|
||||
CHECK(max_y >= 2.15f);
|
||||
CHECK(min_y_over_gap >= 1.40f);
|
||||
return 0;
|
||||
};
|
||||
|
||||
for (int v = 0; v < 6; ++v) {
|
||||
CHECK(run_bridge_jump(v, 56.0f, sim::kVehicleSpecs[v].top_speed, 160) == 0);
|
||||
}
|
||||
// Slowest craft (Jugga, v=2) accelerating from dead stop right at wp[43] (65.5, 69.5)
|
||||
CHECK(run_bridge_jump(2, 65.5f, 0.0f, 180) == 0);
|
||||
std::cout << "[PASS] Track 8 (Arctic Land) bridge jump clearance verified for all 6 vehicles\n";
|
||||
}
|
||||
|
||||
// 13. Non-finite/non-positive dt safety + elevated deck pitch & tunnel ceiling re-clamp
|
||||
{
|
||||
assets::LevelData lvl2, lvl8;
|
||||
CHECK(lvl2.load(vfs, 2));
|
||||
CHECK(lvl8.load(vfs, 8));
|
||||
|
||||
sim::CraftState c;
|
||||
c.id = 0;
|
||||
c.vehicle_idx = 0;
|
||||
const Vec3 start_pos(75.5f, 2.25f, 70.5f);
|
||||
c.curr_pose.pos = start_pos;
|
||||
c.prev_pose = c.curr_pose;
|
||||
c.vel = Vec3(8.0f, 0.0f, 0.0f);
|
||||
c.fuel = c.max_fuel = 100.0f;
|
||||
|
||||
CraftInput drive;
|
||||
drive.throttle = 1.0f;
|
||||
drive.steer = 0.5f;
|
||||
|
||||
sim::step_craft_physics(c, drive, lvl8, 0.0f, true);
|
||||
CHECK((c.curr_pose.pos - start_pos).len_sq() < 1e-8f);
|
||||
sim::step_craft_physics(c, drive, lvl8, -1.0f, true);
|
||||
CHECK((c.curr_pose.pos - start_pos).len_sq() < 1e-8f);
|
||||
sim::step_craft_physics(c, drive, lvl8, std::numeric_limits<float>::quiet_NaN(), true);
|
||||
CHECK(std::isfinite(c.curr_pose.pos.x) && std::isfinite(c.curr_pose.pos.y) && std::isfinite(c.curr_pose.pos.z));
|
||||
CHECK((c.curr_pose.pos - start_pos).len_sq() < 1e-8f);
|
||||
|
||||
// Elevated bridge deck ride stability & smooth pitch
|
||||
const float dt = static_cast<float>(FixedStepClock::kFixedDt);
|
||||
for (int t = 0; t < 5; ++t) {
|
||||
sim::step_craft_physics(c, drive, lvl8, dt, false);
|
||||
}
|
||||
CHECK(std::isfinite(c.curr_pose.pitch) && std::isfinite(c.curr_pose.roll));
|
||||
CHECK(c.curr_pose.pos.y >= 1.9f);
|
||||
|
||||
// Tunnel ceiling re-clamp on Level 2 (126.5, 23.5)
|
||||
float road_y2 = lvl2.sample_height_world(126.5f, 23.5f);
|
||||
float fy = 0.0f, cy = 1e6f;
|
||||
lvl2.sample_surface_and_ceiling(126.5f, 23.5f, road_y2 + 0.30f, fy, cy);
|
||||
CHECK(cy < 1e5f);
|
||||
sim::CraftState tun;
|
||||
tun.id = 1;
|
||||
tun.vehicle_idx = 0;
|
||||
tun.curr_pose.pos = Vec3(126.5f, cy - 0.10f, 23.5f);
|
||||
tun.prev_pose = tun.curr_pose;
|
||||
tun.vel = Vec3(0.0f, 5.0f, 0.0f);
|
||||
float dummy_imp = 0.0f;
|
||||
bool dummy_scr = false;
|
||||
sim::resolve_world_collisions(tun, lvl2, dummy_imp, dummy_scr);
|
||||
CHECK(tun.curr_pose.pos.y <= cy - 0.45f);
|
||||
CHECK(tun.vel.y <= 0.0f);
|
||||
std::cout << "[PASS] Physics dt safety, bridge deck attitude & tunnel ceiling re-clamp verified\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user