Repository navigation
Telemetry and Save Parsing
EU5 RPC combines five strictly read-only telemetry subsystems to track your Europa Universalis V campaign accurately across singleplayer, multiplayer, observer mode, mid-game nation swaps, formables, custom nations, and all 11 official languages — without ever reading game process memory or modifying game files.
flowchart TD
A["1. Process Detection (process.zig)"] -->|Game running| B["2. Passive Steam Rich Presence (steam_rp.zig)"]
B -->|Country, Year, Status, Phase, MP/Observer| E["GameState"]
A -->|Game running| C["3. Live Log Tailing (log_watcher.zig)"]
C -->|Transitions, Version, New Country, Wars, Disasters, Exploration, Year| E
C -->|Fallback if Steam has no country + version sync| D["4. Save & continue_game.json (save_inspector.zig)"]
D -->|Tag, Country, Date, Version| E
F["5. CountryLookup (country_lookup.zig)"] -->|Tag -> Localized Name| C
F -->|Tag -> Localized Name| D
- Steam Rich Presence provides instant localized country names (including dynamic/formable/custom nation names), current year, live status text, lobby/main-menu phase, and multiplayer/observer flags.
-
Live Log Tailing captures exact engine phase transitions, game version, multiplayer host status (
Is Multiplayer Host: true), immediate tag swaps (New Country: <TAG>), yearly ticks (NEW YEAR:), situation start dates, wars, civil wars, explorations, and disasters. -
Save Header Inspection supplements missing country/date/version data using
continue_game.jsonand the newest.eu5save written during the current session (only when Steam Rich Presence did not already report a country).
EU5 RPC detects whether Europa Universalis V is running without spawning helper subprocesses (tasklist, pgrep, ps) and without opening process memory:
-
Windows: Uses
CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)+Process32First/Process32Next, matchingszExeFilecase-insensitively againsteu5.exe. -
Linux: Scans numeric PIDs in
/proc(skipping its own PID), checking:-
/proc/<pid>/commagainsteu5.exeoreu5. -
/proc/<pid>/cmdlineviacmdlineMatchesTarget(), which supports:- Native Linux binaries (
.../binaries/eu5) - Direct Wine/Proton Windows paths (including single-string argv with trailing flags like
Z:\...\binaries\eu5.exe -gdpr) - Leading
env [FLAGS] [VAR=VAL ...]wrappers - Wine/Proton wrappers:
wine,wine64,wine-preloader,wine64-preloader,proton,umu-run - Linux runtime/overlay wrappers:
reaper,pressure-vessel-adverb,srt-bwrap,bwrap,gamemoderun,gamescope,mangohud,steam-run,prime-run - Python-invoked Proton/umu launchers (
python,python3,python3.*runningproton,proton.py, orumu-run)
- Native Linux binaries (
-
False-Positive Guards: Explicitly avoids matching
eu5-rpc,steam -applaunch 3450310, shell commands (bash -c echo eu5.exe),env FOO=1 echo eu5.exe, unrelated Python scripts, or similarly named executables (my_eu5.exe).
-
When the user selects Quit (Close EU5 & RPC) from the tray menu, closeEu5() attempts a graceful shutdown first (WM_CLOSE via EnumWindows on Windows; SIGTERM on Linux), waits up to 3,000 ms, and only falls back to TerminateProcess / SIGKILL if the process remains unresponsive.
EU5 publishes rich live campaign status to your local Steam client. EU5 RPC reads those strings passively from your local Steam client library without calling SteamAPI_Init:
- Sets
SteamAppId=3450310andSteamGameId=3450310in its own process environment to scope its IPC pipe to EU5. - Dynamically loads
steamclient64.dll(Windows) orsteamclient.so(Linux — searchingSTEAM_COMPAT_CLIENT_INSTALL_PATH,XDG_DATA_HOME, native/Debian/Flatpak/Snap Steam paths, and/usr/lib/steam/linux64/steamclient.so). - Calls
CreateInterface("SteamClient021")and opens a local IPC pipe (CreateSteamPipe->ConnectToGlobalUser) to acquireSteamUser023andSteamFriends017. - Reads the local user's own
SteamID(GetSteamID, handling the Windows x64 hidden-pointer ABI vs. System V AMD64 directu64return) and queriesRequestFriendRichPresence,GetFriendRichPresenceKeyCount,GetFriendRichPresenceKeyByIndex, andGetFriendRichPresenceforstatus,steam_display,country, andyear. - Disconnects (
ReleaseUser+ReleaseSteamPipe) immediately when EU5 exits.
cleanPdxText() strips Paradox rich-text formatting directives such as #V Kingdom of France#! -> Kingdom of France, while preserving raw token keys (#main_menu, #in_lobby, #playing, #playing_mp, #playing_observer, #playing_observer_mp).
parsePresenceFields() includes UTF-8 case-folding (including Latin diacritics, Polish, Turkish İ, and Cyrillic Ё), fullwidth parenthesis/comma handling ((), 、, ,), and Russian NBSP (\u00A0) handling for every official EU5 language:
| Language | In-Game Pattern | Multiplayer Tag | Main Menu / Lobby |
|---|---|---|---|
| English | <STATUS> as <COUNTRY>, <YEAR> |
(Multiplayer) |
In Main Menu / In Lobby
|
| Brazilian Portuguese | <STATUS> como <COUNTRY>, <YEAR> |
(Multijogador) |
No Menu Principal / No Lobby
|
| French | <STATUS> en tant que <COUNTRY>, <YEAR> |
(Multijoueur) |
Dans le menu principal / Dans le salon
|
| German | <STATUS> als <COUNTRY>, <YEAR> |
(Mehrspieler) |
Im Hauptmenü / In der Lobby
|
| Spanish | <STATUS> como <COUNTRY>, <YEAR> |
(Multijugador) |
En el menú principal / En sala
|
| Polish | <STATUS> jako <COUNTRY>, <YEAR> |
(gra wieloosobowa) |
W menu głównym / W lobby
|
| Russian | <STATUS> за державу <COUNTRY>, <YEAR> год |
(многопользовательская игра) |
В главном меню / В лобби
|
| Turkish | <COUNTRY> olarak <STATUS>, <YEAR> |
(Çok Oyunculu) |
Ana Menüde / Lobide
|
| Japanese | <COUNTRY>として<STATUS>、<YEAR> |
(マルチプレイ) |
メインメニュー / ロビー
|
| Korean | <YEAR>, <COUNTRY>(으)로 <STATUS> |
(멀티플레이어) |
메인 메뉴 / 로비
|
| Simplified Chinese | 作为<COUNTRY><STATUS>,<YEAR>年 |
(多人游戏) |
位于主菜单 / 位于多人游戏大厅
|
Observer strings (e.g., Observing, Observando, Observe , Beobachtet, 観測中, 관전 중, Obserwuje, Наблюдает, 观察世界, İzliyor) and raw #playing* fallback tokens are also parsed automatically.
EU5 RPC tails three Paradox log files incrementally inside the detected user data folder using a 2 MiB resync cap (RESYNC_BYTES = 2 * 1024 * 1024):
- If EU5 is not running at startup,
seedInitialOffsets()skips log files older thansession_started_at - 3sso stale data from previous sessions is never replayed. - If a log shrinks (truncated on a new EU5 launch), the read offset automatically resets to
0. - If the active user data directory changes (for example, switching between Native Linux and Proton),
refreshUserDataDir()picks the folder with the newest log/JSON activity mtime and resets offsets.
| Log File | Pattern | Effect on GameState
|
|---|---|---|
logs/debug.log |
game version <X.Y.Z[.W]> |
Sets game_version
|
logs/debug.log |
Running Transition <From>-><To> |
Maps SplashScreen / LoadingScreen -> .loading, MainMenu -> .main_menu, Game -> .in_game, Empty -> .not_running
|
logs/multiplayer.log |
Is Multiplayer: true|false |
Sets multiplayer
|
logs/multiplayer.log |
Is Multiplayer Host: true|false |
Sets multiplayer_host
|
logs/multiplayer.log |
_Player Is Observer: true|false |
Sets observer
|
logs/multiplayer.log |
New Country: <TAG> |
Resolves <TAG> via CountryLookup, updates country/tag, clears previous active event, enters .in_game (No / None clears country) |
logs/multiplayer.log |
Destroying gamestate |
Clears active_event
|
logs/game.log |
NEW YEAR: <YYYY> (>= 1337) |
Updates year and date
|
logs/game.log |
SITUATION: ... starts on <D> <Month>, <YYYY> |
Updates year and date if newer or unset |
logs/game.log |
WAR: <Attacker> declared war on <Defender> |
Sets At War with <Defender> or Defending vs. <Attacker> when matching player country |
logs/game.log |
CIVIL WAR: <Rebels> against <Target> |
Sets In a Civil War when matching player country |
logs/game.log |
EXPLORATION: <Country> discovered ... L;<Area>! |
Sets Explored <Area> when matching player country |
logs/game.log |
DISASTER: <snake_name> starts|ends in <TAG> |
Title-cases to Disaster: <Nice Name> on starts, clears active event on ends
|
Strictly read-only inspection without modifying saves or checksums:
-
continue_game.json: Always checked forrawGameVersion(andtitleif needed) using a zero-allocation JSON string extractor. -
Newest
.eu5Save: Scans<user_data_dir>/save games/*.eu5for the most recently modified file. During live gameplay, saves are only read if their mtime (orcontinue_game.jsonmtime) is within the current session (>= session_started_at - 5s) and only when Steam Rich Presence did not already supply a country. -
Filename Parsing: Parses Paradox's naming pattern:
Extracts
(SP|MP)_<TAG>_<YYYY>_<MM>_<DD>_... .eu5multiplayer(SP_vs.MP_),country_tag,year, anddate(YYYY.M.D). -
Binary Header Parsing: Reads only the first 2 KiB (
2048bytes) of the.eu5file (opened with full Windows shared-read/write/delete flags) to extract:- Date & localized country name (
<YYYY.M.D> - <Country Name>, stripping trailing#<hex>suffixes) - 3-character tag block (
<TAG>={) - Game version (
<X.Y.Z>)
- Date & localized country name (
When user_data_folder is empty in config.toml, EU5 RPC evaluates all candidate directories and selects the one with the most recently modified EU5 activity file (logs/debug.log, logs/game.log, logs/multiplayer.log, or continue_game.json), falling back to the first existing directory:
-
Windows:
-
SHGetFolderPathW(CSIDL_PERSONAL)(automatically resolves OneDrive-redirected and localizedDocumentsfolders) +\Paradox Interactive\Europa Universalis V - Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders->Personal -
%USERPROFILE%\OneDrive\Documents\Paradox Interactive\Europa Universalis Vand%USERPROFILE%\Documents\Paradox Interactive\Europa Universalis V
-
-
Linux:
-
$XDG_DATA_HOME/Paradox Interactive/Europa Universalis Vand$XDG_DATA_HOME/Steam -
$STEAM_COMPAT_DATA_PATH/pfx,$WINEPREFIX, and$STEAM_COMPAT_CLIENT_INSTALL_PATH - Proton prefixes (
steamapps/compatdata/3450310/pfx/drive_c/users/<steamuser|$USER>/Documents/Paradox Interactive/Europa Universalis V) across standard, Debian, Flatpak, and Snap Steam roots plus every Steam library drive listed insteamapps/libraryfolders.vdfandconfig/libraryfolders.vdf - Native Linux paths (
~/.local/share/Paradox Interactive/Europa Universalis V,~/.paradoxinteractive/Europa Universalis V, Flatpak/Snap Steam data dirs,~/Documents/Paradox Interactive/Europa Universalis V)
-
Game install discovery (findEu5GameInstallDir) similarly parses libraryfolders.vdf and steamapps/appmanifest_3450310.acf (installdir) across all drives.
On startup (or when EU5 is first detected), EU5 RPC reads two localization files from <EU5 Install Dir>/game/main_menu/localization/english/:
country_names_l_english.ymlformable_countries_l_english.yml
It parses entries matching <TAG>:<optional_version> "<Name>" (skipping dynamic $VARIABLE$ placeholders) into an arena-backed hash map covering all ~2,350+ nations and formables. If the game install cannot be located, it falls back to 54 built-in common starting/major tags (such as FRA -> France, BYZ -> Byzantium, CAS -> Castile, TUR -> Ottomans, KOR -> Goryeo, YUA -> Yuan), and finally to the uppercased tag itself. Tags "NO" and "NONE" resolve to null.
| Year Range | Historical Age |
|---|---|
1337 – 1436
|
Age of Traditions |
1437 – 1536
|
Age of Renaissance |
1537 – 1636
|
Age of Discovery |
1637 – 1736
|
Age of Reformation |
1737 – 1836
|
Age of Absolutism |
1837+ |
Age of Revolutions |
< 1337 |
(none) |
Copyright (c) 2026 Buntato (buntatoes.dev). EU5 RPC is free software licensed under the GNU General Public License v3.0 (GPL-3.0-only). Not affiliated with or endorsed by Paradox Interactive AB; Europa Universalis V is a trademark of Paradox Interactive AB.
Getting Started
Architecture & Telemetry
Development & Support
Links