Environment & Tools - S-T-A-L-K-E-R-Callsign-Polytech/callsign-polytech GitHub Wiki

1. Building the engine

For now default engine is used, but there are plans to fork it and extend functionality.

This is developer detup, user installation will be covered in the end of lifecycle.

Install dependencies

apt install git cmake make libopenal-dev libogg-dev libtheora-dev libvorbis-dev libsdl2-dev liblzo2-dev libjpeg-dev gcc g++ dpkg-dev libmimalloc-dev

Clone the repository

git clone [email protected]:OpenXRay/xray-16.git --depth 1 --shallow-submodules --recurse-submodules -j8

Build the engine

cd xray-16
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DXRAY_LINKER=mold -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS="-march=native" -DCMAKE_CXX_FLAGS="-march=native"
cmake --build build -j12

Setup game folder. You have to install official game from steam, files location depends on your system. Let STEAM_DIR - game location downloaded from steam, STALKER_DIR - where game will be placed.

mkdir -p "$STALKER_DIR"
ln -s "$STEAM_DIR/levels" "$STALKER_DIR"
ln -s "$STEAM_DIR/localization" "$STALKER_DIR"
ln -s "$STEAM_DIR/mp" "$STALKER_DIR"
ln -s "$STEAM_DIR/patches" "$STALKER_DIR"
ln -s "$STEAM_DIR/resources" "$STALKER_DIR"

Then copy fsgame.ltx from xray engine directory and gamedata directory (XRAY is a folder with xray engine)

cp "$XRAY/res/fsgame.ltx" "$STALKER_DIR"
cp -r "$XRAY/res/gamedata" "$STALKER_DIR"

For me game directory looks like

-rw-rw-r-- 1 serhii serhii 2155 Oct  8 17:10 fsgame.ltx
drwxrwxr-x 5 serhii serhii 4096 Oct  8 17:11 gamedata
lrwxrwxrwx 1 serhii serhii   97 Oct  8 16:47 levels -> '/home/serhii/snap/steam/common/.local/share/Steam/steamapps/common/Stalker Call of Pripyat/levels'
lrwxrwxrwx 1 serhii serhii  103 Oct  8 16:47 localization -> '/home/serhii/snap/steam/common/.local/share/Steam/steamapps/common/Stalker Call of Pripyat/localization'
lrwxrwxrwx 1 serhii serhii   93 Oct  8 16:47 mp -> '/home/serhii/snap/steam/common/.local/share/Steam/steamapps/common/Stalker Call of Pripyat/mp'
lrwxrwxrwx 1 serhii serhii   98 Oct  8 16:47 patches -> '/home/serhii/snap/steam/common/.local/share/Steam/steamapps/common/Stalker Call of Pripyat/patches'
lrwxrwxrwx 1 serhii serhii  100 Oct  8 16:47 resources -> '/home/serhii/snap/steam/common/.local/share/Steam/steamapps/common/Stalker Call of Pripyat/resources'

To run the game, inside STALKER_DIR execute $XRAY/bin/x86_64/Debug/xr_3da.

3. Game file layout

The game's fsgame.ltx (in the game root) defines all resource paths. Key entries:

Variable Path Purpose
$game_data$ gamedata\ mod folder, takes priority over archives
$game_config$ gamedata\configs\ mod configs
$game_scripts$ gamedata\scripts\ mod Lua scripts
$game_textures$ gamedata\textures\ mod textures
$logs$ _appdata_\logs\ game logs (verified — see below)
$arch_dir_resources$ resources\ main game archives
$arch_dir_localization$ localization\ text, voice acting
$arch_dir_levels$ levels\ level/map data
$arch_dir_patches$ patches\ official patch, mounted on top of everything else

Note: the gamedata folder that ships with the game by default is not empty — it already contains OpenXRay's own files (openxray.ltx, engine localization, patched shaders/scripts). These are not original game files, and this folder must not be deleted or wiped.

File priority (low → high): resources*.db / configs.db → xpatch_02.db → gamedata. If the same file exists in both the base archives and the patch, use the patch version as the source for editing.

Logs: confirmed at _appdata_/logs/ in the game root, e.g. openxray_<username>.log and xray_<username>.log.

4. Unpacking .db archives

Archives overview

Archive Size Contents
resources/configs.db ~42 MB configs, scripts, spawns, anims
resources/resources.db0–db4 ~2.8 GB total textures, sounds, models
localization/xenglish.db ~53 MB English localization, text
localization/base_sounds.db ~168 MB character voice acting
localization/xefis_movies.db ~444 MB video cutscenes
patches/xpatch_02.db ~34 MB official 1.6.02 patch: updated configs, dialogs, scripts, shaders

