18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 07:22:42 +01:00
Commit Graph

4643 Commits

Author SHA1 Message Date
jerrrrycho 75efb467db perf(physics): the new worker jobs only with enough work, the hose exchange of a train in shared helpers
Review of #574:
- The sub-steps of one train and its exchange in them are helpers (train_substeps(), exchange_train()) taken by both the
  serial loop and the cluster job (exchange_cluster()), which gets one context struct (hose_exchange) by reference, so
  std::function keeps it in its small buffer. Picking the trains (hose_layout()) is its own function too.
- The runner of the clusters gets the number of vehicles exchanged and wakes the pool only for at least 64 of them a
  thread; below that the clusters go one after another. The neighbours and facts take a thread for each 64 vehicles
  and stay in the main thread below 128. With performance.multithreading no both still go one after another.
- The neighbours and facts moved out of update() into update_neighbours_and_facts() and take_facts(); the inner loop
  variable is side, no longer shadowing end. The vehicles outside the trains of lay_out_clusters() are gathered by
  outside_trains(). vehicle_facts::none is nowhere, the none of lay_out_clusters() no_cluster.
- The test lambdas capture explicitly and the runner of the test takes its job as auto.

Results unchanged: the clusters still work out the same sub-steps and take the trains in the same order.
build-perf-test-mode-step-2
2026-12-02 01:39:48 +01:00
jerrrrycho f058df2c64 perf(physics): the array of the vehicle facts kept by the vehicle table
The facts of the previous commit were a vector at namespace scope of vehicletable.cpp, shared by every
vehicle_table. They're now a member (m_facts, with vehicle_facts a private type of vehicle_table) next to
the rest of the working space of update_steps_parallel(), as the trains of the hose exchange are.
2026-12-01 17:32:42 +01:00
jerrrrycho d1fdc9f430 perf(physics): the loops over all the vehicles read their facts from an array filled on the worker threads
With a thousand vehicles the serial loops of vehicle_table::update() and
update_steps_parallel() which only look at each vehicle (the work of the
steps, the groups of the vehicles by their neighbours, the vehicles
exchanging their load) waited on the memory of every vehicle each step.
The place of each vehicle in the table, whether its physics is on, whether
it exchanges its load and the places of its neighbours (or that one of
them can't be seen) are now taken on the threads of worker_pool right
after the neighbours are found, into a short array the loops read. Nothing
changes them in between, so the loops decide as before.

Tomaszewo 600 s, seed 12345, LTO, interleaved runs (on top of a dropped
attempt that kept the positions of standing axles, worth about 1%):
110.3 / 109.2 s vs 113.2 / 113.1 s without this change (about -3%).
Physics logs (14 and 9 files) and the event logs byte-identical to the
runs before. Unit tests 1208/1208.
2026-12-01 17:32:09 +01:00
jerrrrycho 431ad773d1 perf(physics): the hose exchange after the update a cluster of trains at a time on the worker threads
The exchange of update_brake_pipes() goes through the trains of the hoses
on the threads of worker_pool. Trains which send air into the same vehicle
that didn't step its pipe (a sleeping wagon ends both of them) go together
in a cluster, in their order; the clusters share no vehicle. Each cluster
works out the sub-steps of all its trains first and then exchanges them in
order, as the serial loop does for all the trains. The clusters are kept
in the hose trains cache with the trains.

A unit test puts a sleeping wagon between two locomotives and runs the
clusters backwards: pressures bitwise the same as one after another.

Tomaszewo 600 s, seed 12345, LTO, interleaved with the commit before:
112.7 / 112.4 s vs 116.8 / 114.6 s (about -3%). Physics logs (14 and 9
files) and the event logs byte-identical. Unit tests 1208/1208.
2026-12-01 17:32:08 +01:00
jerrrrycho 30c3a87e19 perf(physics): the neighbours of the vehicles found on the worker threads
The constants of the physics (ComputeConstans()) and the scan for the
neighbours of each vehicle (update_neighbours()) go through the vehicles
in parts of 16 on the threads of worker_pool. A vehicle writes only its
own data there and reads where the others are, which nothing moves in
that phase, so the results are those of the serial loop. The wires
(update_traction()) stay in the main thread before it.

Tomaszewo 600 s, seed 12345, LTO: sim 132.7 / 130.9 s before,
116.5 / 120.6 s after (about -10%). L107: 14.1 s before, 14.8 / 15.2 s
after (within the spread; one run before was disturbed, 58.5 s).
Physics logs (14 and 9 files) and the event logs byte-identical to the
runs before. Unit tests 1207/1207.
2026-12-01 17:31:20 +01:00
jerrrrycho a1a988d753 test: the trains of the hose exchange kept from one step to the next against ones worked out in every step
One train, a locomotive with five freight wagons on a gradient, stepped twice from the same seed: as the game
steps it, the trains of the hoses kept in the cache, and with them worked out again in every step
(test::consist::keep_hose_trains(false)). Charged, braked, the last two wagons uncoupled, released: with
Global.physics_sleepheld the wagons held by their brakes fall asleep and wake on the way, so the trains change
with the uncoupling and with the vehicles going to sleep and waking. The pipes, the reservoirs of the hoses and
the brake cylinders of the two are bitwise the same after every step. A cache which is never laid out again
after its first step fails it (10203 differences).
build-perf-test-mode-hot-paths
2026-12-01 17:28:55 +01:00
jerrrrycho ecf524063e refactor: std::array for the buffers of the physics log line and the seed of the lazy engine, ownP in the if
Sonar's remarks on the new code of this branch: the C arrays of append_fixed(), append_int() and
lazy_random_engine are std::arrays (S5945), the pressure of the ESt3 relays read once is declared in the
if that uses it (S6004), and the thread_local pointer to the lazy engine has the NOSONAR of the one above
it. The snprintf of the infinities and NaNs of the physics log stays, with a NOSONAR: std::format writes
them otherwise than printf's inf and nan(ind). No change of what the code does.
2026-12-01 16:59:35 +01:00
jerrrrycho 2883887f5c perf(physics): the trains of the hose exchange kept by the vehicle table, the inputs of a step read into kept storage
The cache of the trains was a function-local static of vehicle_table::update_brake_pipes(), shared by every
vehicle_table and kept from one scenery to the next; it's now a member next to m_brakepipes, the list it is
for. The inputs of each step were read into a new vector, twice per step (the brake and the main reservoir
pipe); they're now read into scratch storage of the cache, swapped with the kept inputs when they differ.
2026-12-01 16:58:29 +01:00
jerrrrycho 5b77fed81f perf: the settings static back with MSVC's thread-safe initialisation check
Takes back 3be7f5e82. /Zc:threadSafeInit- on utilities/Globals.cpp drops the guard from every function-local
static compiled in that file, those of the inline and template functions of stdafx.h and the project's headers
included, and the linker may keep that file's copy of such a function for the whole program. The 1.4% it gave
in one run is inside the run-to-run noise, so a static put in a header later and used from two threads isn't
worth the risk. Globals.cpp is built with the precompiled header again.
2026-12-01 16:57:52 +01:00
jerrrrycho 4a7eab6e13 test: the copy of the thread's engine marked as the simulation's randomness for Sonar (S2245) 2026-12-01 16:57:52 +01:00
jerrrrycho 3be7f5e828 perf: the settings static without MSVC's thread-safe initialisation check
Global (GetGlobalSettings()) is a function-local static, read everywhere all the time: 1.3% of the main
thread was the function itself, MSVC's check of the thread-safe initialisation reading the thread's
epoch from the TLS on every call. utilities/Globals.cpp is now built with /Zc:threadSafeInit- (and
without the precompiled header, which is built with the default): the static is made once, by the main
thread at the start, before any other thread runs, and is only read afterwards, so the plain check of
the static is enough. It's the only function-local static of the file. MSVC only.

600 s in --test, seed 12345, one run each: Tomaszewo sim 115.7 s against 117.3 s the step before
(-1.4%); L107 14.9 s against 16.1 s (-7%). The physics logs (14 and 9) and the event logs are
byte-identical to staging's, unit tests 1207/1207 with exact golden traces.
2026-11-30 11:32:38 +01:00
jerrrrycho 3502ab6045 perf(ai): the physics log line is written with std::to_chars
TController::physicslog_line() put the 26 columns of a line of physicslog/<vehicle>.dat through an
std::ostringstream with std::fixed and std::setprecision(4): a stream, its locale facets and a
printf("%.4f") (with its wctomb, fegetround and the like) for every number, ~4.4% of the main thread
with the physics logs of all trains on (physicslog.trains), the most of it in std::num_put.

The numbers now go through std::to_chars(fixed, 4) into the string, the integers through
std::to_chars, with the same separators. printf's "%.4f" in the C locale (no locale is set anywhere)
and std::to_chars both give the decimal correctly rounded to the nearest, so the text is the same:
checked on 17 million doubles against snprintf("%.4f") with the same compiler and CRT, ties of the
fifth decimal (multiples of 1/32 ... 1/1024, 0.00005) and values next to them included, with no
difference. Infinities, NaNs (printf's inf, nan(ind)) and numbers too long for the buffer still go
through snprintf("%.4f"). The floats among the values (wheel diameter, the diesel's temperatures)
are written as doubles, as the stream promoted them.

600 s in --test, seed 12345, one run each, both with the physics logs of all trains: Tomaszewo sim
117.3 s against 129.5 s the step before (-9.4%); L107 16.1 s against 17.9 s (-10%). The physics logs
(14 and 9) and the event logs are byte-identical to staging's, unit tests 1207/1207 with exact golden
traces.
2026-11-30 11:20:21 +01:00
jerrrrycho 0aee37599a 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.
2026-11-30 11:07:35 +01:00
jerrrrycho c529f9510f perf(logs): log.txt is flushed once for the lines of a pass of the log service
LogService() flushed log.txt after every line it wrote, a WriteFile for each "EVENT LAUNCHED". It now
writes the lines a pass of the service takes off the queue (every 50 ms) and flushes them once at the
end of the pass, so a line is in the file at most a pass after it was logged; the last pass after the
stop flushes too. A crash report takes the last lines from crashdump_note_log() as before, and
errors.txt is still flushed after every line. The content of log.txt is the same.

The service runs in a thread of its own, so the flushes never cost the simulation's thread: the
flush/NtWriteFile on the main thread in the profile is the black box's (blackbox_recorder::update()
flushing its file after every look around), which this doesn't change. 600 s in --test, seed 12345, one
run each: Tomaszewo sim 133.0 s against 131.1 s the step before, L107 18.9 s against 18.5 s: within the
run-to-run spread. The physics logs (14 and 9) and the event logs are byte-identical to staging's,
log.txt has the same lines (only times, versions and memory figures differ), unit tests 1207/1207 with
exact golden traces.
2026-11-30 10:40:07 +01:00
jerrrrycho 10429bd353 perf(test): the counts and times of the vehicles for the debug panel aren't taken in the test mode
vehicle_table::update() went through all the vehicles twice in every step only to count them for the
debug panel (kinds, standing, awake, ai, active), and timed every vehicle in the step loops with
steady_clock::now() (lap()), all of it shown only by the debug panel, which the test mode never draws
(~2% of the main thread in steady_clock::now / QueryPerformanceCounter). In the test mode the first
loop now runs only for the coarse steps of road vehicles (physics.roadlod), the second one not at all,
and lap() doesn't time. Outside the test mode nothing changes.

600 s in --test, seed 12345, one run each: Tomaszewo (raj40821) sim 131.1 s against 134.9 s the step
before (-2.8%); L107 (linia_107_objazdy) sim 18.5 s against 18.1 s (within the spread). The physics logs
(14 and 9) and the event logs are byte-identical to staging's, unit tests 1207/1207 with exact golden
traces.
2026-11-30 10:26:37 +01:00
jerrrrycho 89de7380ee perf(physics): the trains of the hose exchange are kept from one step to the next
exchange_through_hoses() worked out on every call which vehicles the brake and the main reservoir hoses
join into trains (hose_trains(): the list sorted by address, a search through the couplers), and laid
them out train by train: ~2.7% of the main thread on Tomaszewo, for trains which change only with a
coupling, a vehicle going to sleep or waking up, or one added or taken away.

vehicle_table::update_brake_pipes(), which passes all the vehicles of the scenery in every step, now
keeps them in a physics::hose_trains_cache (physics/components/hosetrains.h) together with what they
were worked out from: of each vehicle of the list, whether it stepped the pipe and the neighbour the
hose of each end joins it to. On every step that is gathered again (one pass over the list) and
compared: the trains are worked out again unless it's all the same, so they're always the ones
hose_trains() gives. The groups stepped in parallel (update_steps_parallel()) and
physics::Vehicle::UpdatePipeCouplers() work them out on each call as before. hose_substeps() goes by
the pressures, which change in every step, and is left as it is.

The unit tests' consist steps its brake pipes the way update_brake_pipes() does now, with the trains
kept, so the golden traces (recorded on staging) check the kept trains, the uncouplings of the tests
included.

600 s in --test, seed 12345, one run each: Tomaszewo (raj40821) sim 134.9 s against 137.4 s the step
before (-1.8%); L107 (linia_107_objazdy) sim 18.1 s against 18.8 s. The physics logs (14 and 9) and the
event logs are byte-identical to staging's, unit tests 1207/1207 with exact golden traces.
2026-11-30 09:01:34 +01:00
jerrrrycho dde512da23 perf(test): no imgui frames in the test mode
The window of the test mode is hidden and the renderer is the null one, nobody sees the ui. Still every
frame began an imgui frame, whose ImGui_ImplGlfw_NewFrame() polled the window, the mouse
(WindowFromPoint) and the gamepads, and the null renderer ended it: ~2.2% of the main thread, with
NtUserWindowFromPoint another ~0.5%. In the test mode eu07_application::begin_ui_frame() and
render_ui() now do nothing; outside of it nothing changes. ui_layer::shutdown() ends the last frame
only if one was begun, as none is in the test mode (it crashed in imgui's error recovery at the exit).

600 s in --test, seed 12345, one run each: Tomaszewo (raj40821) sim 137.4 s against 151.5 s the step
before (-9%); L107 (linia_107_objazdy) sim 18.8 s against 20.5 s. The physics logs (14 and 9) and the
event logs are byte-identical to staging's, unit tests 1207/1207 with exact golden traces.
2026-11-30 08:43:31 +01:00
jerrrrycho aa9fc1b6f3 perf(physics): the engine of a group of vehicles stepped in parallel is seeded at its first draw
vehicle_table::update_steps_parallel() gives each group of vehicles an engine of Random() of its own,
seeded from the run's engine and the group, so the draws are the same whichever thread takes the
group. It built a std::mt19937 from a std::seed_seq for every group in every step: seed_seq::generate
filling the 624 words of the state was 2.4% of the main thread and most of what the worker threads did
(5263 of their non-waiting samples) on Tomaszewo, where most groups (parked wagons, cars) draw nothing.

The group now gets a lazy_random_engine (utilities/lazyrandom.h) holding the two numbers, which
Random() seeds the same way (std::seed_seq of the two) at the group's first draw. A group that draws
gets the same numbers as before, one that doesn't skips the seeding. Ported from a local branch of
2026-11-28 (perf/parallel-group-random-engine-lazy-seed, on the layout before #531), with its tests:
the lazy engine draws as one seeded up front from the same numbers, is seeded at the first draw only,
and stands ahead of the thread's engine while it's set.

600 s in --test, seed 12345, one run each: Tomaszewo (raj40821) sim 151.5 s against 206.7 s the step
before (-27%); L107 (linia_107_objazdy, binary terrain, gfxrenderer null) sim 20.5 s against 31.1 s.
The physics logs (14 and 9) and the event logs are byte-identical to staging's, unit tests 1207/1207
with exact golden traces.
2026-11-30 08:15:16 +01:00
jerrrrycho 0c4aa1fe30 perf(physics): the hose exchange goes through the vehicles of each train only
exchange_through_hoses() takes the air exchange through the brake and the main reservoir hoses train
by train, each in its own number of sub-steps (up to 10). For every sub-step of every train it went
through the whole list of vehicles, all of the scenery's in update_brake_pipes(), and looked into each
one's pipe to tell whether it belongs to that train: trains x sub-steps x vehicles reads of vehicles
scattered in memory, twice a step (both pipes). In Tomaszewo, with 129 trainsets, this alone was 38.6%
of the main thread.

The vehicles of each train are now put in a list once per call (a counting sort of the train numbers
hose_trains() gives, keeping the order of the list within a train), and a sub-step goes through its
train's list. The membership is the one the loop tested (a vehicle is in a train when its pipe stepped,
which nothing changes during the exchange), the trains, the sub-steps and the vehicles within a train
come in the same order, so every Flow()/Act() happens in the same order with the same values.

Tomaszewo (raj40821) 600 s in --test, seed 12345: sim 206.7 s against 275.3 s the step before (one
run each, same session, -25%); wall 365.8 s against 447.5 s (the load, ~150-165 s, is unchanged). In an
earlier series 3 runs gave 187.3 s median (183.0-195.6) against 265.6 s. The 14 physics logs and the
event log are byte-identical, unit tests 1205/1205 with exact golden traces.
2026-11-30 06:50:29 +01:00
jerrrrycho e8b47b7b1c perf(physics): the ESt3 valve and its relays read a pressure once where it can't change between reads
TNESt3::GetPF() and the relays it steps (TPrzekladnik, TRapid, TPrzekCiagly, TPrzekED ::Update) read
the same pressures several times through virtual P() calls: TRura::P() passes the call on down the
chain of relays to the cylinder. A reservoir's pressure (Vol / Cap) changes only in Act() and
CreatePress(); Flow() only adds to the pending change. So between two reads with only Flow() calls in
between the value is the same, and it's read once now:
- GetPF(): the cylinder pressure after the two Flow() calls of the release/apply is BCP, read at the
  start (CheckState() can recreate the pressure of ValveRes only, which isn't in the relay chain);
  CVs(BCP) was worked out twice with nothing but Flow() calls between, now once.
- the relays: their own P() read once instead of up to four times, TPrzekED's Next->P() once.
The arithmetic and its order are unchanged.

Tomaszewo (raj40821) 600 s in --test, seed 12345: GetPF was 2.9% of the main thread (inclusive) before
the series; sim 275.3 s in one run against 259.7 s (median of 3, 255.0-271.3) the step before: no gain
beyond the run-to-run spread (about +-5%) shows in the run time. The 14 physics logs and the event log are
byte-identical, unit tests 1205/1205 with exact golden traces.
2026-11-30 06:50:29 +01:00
jerrrrycho 18d1c58994 perf(world): FastGetTFromS reads the curve's t and slope of a point side by side
TSegment kept the curve parameter t at equal steps of s (fTsBuffer) and the Hermite slopes at the same
points (fTsSlope) in two vectors, and FastGetTFromS(), called for every axle of every vehicle on every
step, read [i] and [i + 1] of both: four loads from two separate allocations. The two now go together in
one vector of {t, slope} (fTs), so the interpolation touches one or two cache lines. The values and the
arithmetic, in the same order, are unchanged.

Tomaszewo (raj40821) 600 s in --test, seed 12345: FastGetTFromS was 1.2% of the main thread; sim 259.7 s
median of 3 (255.0-271.3) against 268.3 s (262.5-279.2) before, which is about the run-to-run spread.
The 14 physics logs and the event log are byte-identical, unit tests 1205/1205 with exact golden traces.
2026-11-30 04:20:18 +01:00
jerrrrycho 1996301a7b perf(physics): the MED log is tried once per vehicle when it can't be opened
A vehicle blending ED and EP brakes (ConsistBrakeBlending) opens MEDLOGS/<name>_<n>.csv once it brakes
while moving. Without the MEDLOGS folder, which the game doesn't come with, the open failed and was tried
again on every step of the braking: a path built and a CreateFile call each time, with <n> counted up.
The failure is now remembered and the log isn't tried again for that vehicle. With the folder there the
first attempt opens it, and what is written is the same as before.

Tomaszewo (raj40821) 600 s in --test, seed 12345: OpenLog was 0.18% of the main thread there (few ED
consists brake in it), the run time is within noise (sim 268.3 s median of 3 before, 269.8 s after);
the 14 physics logs and the event log are byte-identical, unit tests 1205/1205 with exact golden traces.
2026-11-30 03:35:29 +01:00
maj00r 6a716b6720 Merge pull request #533 from MaSzyna-EU07/fix/wiperlist-bytesum-parse
Read the WiperList wiper mask as a number, not a character
2026-11-30 00:41:27 +01:00
jerrrrycho b0f7500004 comment: the wiper mask is read into an int, not the uint8_t build-fix-wiperlist-bytesum-parse 2026-11-30 00:12:58 +01:00
Hirek cabd53a01c Merge pull request #382 from pwarszawski/fix/gl46-text-displays
fix(gl46): station name boards show their text
2026-11-29 17:40:25 +00:00
Hirek fe45bb5811 Merge pull request #374 from pwarszawski/fix/glare-occlusion
fix(gl46): no more glares of light points through walls
2026-11-29 17:39:59 +00:00
Hirek d21ae35899 Merge pull request #373 from pwarszawski/fix/gl46-scenery-zero-normals
fix(gl46): scenery shapes and rail ends rendered black
2026-11-29 17:37:28 +00:00
Hirek 3a9b3e5681 Merge pull request #372 from pwarszawski/fix/cluster-cull-lamp-radius
fix(gl46): the radius of a lamp isn't a part of its brightness in the cluster culling
2026-11-29 17:37:11 +00:00
Hirek a2315990ca Merge pull request #550 from miloszunio/feat/debug-perflog
feat(debug): debug.perflog writes the times of the renderer to perf.txt while the game runs
2026-11-29 17:36:21 +00:00
Hirek f964f75ece Merge pull request #544 from MaSzyna-EU07/fix/staging-case-regressions
Fix two scenario cases broken on staging: the uuid of scene nodes, the AI stop on a gradient, an off-track coupling
2026-11-29 17:35:36 +00:00
Hirek b8f31859e9 Merge pull request #546 from MaSzyna-EU07/feat/derailment-trust-limits
physics.derailment new: trust the speed limit of the track (physics.derailment.trustlimits)
2026-11-29 17:35:05 +00:00
Hirek 4d1219e225 Merge pull request #554 from MaSzyna-EU07/cleanup/mover
Create vehicle-architecture.md
2026-11-29 17:33:37 +00:00
Hirek 5d5e271edb Create vehicle-architecture.md 2026-11-29 18:32:22 +01:00
jerrrrycho ba6ad19c08 Merge staging into fix/wiperlist-bytesum-parse 2026-11-29 18:04:01 +01:00
jerrrrycho a8bd72cc7f Merge staging into fix/staging-case-regressions build-fix-staging-case-regressions 2026-11-29 18:04:00 +01:00
jerrrrycho c0e1f1c8fe Merge staging into feat/derailment-trust-limits build-feat-derailment-trust-limits 2026-11-29 18:04:00 +01:00
jerrrrycho 5182e4eb43 Merge pull request #548 from MaSzyna-EU07/test/baltyk-skm1-cases-new-units
test(scenarios): baltyk_skm1 cases follow the new units of their missions
2026-11-29 17:12:04 +01:00
Hirek 48f2162b3b Merge pull request #552 from MaSzyna-EU07/cleanup/mover
(refactor/mover) stage 2: the vehicle keeps its state to itself
2026-11-29 16:03:53 +00:00
Hirek 969864f204 Merge staging into cleanup/mover
The windscreen weather (#367) and the compiler cache of the CI (#434). The
wipers' code of both renderers takes staging's side, reading the active cab and
the speed through TDynamicObject (ActiveCab(), Speed()) as the renderer does on
this branch; the windscreen water reads the speed the same way, and the deer
(world/deer.cpp) read the vehicle through its queries (V(), WarningSignal(),
CabOccupied()).

The golden traces recorded on dfb43c4f still match bit for bit: staging didn't
touch the physics.
build-cleanup-mover
2026-11-29 16:55:25 +01:00
Hirek c7c170a3cb Merge pull request #434 from MaSzyna-EU07/build/ci-compiler-cache-master
ci: shorter CI runs on pull requests
2026-11-29 15:38:41 +00:00
jerrrrycho de6e886048 test: the trusted-limit cases check the derailment as VehicleDamage, as staging does since #531 2026-11-29 15:24:16 +01:00
jerrrrycho 66908502b3 test: the off-track coupler case names the ends as VehicleEnd, as staging does since #531 2026-11-29 15:07:19 +01:00
jerrrrycho 1e825cb596 Merge staging into feat/derailment-trust-limits
# Conflicts:
#	McZapkie/Mover.cpp
2026-11-29 14:56:21 +01:00
jerrrrycho 501123c3b8 Merge staging into fix/staging-case-regressions
# Conflicts:
#	McZapkie/Mover.cpp
#	physics/vehicle.h
#	vehicle/Driver.cpp
#	vehicle/DynObj.cpp
2026-11-29 14:54:08 +01:00
Hirek d631837796 Merge pull request #367 from lcddisplay/feat/windscreen-weather-gl46
Windscreen weather (rain, bugs, snow), moths, deer and VAT animation for OpenGL 4.6 / Vulkan 1.4
2026-11-29 12:50:39 +00:00
Hirek f6c573340a docs(agents): the state of a vehicle changes outside the physics only through its operations
AGENTS.md says that outside physics/ the state of a physics::Vehicle changes
only through its operations, its definition aside as the vehicle loads; that a
field the rest only reads is private with a query named as the field was, one
nothing outside uses private outright, and a new one private from the start;
and that the cab and the events read the AI through its queries, the debug and
timetable panels alone being its friends.
2026-11-29 13:39:08 +01:00
Hirek 23b695752a refactor(physics): the demand of the integrated controller is private to the vehicle
eimic_real, the demand of the integrated controller the vehicle goes by with
the speed control counted, which TDynamicObject and the consist braking set
for the vehicle that leads, is private: EimicReal() and SetEimicReal(). The
field of the same name of drivingaid::input stays as it is.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 13:39:07 +01:00
Hirek f0978c36c7 refactor(physics): what nothing outside the vehicle uses is private to it
71 public fields of physics::Vehicle that no code outside the class reads or
writes (the definitions of the circuits and the tables only the vehicle's own
step goes through, the forces and the timers of its step, the programmable
controller, ...) move into its private part as they are, with the comments
above them. The fields of the old doors inside EU07_USEOLDDOORCODE stay where
they are.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 13:32:05 +01:00
Hirek ef8a1fdbfd refactor(physics): six more of what the rest only reads are private, under names of their own
The mass of the empty vehicle, the braking force, the outcome of a derailment,
the departure signal, the traction mode of a dual-mode vehicle and the moment
of the motors are private to physics::Vehicle like the 53 before them, read
through Mass(), Fb(), Derailed(), DepartureSignal(), TractionMode() and Mm().
Inside the class they are emptyMass, brakingForce, derailOutcome,
departureSignalOn, tractionModeSetting and motorMoment, as the plain camelCase
names were taken by locals there.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 13:23:53 +01:00
Hirek 5879c228dc refactor(physics): what the rest of the simulator only reads of a vehicle is private to it
53 fields of physics::Vehicle that only the vehicle itself writes, and the rest
of the simulator reads, are private, with a query each, named as the field was
(Vmax(), TotalMass(), Ft(), nrot(), NAxles(), PhysicActivation(), ...): the
compiler now keeps the cab, the AI, the scenery, the renderer and the tests from
changing what the definition gives or the physics works out. The fields were
picked by what is never written outside the class, of plain types, with no
other member of the same name to confuse; inside the class they keep their
meaning under camelCase names. The one place outside that cleared a flag of
the AI through a reference does it through ClearAIFlag().

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 13:17:56 +01:00