mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-28 20:53:22 +01:00
origin/staging7ac2472c3into feat/gl46-migrationdb26a33ed, so that #468 merges into staging. Merge base037158104. Staging carries master up to571487612(squashed in #514); this branch had merged master up to7c12b83ba. Conflicts, file by file: - README.md: WITH_BETTER_RENDERER row dropped (gl46), USE_SYSTEM_JSON row kept (staging) - CMakeLists.txt: gl46 lists, plus staging's new core sources (hardwareinfo, sn_utils, regionfile, inionlysettings, fieldshunting, gaugewrap, drivingaid, signalpassing, brakereleaser, crew, brakecharge); none listed twice - tests/unit/CMakeLists.txt: both (texturealpha, freecameramotion; editorSwitchDrives, Camera) - vehicle/brakingcurve.{h,cpp}, tests/unit/test_braking_curve.cpp (add/add): staging (#479 brake_acting on the same #409 code) - editor/editorHttp.cpp: staging (it has gl46's #432 and certificate fixes, plus #439 libcurl loaded at run time) - tests/unit/test_editor_http.cpp (add/add): staging (adds the available() case of #439) - utilities/Globals.h: gl46 crashdump_full (staging's CrashDumpFull is #425, replaced here by utilities/crashdump.cpp); fmradio and staging's OpenAL options both; gfx_headlights_beamwidth (#481) not taken - utilities/Globals.cpp: both (odometer.expiry, OpenAL keys, fmradio, gl46 gfx keys); gfx.headlights.beamwidth (#481) not taken - utilities/Logs.cpp: staging's log_file_name() for both files, with gl46's crashdump_set_log_file() for both - utilities/utilities.h: gl46 set_thread_random_engine(); Random(int, int) gone on both sides - tests/unit/test_utilities.cpp: staging's includes - simulation/simulationtest.cpp: gl46 (no NvRenderer, LegacyRenderer, BasicRenderer here) - ci_shadervalidator/* (incl. add/add utilities/Logs.h): gl46's validator of shaders/ogl46 and shaders/vk14; staging's #437 fixed the GL 3.3 one - gl/shader.cpp, gl/glsl_common.cpp: gl46 (shaders come from rendering/common/shadersource.cpp); HEADLIGHT_BEAM_WIDTH (#481) not taken - shaders/mat_wire.frag: gl46. Rename detection paired staging's mat_colored.frag (#481) with it - lang/editor_pl.po: union; the 12 camera speed / orthophoto entries staging adds are here already (master #312) - audio/audiorenderer.{h,cpp}: both (fmradio; startsample and the low-pass filter); the destructor releases the radio, then the filter - application/editormode.h, application/editormodeswitchdrive.cpp: staging (#509 on #330, which is all this side had) - application/application.cpp: gl46's start sequence (no init_ogl, ANGLE or NvRenderer; crash window after init_ui) with staging's hardware::log_system() (#389) - EU07.cpp: gl46 (crash reports of utilities/crashdump.cpp); staging's side was #425's handler, replaced here - model/Texture.{h,cpp}: gl46 (texture_source); staging's side is master #399/#411/#362/#386, merged here before - world/Track.h, world/TrackSleepers.h: both (TrackBlend, lay(Fastened)/fasten; TrackBuckle, pack_models) - world/Segment.cpp: staging's track buckling on the split stray factors both sides have - vehicle/Driver.h: staging's additions (#444, #494, #473, #346, timetable flags) - vehicle/Driver.cpp: staging's file, with this branch'sf4f8c75e4(road orders measured along the lane) and8fbf05674(a holding road order blocks the ones past it) applied again; #409's SeenAheadTolerance gives way to #473 - vehicle/DynObj.h: friend opengl46_renderer and friend class vehicle_table - vehicle/DynObj.cpp: gl46's vehicle_table::update() with staging's update_off_track_contacts() and update_brake_pipes() - McZapkie/Mover.cpp: staging's function splits (#239) and hose exchange (#388); every line this branch added to Mover.cpp/MOVER.h is kept - .github/workflows/build_bin.yml: staging's apt-install step (#497) and pinned download-artifact (#331) Modify/delete, kept deleted: - rendering/opengl33renderer.{cpp,h}, rendering/openglparticles.cpp, rendering/openglrenderer.{cpp,h}: staging's versions are master's, and every master change to them is in this branch's history already - shaders/light_common.glsl, shaders/mat_sunlessnormalmap_specgloss.frag: see below Carried into this branch's code: - the hose exchange after each sub-step (#387/#388) also in update_steps_parallel(), per group of vehicles, as update() does it single-threaded - physics.pipewake (pipe_wakes(), wake_cause::scndpipe) in staging's GetScndDVc(), where the main reservoir hose exchange went - hardware::log_gl_context() (#389) in after_window() of the GL 4.6 backend, init_ogl() being gone Taken back out of the auto-merge (renderers this branch removed): - shaders/vk14/tonemapping.glsl: #481's switch to ACES, applied there by rename detection - environment/skydome.cpp, simulation/simulationenvironment.cpp: #415, the sky of the legacy renderer - application/application.cpp: #384's fallback of an unknown gfxrenderer, which this branch had dropped Not carried from staging (renderer files removed here): - master #481 (571487612): old assets drawn as in 26.05 (metal diffuse, sun highlight tint, ACES, SUN_DIFFUSE_SCALE 2.5, untinted Diffuse, mat_colored base) and gfx.headlights.beamwidth. Made for the GL 3.3 shaders; the PBR shaders of shaders/ogl46 and vk14 (and their SPIR-V binaries) are the author's call - #437: the unique temporary file of the shader validator (Sonar S5443); gl46's validator still writes /tmp/shader* Unit tests: 1133 of 1137 cases pass. Four staging tests fail (derailment: a repaired vehicle is back on the rails; three pullee cases): the vehicle stands, and with physics.sleepheld (on by default here) its physics sleeps with the Fb / FStand of before. With physics.sleepheld off they pass. Left to the author.
242 lines
9.1 KiB
Markdown
242 lines
9.1 KiB
Markdown
|
||