Tool: STK_Unpacker

  • Source: github.com/Rammaken/STK_Unpacker (repo archived, last updated Oct 2024)
  • The pre-built release on ModDB (STK_Unpacker_release_1.2.zip) contains Windows binaries only — no .jar.
  • The GUI wrapper is written in Java, but it launches the Windows binary bin/xrUnpacker32.exe / xrUnpacker64.exe via Runtime.exec() with a hardcoded backslash path — this doesn't work on Linux at all, not even through Wine (the GUI crashes with COM/RPC errors, and the file-picker button throws a NullPointerException).

Working method on Linux: build from source, then call the console xrUnpacker*.exe directly through Wine, bypassing the GUI entirely.

Building STK_Unpacker from source

sudo apt install git default-jdk ant wine
cd ~/tools
git clone https://github.com/Rammaken/STK_Unpacker.git
cd STK_Unpacker/STK_Unpacker
ant jar

The built .jar appears in dist/. (The GUI does launch on Linux this way, but the Unpack button still fails — see above.)

Unpacking via Wine (working method)

The console binaries xrUnpacker32.exe / xrUnpacker64.exe are in ~/tools/STK_Unpacker/Resources/. Run them directly, no GUI needed:

cd ~/tools/STK_Unpacker/Resources
mkdir -p ~/stalker_unpacked/<name>

wine xrUnpacker32.exe -unpack -xdb "Z:/path/to/archive.db" -dir "Z:/path/to/output"

Example (configs):

wine xrUnpacker32.exe -unpack -xdb "Z:/home/myroslava/.local/share/Steam/steamapps/common/Stalker Call of Pripyat/resources/configs.db" -dir "Z:/home/myroslava/stalker_unpacked/configs"

Key points:

  • -xdb is the format flag for CS/CoP (SoC uses different flags, -2947ww / -2947ru — not tested).
  • Paths use forward slashes only, prefixed with Z: (how Wine maps the Linux filesystem root /).
  • Each archive is unpacked with a separate command; for multiple files (e.g. resources.db0–db4) a loop is convenient:
  for i in 0 1 2 3 4; do
    wine xrUnpacker32.exe -unpack -xdb "Z:/.../resources/resources.db$i" -dir "Z:/home/myroslava/stalker_unpacked/resources"
  done
  • Unpack into a folder outside the game directory (e.g. ~/stalker_unpacked/) — this is a read-only reference copy; only actually modified files go into gamedata.
  • Unpacking is fast (a few seconds even for 2.8 GB); no errors encountered with this method.

5. Editors

VS Code setup (verified)

Task Extension Notes
DDS textures DirectDraw DDS Viewer (hyuckkim) Confirmed working — opens .dds files from unpacked textures/ directly in the editor.
Lua (.script) Lua (sumneko) Confirmed working, but VS Code doesn't auto-detect .script as Lua. Set via Ctrl+Shift+P → Change Language Mode → Configure File Association for '.script' → choose Lua. This persists across files (writes a files.associations entry to settings), same mechanism as the LTX fix below.
LTX (.ltx) none dedicated — mapped to ini Close enough to INI ([section], key = value) for readable syntax highlighting. Set via Ctrl+Shift+P → Change Language Mode → Configure File Association for '.ltx' → choose Ini. Persists across files (writes to files.associations in settings).
XML (dialogs, UI) built-in VS Code has native XML support, no extension needed.
.thm files no editor needed These are auto-generated sidecar files that travel with .dds textures (e.g. weapon_icon.dds + weapon_icon.thm), storing SDK/engine metadata — compression format, mip count, usage flags (bump map, detail texture, etc.). Not meant to be hand-edited; regenerated by the SDK/texture converter when the .dds changes.

Encoding (verified — applies to both .script and .ltx)

Whether a file needs manual encoding correction isn't determined by file type — it's determined by whether the file actually contains Cyrillic text (comments, dialog strings, etc.). Confirmed on both .script and .ltx files in this project: original CoP files often carry Cyrillic in Windows-1251, not UTF-8, and VS Code's default UTF-8 interpretation renders it as mojibake.

Fix, per file:

  • Bottom-right corner of VS Code shows the detected encoding — click it, choose "Reopen with Encoding" → Cyrillic (Windows 1251) to view correctly.
  • To edit and save back in the same encoding (important — saving as UTF-8 can break the game's text rendering for that file), use "Save with Encoding" from the same menu, not a plain Ctrl+S after reopening.

Pitfalls

  • STK_Unpacker's GUI doesn't work on Linux. The file-picker button throws a NullPointerException (confirmed in ui_unpacker.java), and the Unpack button silently fails because it tries to launch a Windows .exe directly without Wine. Workaround: call xrUnpacker*.exe manually through Wine from the console (see above).
  • The ModDB release build is unusable on Linux without building from source — it ships no .jar.
  • The OpenXRay build output binary is nested several folders deep (bin/x86_64/<config>/xr_3da), not directly in bin/.
  • No need to copy the built engine into the game's bin folder — running it from the build directory with cd into the game root works fine.
  • Encoding issues aren't tied to file type — check per file for Cyrillic content, not by extension.

Links

⚠️ **GitHub.com Fallback** ⚠️