18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 03:52:52 +01:00

perf(test): no sounds, smoke, wipers or mirrors in the test mode

In the test mode nothing is heard or seen, yet every frame went through the sounds of the scenery and
of the vehicles near the camera (basic_region::update_sounds(): the cells' sounds, TTrack::
RenderDynSounds(), TDynamicObject::RenderSounds()), the smoke (particle_manager::update()) and the
wipers and the mirrors of every vehicle (updateWipers(), updateMirrors()). They're skipped there now.
Checked first that none of them changes what the simulation goes by:
- the sounds and the particles draw from the local engine of LocalRandom() only, which the physics,
  the AI and the events don't use (they draw from Random()'s engines);
- RenderSounds() clears the vehicle's sound flags (ClearSoundFlags(), ClearEventFlag(), the brake's
  GetSoundFlag()), which nothing but the sounds reads;
- the wiper positions and timers and the mirror positions are read by the renderers and the cab sounds only.
Kept: updateAxleClatter(), whose joint jolts shake the physics (ShakeVertically/Horizontally).
Outside the test mode nothing changes.

600 s in --test, seed 12345, one run each, the step before run again in the same session: Tomaszewo
sim 129.5 s against 129.9 s, L107 17.9 s against 17.9 s: no gain shows beyond the run-to-run spread
(the camera of the test mode, ghostview, has few sounds and smoke sources near it). The physics logs
(14 and 9) and the event logs are byte-identical to staging's, unit tests 1207/1207 with exact golden
traces.
This commit is contained in:
jerrrrycho
2026-11-30 11:07:35 +01:00
parent c529f9510f
commit 0aee37599a
2 changed files with 12 additions and 4 deletions
+7 -2
View File
@@ -487,13 +487,18 @@ bool driver_mode::update()
Timer::subsystem.switching.update();
Timer::subsystem.loop_audio.start();
simulation::Region->update_sounds();
// the test mode has no sound: the sounds of the scenery and of the vehicles aren't gone through. they draw from the local
// engine of Random() only (LocalRandom()), and clear the sound flags of the vehicles, which nothing else reads
if (false == Global.test.enabled)
simulation::Region->update_sounds();
audio::renderer.update(Global.iPause ? 0.0 : deltarealtime);
Timer::subsystem.loop_audio.stop();
// NOTE: particle system runs on simulation time, but needs actual camera position to determine how to update each particle source
// nor smoke in the test mode, which draws nothing: the particles draw from the local engine of Random() only
Timer::subsystem.loop_particles.start();
simulation::Particles.update();
if (false == Global.test.enabled)
simulation::Particles.update();
Timer::subsystem.loop_particles.stop();
Timer::subsystem.loop_renderer_update.start();