Fix pickup billboards, AI stuck recovery, vehicle top speeds, and add Revision assets
This commit is contained in:
1 parent
d001f214aa
commit
5a42ca9968
48 files changed
+995
-160
No files matched your search
+133
-8
@@ -202,7 +202,7 @@ int main() {
|
||||
|
||||
// 6. Authentic Sector Morphing across all 6 levels (Timed, Craft, Rocket triggers + columns/lights/pickups)
|
||||
{
|
||||
const size_t expected_morph_counts[6] = {1, 2, 5, 2, 7, 6};
|
||||
const size_t expected_morph_counts[6] = {1, 3, 5, 6, 7, 6};
|
||||
for (int l = 1; l <= 6; ++l) {
|
||||
assets::LevelData lvl;
|
||||
CHECK(lvl.load(vfs, l));
|
||||
@@ -292,7 +292,7 @@ int main() {
|
||||
CHECK(!msim.level().is_cell_solid_at_point(67, 63, 67.5f, 63.5f, col_y));
|
||||
}
|
||||
|
||||
// 6d. Level 4: Rocket id=153 collapses reactor (68,75) & unlocks grp=10 pickups; Craft id=256 + Rocket id=40 open bunker ONCE
|
||||
// 6d. Level 4: Rocket id=153 collapses reactor wall (69,83) & unlocks grp=10 pickups; Craft id=256 + Rocket id=40 open bunker ONCE
|
||||
{
|
||||
assets::LevelData lvl4;
|
||||
CHECK(lvl4.load(vfs, 4));
|
||||
@@ -301,8 +301,8 @@ int main() {
|
||||
ms.num_ai = 0;
|
||||
sim::RaceSim msim;
|
||||
CHECK(msim.start_race(lvl4, ms));
|
||||
CHECK(msim.level().cell(68, 75).height == 3360);
|
||||
CHECK(msim.level().cell(43, 114).tex_or_col == -172);
|
||||
CHECK(msim.level().cell(69, 83).height == 2992);
|
||||
CHECK(msim.level().cell(43, 114).tex_or_col == -168);
|
||||
for (int t = 0; t < 200; ++t) msim.step(CraftInput{}, CraftInput{}, dt);
|
||||
|
||||
auto& p1 = msim.crafts_mut()[0];
|
||||
@@ -315,7 +315,7 @@ int main() {
|
||||
fire.fire_missile = (t == 0);
|
||||
msim.step(fire, CraftInput{}, dt);
|
||||
}
|
||||
CHECK(msim.level().cell(68, 75).height == 2048);
|
||||
CHECK(msim.level().cell(69, 83).height == 2048);
|
||||
bool g10_unlocked = false;
|
||||
for (const auto& pk : msim.pickups()) {
|
||||
if (pk.group == 10) {
|
||||
@@ -330,7 +330,7 @@ int main() {
|
||||
p1.curr_pose.pos = Vec3(44.5f, msim.level().sample_height_world(44.5f, 49.5f) + 0.30f, 49.5f);
|
||||
p1.prev_pose = p1.curr_pose;
|
||||
for (int t = 0; t < 40; ++t) msim.step(CraftInput{}, CraftInput{}, dt);
|
||||
CHECK(msim.level().cell(43, 114).tex_or_col == -171);
|
||||
CHECK(msim.level().cell(43, 114).tex_or_col == -167);
|
||||
|
||||
p1.curr_pose.pos = Vec3(44.5f, msim.level().sample_height_world(44.5f, 117.0f) + 0.30f, 117.0f);
|
||||
p1.curr_pose.yaw = kPi;
|
||||
@@ -342,7 +342,7 @@ int main() {
|
||||
fire.fire_missile = (t == 0);
|
||||
msim.step(fire, CraftInput{}, dt);
|
||||
}
|
||||
CHECK(msim.level().cell(43, 114).tex_or_col == -171);
|
||||
CHECK(msim.level().cell(43, 114).tex_or_col == -167);
|
||||
}
|
||||
|
||||
// 6e. Level 5: Rocket id=286 blasts pillar (70,81); Craft id=275 starts blinking tunnel lights at (10,25)
|
||||
@@ -354,7 +354,7 @@ int main() {
|
||||
ms.num_ai = 0;
|
||||
sim::RaceSim msim;
|
||||
CHECK(msim.start_race(lvl5, ms));
|
||||
CHECK(msim.level().cell(70, 81).tex_or_col == -53);
|
||||
CHECK(msim.level().cell(70, 81).tex_or_col == -60);
|
||||
CHECK(msim.level().cell(10, 25).illumination == 12800);
|
||||
for (int t = 0; t < 200; ++t) msim.step(CraftInput{}, CraftInput{}, dt);
|
||||
|
||||
@@ -930,5 +930,130 @@ int main() {
|
||||
}
|
||||
std::cout << "[PASS] Original explosions, smoke trails, wreck plumes & steam vents validated\n";
|
||||
|
||||
// 10. Authentic Type-5 Pickup Subtypes (upgrades, double caps, invincible, invisible)
|
||||
{
|
||||
assets::LevelData flat_lvl;
|
||||
flat_lvl.map.resize(assets::kMapWidth * assets::kMapHeight);
|
||||
for (auto& m : flat_lvl.map) {
|
||||
m.height = 2048;
|
||||
m.tex_or_col = 0;
|
||||
}
|
||||
sim::RaceSetup ps;
|
||||
ps.mode = sim::GameMode::DeathMatch;
|
||||
ps.track_number = 1;
|
||||
ps.num_ai = 1;
|
||||
ps.damage_enabled = true;
|
||||
ps.weapons_enabled = true;
|
||||
|
||||
std::vector<sim::CraftState> crafts(2);
|
||||
crafts[0].id = 0;
|
||||
crafts[0].vehicle_idx = 0;
|
||||
crafts[0].curr_pose.pos = Vec3(50.0f, 0.28f, 50.0f);
|
||||
crafts[0].prev_pose = crafts[0].curr_pose;
|
||||
crafts[0].fuel = 20.0f;
|
||||
crafts[0].shield = 20.0f;
|
||||
crafts[0].ammo = 20.0f;
|
||||
|
||||
crafts[1].id = 1;
|
||||
crafts[1].vehicle_idx = 0;
|
||||
crafts[1].curr_pose.pos = Vec3(50.0f, 0.28f, 44.0f);
|
||||
crafts[1].curr_pose.yaw = 0.0f; // facing +Z toward craft 0
|
||||
crafts[1].prev_pose = crafts[1].curr_pose;
|
||||
|
||||
std::vector<sim::PickupItem> pks;
|
||||
for (uint8_t sub = 0; sub <= 13; ++sub) {
|
||||
sim::PickupItem pk;
|
||||
pk.entity_id = static_cast<uint16_t>(sub + 1);
|
||||
pk.subtype = sub;
|
||||
pk.group = 1;
|
||||
pk.group_unlocked = true;
|
||||
pk.active = true;
|
||||
pk.pos = Vec3(50.0f, 0.30f, 50.0f);
|
||||
pks.push_back(pk);
|
||||
}
|
||||
std::vector<sim::PropObject> props;
|
||||
std::vector<sim::ParticleBurst> parts;
|
||||
std::vector<sim::SimEvent> evs;
|
||||
std::vector<sim::Projectile> projs;
|
||||
bool ro = false;
|
||||
int wid = -1;
|
||||
std::vector<CraftInput> ins(2);
|
||||
|
||||
sim::step_combat_and_world(ps, flat_lvl, crafts, ins, projs, pks, props, parts, evs, ro, wid, dt);
|
||||
CHECK(crafts[0].invincible_timer > 10.0f);
|
||||
CHECK(crafts[0].invisible_timer > 10.0f);
|
||||
CHECK(crafts[0].max_shield >= 199.0f && crafts[0].shield >= 199.0f);
|
||||
CHECK(crafts[0].max_ammo >= 199.0f && crafts[0].ammo >= 199.0f);
|
||||
CHECK(crafts[0].max_fuel >= 199.0f && crafts[0].fuel >= 199.0f);
|
||||
CHECK(crafts[0].minigun_level == 2);
|
||||
CHECK(crafts[0].missile_level == 2);
|
||||
CHECK(crafts[0].booster_level == 2);
|
||||
|
||||
// Invisible blocks lock-on; Invincible blocks projectile damage
|
||||
crafts[1].lock_target_id = 0;
|
||||
crafts[1].lock_progress = 0.8f;
|
||||
float inv_sh = crafts[0].shield;
|
||||
ins[1].fire_minigun = true;
|
||||
for (int t = 0; t < 15; ++t) {
|
||||
sim::step_combat_and_world(ps, flat_lvl, crafts, ins, projs, pks, props, parts, evs, ro, wid, dt);
|
||||
CHECK(crafts[1].lock_target_id == -1);
|
||||
CHECK(crafts[1].lock_progress == 0.0f);
|
||||
}
|
||||
CHECK(crafts[0].shield == inv_sh);
|
||||
}
|
||||
std::cout << "[PASS] Authentic pickup subtypes (upgrades, double caps, invincible, invisible) validated\n";
|
||||
|
||||
// 11. Full 8-racer AI anti-stuck & progression check across all 6 tracks
|
||||
for (int l = 1; l <= 6; ++l) {
|
||||
assets::LevelData lvl;
|
||||
CHECK(lvl.load(vfs, l));
|
||||
sim::RaceSetup ms;
|
||||
ms.mode = sim::GameMode::SingleRace;
|
||||
ms.track_number = l;
|
||||
ms.total_laps = 2;
|
||||
ms.difficulty = 1; // Medium AI with full combat, pitstops, morphing & pickups
|
||||
ms.num_ai = 7;
|
||||
|
||||
sim::RaceSim msim;
|
||||
CHECK(msim.start_race(lvl, ms));
|
||||
msim.crafts_mut()[0].autopilot = true;
|
||||
|
||||
int stalled_ticks[8]{};
|
||||
int max_stalled_ticks[8]{};
|
||||
for (int t = 0; t < 9000 && !msim.race_finished(); ++t) {
|
||||
msim.step(CraftInput{}, CraftInput{}, dt);
|
||||
if (msim.countdown_active()) continue;
|
||||
for (size_t i = 0; i < msim.crafts().size(); ++i) {
|
||||
const auto& c = msim.crafts()[i];
|
||||
if (c.recovery_state == sim::RecoveryState::Active) {
|
||||
int cx = static_cast<int>(std::floor(c.curr_pose.pos.x));
|
||||
int cz = static_cast<int>(std::floor(c.curr_pose.pos.z));
|
||||
CHECK(!msim.level().is_cell_solid_at_point(
|
||||
cx, cz, c.curr_pose.pos.x, c.curr_pose.pos.z, c.curr_pose.pos.y));
|
||||
}
|
||||
if (c.finished || c.recovery_state != sim::RecoveryState::Active ||
|
||||
c.active_recharge_mask != 0) {
|
||||
stalled_ticks[i] = 0;
|
||||
continue;
|
||||
}
|
||||
if (c.speed_horizontal() < 1.5f && c.race_time > 2.0f) {
|
||||
stalled_ticks[i]++;
|
||||
max_stalled_ticks[i] = std::max(max_stalled_ticks[i], stalled_ticks[i]);
|
||||
} else {
|
||||
stalled_ticks[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
int progressed = 0;
|
||||
for (size_t i = 0; i < msim.crafts().size(); ++i) {
|
||||
const auto& c = msim.crafts()[i];
|
||||
CHECK(max_stalled_ticks[i] < 420); // never stuck >= 7.0 seconds
|
||||
CHECK(c.checkpoints_passed >= 4);
|
||||
if (c.finished || c.lap >= 2) ++progressed;
|
||||
}
|
||||
CHECK(progressed >= 6);
|
||||
}
|
||||
std::cout << "[PASS] All 6 tracks 8-racer AI anti-stuck & progression validated\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user