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

2 Commits

Author SHA1 Message Date
maj00r cbbb0b23fb fix(world): the tape of the logic cache is bytes from the start, read an entry at a time
The parser tape kept a structure of about 70 bytes per token, so a scenery of 12 million tokens (Glinojeck)
took 1.8 GB at its peak while recorded and 1.5 GB while replayed, against 0.5 GB read from its files. The tape
is now written as it's recorded (parser_tape::writer, about 10 bytes a token) and decoded as it's replayed
(parser_tape::reader, tokens as views of the bytes); the names of the files are entries of the tape, and an
end mark tells a tape cut short. Glinojeck now peaks at 712 MB recorded and 601 MB replayed.

Checked in the game, on a test folder made of junctions to the data with a scenery folder of its own (nothing
was written into the SVN working copy): td.scn (23 481 entries, 29 files, a cache of 28 KB) and Glinojeck.scn
(11.9 million entries, 63 files, a cache of 8.5 MB), each run in --test for 120 s of simulation with seed 1
from the files with world.binary 0, then recorded and replayed with world.binary 1: the physics logs of every
train are the same bit for bit in all runs, and so are the error logs.
2026-12-02 23:03:28 +01:00
maj00r 30f3d70da9 feat(world): the logic cache of a scenery, recorded on the first load and replayed while current (world.binary)
Step 2d of docs/world-format-eu07.md (#516). With world.binary 1 in eu07.ini (off by default; then nothing is
written and nothing changes) the loader looks for <scenery>.logic.eu07 in the folder of the sceneries:

- current: made by this build (GIT_HASH and SRC_DATE), from the files the tape names as they are now (names,
  sizes, times of the last change) and with the same load settings (traction loaded, the binary terrain file
  standing in for the terrain includes, the text put ahead of the scenery, the trainset overrides): the
  scenery is replayed from the tape through the same parsers, with no file opened and no include expanded;
- not there or not current: the scenery is read from its files as before, the parser records its tape, and
  the cache is written once the scenery is loaded, through a temporary file. The log says which of the two.

Never in the editor, which keeps track of the files of the nodes, nor for a Rainsted override ($.scn).

The cache file gains package blocks, data of the whole package rather than of a tile; the tape goes into them
in parts of at most 64 MB until the logic is split into regions (step 3). The SBT check moved ahead of the
parser, unchanged, as the cache depends on it.

Not checked yet in the game: that a run from the replayed scenery gives the same physicslog bit for bit.
Tests: the cache file name, FNV-1a, package blocks written and read back, and the logic cache read back while
current and refused for another build, other settings or a changed included file.
2026-12-02 22:20:40 +01:00