17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 00:29:19 +02:00

51 Commits

Author SHA1 Message Date
jerrrrycho
b400255dae Test/physics unit tests (#213)
* build: doctest 2.4.11 in ref/

Single header test framework (MIT), vendored like the other libraries in
ref/ so the tests need nothing extra installed on the CI runners.

* refactor(physics): read vehicle definitions from text as well as files

TMoverParameters::LoadFIZ(path) opens the file and hands the parser over
to LoadFIZ_Parse(), which holds what LoadFIZ() did with it before. The
new LoadFIZ_Text() reads the same format from a string, so a definition
can be made up in memory, e.g. by a unit test. No change in behaviour for
files.

* build: the simulation core as a library the game links

The vehicle physics (McZapkie), the vehicle definition parser and the
helpers they use build as eu07_core, a static library the game links,
so the unit tests to come can link the very same objects instead of
compiling their own copy with their own settings.

The game's build settings (include dirs, definitions, compile options,
libraries) move from the executable to eu07_settings, an interface
target the library links publicly, so the game, the library and later
the tests all build with the same ones. What only the executable needs
stays with it: /MAP, /LARGEADDRESSAWARE, output dirs, the precompiled
header, runtime DLL copying, the crash reporter and the experimental
renderer. No change in what the game builds or links.

* test: unit tests of the simulation core, run as part of the build

eu07_unit_tests: C++ tests (doctest) of the simulation, which set up the
conditions, run the code and check the outcome. No game data, no window.

- the code under test is the core library (eu07_core), the very objects
  the game links, built with the game's settings; engine_stubs.cpp stands
  in for the logs, settings and scenery layers the library reaches for.
  python gets linked with the settings but isn't needed to run the tests
- test vehicles are JSON definitions in tests/unit/data, with the sections
  and keys of the game's vehicle definitions (tables as "rows", _keys are
  comments), changed by the tests where needed and loaded from memory by
  the game's own loader; an unknown section is an error rather than
  silently skipped
- test::vehicle creates the mover the way TDynamicObject::Init() does and
  steps it the way the simulation loop does, on a straight track of given
  friction and gradient, optionally holding the brake pipe pressure the
  way a coupled locomotive would
- the random numbers of the simulation are reseeded before every test
  case, so a test gives the same result alone (IDE) or among the others
- building the game runs the tests at the end, once the game is linked,
  and prints a one line summary ("Unit tests: 11/11 passed (80 checks)").
  A failure prints the full report and fails the build, in CI and locally
  alike, and removes the game binary so the next build reruns them. A
  change of the tests alone relinks the game so they run (Ninja and
  Makefile generators). -DWITH_TESTS=OFF leaves them out
- first tests: definitions reach the vehicle, KE service application and
  release, deeper reduction brakes harder, every implemented distributor
  valve charges/applies/releases, service braking stops a moving wagon

* test: stub basic_node::radius_() for GCC and Clang

The Linux build failed to link the unit tests: undefined reference to
scene::basic_node::radius_() from basic_node's vtable in engine_stubs.o.
basic_node has no key function for the Itanium C++ ABI (tooltip() is
declared plain but defined inline in the header), so GCC and Clang emit
its vtable in every unit using scenenode.h, and the vtable needs
radius_(), defined in scenenode.cpp, which the tests don't link. MSVC
emits vtables differently, so the Windows build linked.

* test: test vehicle definitions load with GCC and Clang

All the tests reading a definition failed on Linux with "unknown vehicle
definition section 0": the parsed definition was brace-initialised
(auto const json{parse(...)}), which GCC and Clang take for the
initializer list constructor of nlohmann::json, making an array holding
the definition, while MSVC copies it. Initialise it with =, and require
the definition to be a JSON object.


* test: SonarCloud issues of the unit tests

- test::definition_error for unusable test vehicle definitions instead of
  std::runtime_error (S112)