|
||
|
||
# MaSzyna - Railway vehicle simulator
|
||
|
||
|
||
[Website](https://eu07.pl/) · [Report an issue](https://github.com/MaSzyna-EU07/maszyna/issues) · [Community Discord](https://discord.gg/eu07) · [MaSzyna on Steam](https://store.steampowered.com/app/1033030/MaSzyna/) · [MaSzyna on Epic Games Store](https://store.epicgames.com/pl/p/maszyna-79052a)
|
||
|
||
    [](LICENSE) [](https://github.com/MaSzyna-EU07/maszyna/commits/master) [](https://github.com/MaSzyna-EU07/maszyna/issues) [](https://github.com/MaSzyna-EU07/maszyna/pulls) [](https://github.com/MaSzyna-EU07/maszyna/stargazers) [](https://github.com/MaSzyna-EU07/maszyna/forks)    
|
||
|
||
MaSzyna executable source code is licensed under the [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/) and comes with a large pack of free assets under a [custom license](https://eu07.pl/docs/inne/readme_pliki/en-licence.html).
|
||
|
||
|
||
## Table of Contents
|
||
|
||
- [Getting Started](#getting-started)
|
||
|
||
- [Prerequisites](#prerequisites)
|
||
|
||
- [CMake flags](#cmake-flags)
|
||
|
||
- [Windows](#windows)
|
||
|
||
- [Linux](#linux)
|
||
|
||
- [Installing](#installing)
|
||
|
||
- [Known Issues](#known-issues)
|
||
|
||
- [Support](#support)
|
||
|
||
- [License](#license)
|
||
|
||
|
||
|
||
## Getting Started
|
||
|
||
MaSzyna compiles and runs natively on **Linux** and **Windows**. Other platforms are not tested.
|
||
|
||
> **Heads-up**
|
||
> Our dev team is small; we keep improving the build process, but issues may still occur. If you get stuck, please ask on the [official Discord server](https://discord.gg/qAh9ctWPQv).
|
||
|
||
### Prerequisites
|
||
|
||
> For runtime requirements see [Minimum Requirements](#minimum-requirements).
|
||
|
||
**1) Software** _(oldest tested in parentheses)_
|
||
|
||
- [CMake](https://cmake.org/) _(3.0)_
|
||
|
||
- [make](https://www.gnu.org/software/make/)
|
||
|
||
- A C++ compiler with C++20 support:
|
||
|
||
- **Windows:** Visual Studio 2022
|
||
|
||
- **Linux:** GCC _(12.3.1)_
|
||
|
||
|
||
> **Note:** MinGW is currently **not supported**.
|
||
|
||
**2) Libraries** _(oldest tested in parentheses)_
|
||
|
||
- [GLFW 3.x](https://www.glfw.org/) _(3.2.1)_
|
||
If a link error occurs, pass `-DGLFW3_LIBRARIES="<path>"` to CMake.
|
||
|
||
- [GLM](https://glm.g-truc.net/) _(0.9.9.0)_
|
||
|
||
- [libserialport](https://sigrok.org/wiki/Libserialport) _(0.1.1)_
|
||
|
||
- [libsndfile](https://github.com/erikd/libsndfile) _(1.0.28)_
|
||
|
||
- [LuaJIT](http://luajit.org/) _(2.0.5)_
|
||
|
||
- [GLEW](http://glew.sourceforge.net/) _(2.1.0)_
|
||
|
||
- [libpng](http://www.libpng.org/pub/png/libpng.html) _(1.6.34)_
|
||
|
||
- [OpenAL](https://www.openal.org/) _(1.18.2)_
|
||
|
||
- **pthread**
|
||
|
||
- [Python 3.14](https://www.python.org/) _(64-bit; headers and import library required for embedding)_
|
||
|
||
- [Asio](https://think-async.com/Asio) _(1.12)_
|
||
|
||
|
||
**3) Graphics API**
|
||
|
||
- **OpenGL 4.6** (core profile), required by the default renderer; see [docs/opengl46-renderer.md](docs/opengl46-renderer.md)
|
||
|
||
|
||
### CMake flags
|
||
|
||
| Flag | Meaning |
|
||
|------|---------|
|
||
| `-DCMAKE_BUILD_TYPE=Debug` | Debug build |
|
||
| `-DCMAKE_BUILD_TYPE=Release` | Release build |
|
||
| `-DCMAKE_BUILD_TYPE=RelWithDebInfo` | Release build with debug symbols |
|
||
| `-DUSE_SYSTEM_JSON=ON/OFF` | Use an installed **nlohmann_json** 3.9 or newer (e.g. `nlohmann-json3-dev`, vcpkg `nlohmann-json`) instead of the `ref/json` submodule (default `OFF`) |
|
||
| `-DPython3_ROOT_DIR=<path>` | Root of the **Python 3.14** install on Windows (`python.exe`, `Lib`, `DLLs`) for embed/copy steps; on Linux, optional if CMake picks the wrong interpreter |
|
||
|
||
> **macOS note:** macOS provides OpenGL only up to 4.1, so the OpenGL 4.6 renderer does not run there.
|
||
|
||
|
||
|
||
|
||
## Windows
|
||
|
||
Install **Python 3.14 x64** from [python.org](https://www.python.org/downloads/windows/) and include the optional **Python native development** feature (headers and `.lib` for embedding). Pass `-DPython3_ROOT_DIR="C:\Path\To\Python314"` on the `cmake` line when you want the layout under that directory used for embedding and for copying `Lib` / `DLLs` next to the executable. The cab screens are drawn with [Pillow](https://pypi.org/project/pillow/): install it into that Python (`python -m pip install Pillow`) before building, so it is copied along with `Lib`.
|
||
|
||
**AppVeyor CI** builds with the worker image’s preinstalled Python at `C:/Python314-x64` (see [`appveyor.yml`](./appveyor.yml): `-DPython3_ROOT_DIR=...`).
|
||
|
||
```powershell
|
||
# Clone repository with submodules
|
||
git clone --recursive https://github.com/MaSzyna-EU07/maszyna.git
|
||
|
||
cd maszyna
|
||
|
||
# Init vcpkg
|
||
call setup.bat
|
||
|
||
# Create directory for CMake build files
|
||
mkdir build
|
||
cd build
|
||
|
||
# Generate CMake project (replace %CONFIG% with Debug/Release/RelWithDebInfo)
|
||
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%CONFIG%
|
||
|
||
# Build (replace %CONFIG% accordingly)
|
||
cmake --build . --config %CONFIG% --parallel
|
||
|
||
```
|
||
|
||
|
||
|
||
## Linux
|
||
|
||
```bash
|
||
# Install dependencies (Fedora/RHEL family)
|
||
sudo dnf install -y \
|
||
@development-tools \
|
||
cmake \
|
||
mesa-libGL-devel \
|
||
glew-devel \
|
||
glfw-devel \
|
||
python3.14-devel \
|
||
libpng-devel \
|
||
openal-soft-devel \
|
||
luajit-devel \
|
||
libserialport-devel \
|
||
libsndfile-devel \
|
||
gcc \
|
||
g++ \
|
||
wayland-devel \
|
||
wayland-protocols-devel \
|
||
libxkbcommon-devel
|
||
|
||
# Clone repository with submodules
|
||
git clone --recursive https://github.com/MaSzyna-EU07/maszyna.git
|
||
|
||
cd maszyna
|
||
|
||
# Create directory for CMake build files
|
||
mkdir build
|
||
cd build
|
||
|
||
# Generate Makefiles
|
||
cmake ..
|
||
|
||
# Compile using all cores
|
||
make -j"$(nproc)"
|
||
|
||
```
|
||
|
||
> **Tip (Ubuntu/Debian)**: Package names differ; install equivalent `build-essential`, `libgl1-mesa-dev`, `libglew-dev`, `libglfw3-dev`, `python3.14-dev`, `libpng-dev`, `libopenal-dev`, `libluajit-5.1-dev`, `libserialport-dev`, `libsndfile1-dev`, and Wayland/X11 dev packages as needed.
|
||
|
||
|
||
## Installing
|
||
|
||
There is no `make install` yet. Copy the built executable to your MaSzyna installation manually.
|
||
|
||
- Output directory: `./bin`
|
||
|
||
- File name format: `eu07_YYYY-MM-DD_<commit>[_d]`
|
||
|
||
- `YYYY-MM-DD` – build date
|
||
|
||
- `<commit>` – short commit hash
|
||
|
||
- `_d` – present in Debug builds
|
||
|
||
|
||
If you already have the MaSzyna assets, copy the executable to the install dir. Assets can be downloaded from [eu07.pl](https://eu07.pl/).
|
||
|
||
**Rainsted on Linux**
|
||
|
||
If `Rainsted` (a third‑party starter) fails to detect the executable under Linux, you can create a small wrapper script named `eu07.exe`:
|
||
|
||
```sh
|
||
#!/bin/sh
|
||
./eu07 "$1" "$2" "$3" "$4" "$5"
|
||
|
||
```
|
||
|
||
If detection still fails, padding the file (with comments) up to ~1 MB may help.
|
||
|
||
|
||
## Known Issues
|
||
|
||
- **GLFW linking** – On some systems you must provide the GLFW library path explicitly with `-DGLFW3_LIBRARIES`.
|
||
|
||
- **X11/Wayland linking order** – Linking order of X11 and related libs can matter.
|
||
|
||
|
||
|
||
## Support
|
||
|
||
- **Issues:** [https://github.com/MaSzyna-EU07/maszyna/issues](https://github.com/MaSzyna-EU07/maszyna/issues)
|
||
|
||
- **Official Discord Server:** [https://discord.gg/qAh9ctWPQv](https://discord.gg/qAh9ctWPQv)
|
||
|
||
- **Project page:** [https://eu07.pl/](https://eu07.pl/)
|
||
|
||
## Minimum requirements
|
||
|
||
- OS: **Windows 10 64-bit**
|
||
- Processor: **4 cores with AVX2 support (e.g. Intel Core i5-4430 / AMD Ryzen 3 1200)**
|
||
- RAM: **6 GB RAM**
|
||
- Graphics Card: **supporting OpenGL 4.6 with at least 1GB VRAM**
|
||
- **150 GB of free disk space**
|
||
- Sound card supporting OpenAL with stereo
|
||
- Optional COM ports for custom control panel setups.
|
||
|
||
## License
|
||
|
||
- Source code: [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/)
|
||
|
||
- Assets: [Custom license](https://eu07.pl/docs/inne/readme_pliki/en-licence.html)
|