- the rows of a table section written by a function of their own, less
  nesting in definition::text() (S134)
- std::less<> for the section table (S6045)
- comments in the empty methods of the reseeding listener and stub (S1186)
- NOSONAR where the engine's headers fix the stubs: the extern globals
  and the member function signatures (S5421, S5817, S1238)
- NOSONAR on LoadFIZ_Parse(): the cognitive complexity is the former body
  of LoadFIZ(), moved as it was (S3776)
- a comment Sonar took for code reworded (S125)
2026-10-15 17:56:41 +02:00
35bda3778c Heightmap terrain: .tch chunk packs, streaming with LOD, terrain painting, water and modifiers - terrain/<name>/terrain.yaml + <px>_<pz>.tch packs of 16x16 chunks (250 m, 0.5/1/2/5 m spacing), slices with crc-32 and optional zstd (vendored zstd 1.5.6 in ref/zstd) - heightmap_terrain [name] endheightmap_terrain directive replaces editorterrain - streamer: worker threads, camera + look-ahead loading, geomipmap LOD with skirts, pooled geometry - mat_terrain shader: up to 8 painted layer materials per chunk via texture arrays (opengl33); other renderers fall back to the dominant material - water bodies (outline + level), terrain modifiers (vertical profile shaping kept non-destructive) - F11 Terrain work mode rebuilt: chunks, sculpt, smooth, paint, point spacing, water tools 2026-10-09 21:02:25 +02:00
d9eb705d4a Revert "Update GLM ref"
This reverts commit 38db27d3de.
2026-07-25 12:59:54 +02:00
38db27d3de Update GLM ref 2026-07-24 13:05:18 +02:00
maj00r
cb02dc6480 openal: update vendored AL headers to a modern OpenAL Soft
Refresh ref/openal with current OpenAL Soft headers: adds alext.h (ALC_SOFT
extensions incl. reopen_device / system_events, ALC_CONNECTED, the EFX
presets) and efx*.h, and updates al.h/alc.h. Enables the audio device-change
following to build against native tokens instead of local fallbacks.
2026-07-04 15:22:33 +02:00
maj00r
3786ecd98f Python 3.14 build and CI updates
Squashes the last five commits: migrate to Python 3.14 (CMake, AppVeyor, Azure, README), vcpkg/setup-ci fixes, CMake adjustments, remove bundled ref/python 2.7, and related scripting/static file updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 18:21:12 +02:00
docentYT
c39decc733 Update vcpkg version 2026-02-02 17:22:19 +01:00
f43d4b5201 Add trivia randomisation 2025-09-16 00:25:00 +02:00
3810fff0dc Revert "Add TGUI library"
This reverts commit c6564351e8.
2025-09-09 16:46:12 +02:00
c6564351e8 Add TGUI library 2025-09-08 18:32:38 +02:00
37d28a4603 Change discord-rpc fork 2025-09-05 20:39:10 +02:00
12d6a1578d Add vcpkg as submodule and ref it in cmake 2025-04-15 00:23:36 +02:00
27f4920869 Add discord-rpc library 2025-03-16 16:22:54 +01:00
34b3a00687 Add missing asio ref 2025-03-09 21:28:22 +01:00
548f4263d0 Add glfw as ref 2025-03-09 21:09:52 +01:00
dd3b258967 Remove old glfw ref 2025-03-09 21:08:27 +01:00
WLs50
a5f6397eca merge manul 2025-03-09 15:36:11 +01:00
milek7
659345c1fa legacy wireframe fix 2021-02-16 23:12:25 +01:00
antonisauren
d1ecbdc8ff Sim (#11)
* Wheels animation distance changed to 200*D*LODbias

* Fixed spelling error in event syntax; old one remains for compatibility.

* Spelling error left in log text

* Zamiana metalic na floata z wazonym efektem.

# Conflicts:
#	shaders/light_common.glsl

* Detail normalmap shaders @Jan21

* Explicit type conversion

* Leftover metalic as bool

* Syntax error

* Normalmap sampling inside ParallaxMapping function
2021-01-23 22:24:14 +01:00
milek7
9e7c528114 make legacy gl2.0 work without BaseVertex extensions 2021-01-22 22:19:23 +01:00
milek7
7cacab0dc8 add gfx.angleplatform ini setting 2021-01-21 22:15:57 +01:00
milek7
4e868288ee add support for ETC2_EAC in .ktx files 2021-01-20 22:46:52 +01:00
milek7
5aa8dfe1a1 use DrawElementsBaseVertexOES if available 2021-01-20 19:39:05 +01:00
milek7
f0b364bafe basic GLES working again 2021-01-20 19:29:50 +01:00
milek7
1c5dcfb87e enable openvr for windows CI 2020-11-18 01:19:46 +01:00
milek7
29f8f91ad8 Merge remote-tracking branch 'tmj/master' into sim 2020-10-18 23:35:14 +02:00
milek7
09f442456f cppzmq libs 2020-03-29 22:14:47 +02:00
tmj-fstate
db49440653 Merge branch 'master' of https://github.com/tmj-fstate/maszyna 2019-12-17 19:46:55 +01:00
tmj-fstate
57b88ec64a maintenance: obsolete dependencies cleanup 2019-12-16 11:19:28 +01:00
tmj-fstate
0ac92fca62 Add files via upload 2019-12-16 11:11:35 +01:00
tmj-fstate
75503c50d1 maintenance: imgui update to v 1.73 2019-11-14 15:51:04 +01:00
tmj-fstate
ae3cecfa42 opengl 3.3 renderer integration, minor renderer tweaks 2019-10-31 19:38:11 +01:00
tmj-fstate
0fd23a53d9 milek7/sim branch opengl 3.3 renderer import 2019-10-26 15:17:09 +02:00
milek7
23d0093df0 Merge branch 'gfx-work' into sim 2019-09-07 02:53:57 +02:00
milek7
ee1c0ae8d4 Merge branch 'milek-dev' into gfx-work 2019-09-07 02:40:38 +02:00
milek7
6190060b1a Merge branch 'tmj-dev' into milek-dev 2019-09-07 02:25:43 +02:00
tmj-fstate
269e271f01 maintenance: glew update to v 2.1.0, glfw update to v3.3 2019-08-20 12:48:24 +02:00
tmj-fstate
2002587d01 mantenance: stb_vorbis update to v1.16 2019-04-09 00:54:05 +02:00
milek7
4383b0c7e0 geometry shaders, map poi icons 2019-03-17 20:30:25 +01:00
milek7
1bb700c1ec Merge branch 'milek-dev' into gfx-work 2019-02-26 22:07:04 +01:00
milek7
87acb6bc15 remove glut 2019-02-19 01:27:57 +01:00
milek7
09f1efd376 modify and cleanup python headers and libs 2019-01-19 00:06:48 +01:00
milek7
2ffdb35d0f GLES fixes, update GLM, build fixes 2018-10-17 16:00:26 +02:00
milek7
d16d96f2b2 GLES support 2018-10-16 20:32:45 +02:00
tmj-fstate
e801953c1d merge local branch 'mover_in_c++' 2018-10-12 17:45:01 +02:00
firleju
c5097876e5 cleaning build system and ref 2017-09-29 21:37:48 +02:00
firleju
49c5854d10 cmake 2017-09-26 19:46:26 +02:00
firleju
a523afe7cd Merge remote-tracking branch 'Milek7/lua' into mover_in_c++ 2017-09-25 15:33:18 +02:00
firleju
ae4223123a Clean up CMake build system
Clean up CMake build system
2017-09-25 06:34:28 +02:00
firleju
d534ac355b Delete unnecessary files, adding ref, update project 2017-09-16 21:14:15 +02:00