![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
|
|||||||||
|
|
Thread Tools | Display Modes |
09-30-26, 07:17 PM
|
#1 |
|
Nub
![]() Join Date: Feb 2011
Posts: 3
Downloads: 77
Uploads: 0
|
Repo: https://github.com/SzzoekzZx9/Silent-Hunter-Monitor
Hey all, I've been working on a hobby project for Silent Hunter 3 and figured it's far enough along to share. SH3 Monitor is a Linux companion tool that reads the game's memory while you play and turns it into a live dashboard, push notifications, and - if you want to go full roleplay - an LLM-generated captain's log written to a wiki. Why I built this On September 1st last year I started a real-time playthrough of SH3 the game runs 24/7, one in-game second per real second, no time compression. It lives on a headless Linux server and I stream it to whatever device I'm on with a Sunshine server and a Moonlight client. The problem with a war that runs around the clock is that I can't. The boat doesn't care whether I'm at work, asleep, or grocery shopping if an escort rumbles over the horizon at 3 AM, nobody dives the boat. So I wanted something that would let the boat "call home": watch the game in my absence and ping my phone the moment something happens. That grew into a full monitoring stack live dashboard, radio traffic, weather, crew fatigue and eventually into having an LLM write the patrol log for me, in the captain's voice, because a 24/7 patrol generates more journaling than I could ever keep up with by hand. If you play normal sessions with time compression, the tool works fine for that too it just grew up in the deep end. What it does The tool is built from small "collector" modules that each watch one thing in game memory and publish events on a shared bus. Right now it tracks: - Ship / aircraft spotted the "Ship spotted, sir!" log messages - Radio traffic incoming BdU messages - Speed, depth, depth under keel, heading live boat telemetry - Position map grid + lat/lon - Weather it actually asks the Navigation Officer (sends Ctrl-W to the game window) and reads the report, stamped with the in-game date/time - In-game clock so everything is correlated to game time, not wall time - Captain's log entries patrol starts, ships sunk, aircraft destroyed, objectives completed All of that feeds two frontends: 1. An ncurses dashboard split-screen terminal UI with boat status (color-coded depth zones), a scrolling event log, radio messages, captain's log entries, and a full-screen crew screen: a side cutaway of the boat with every crewman at their station, color-coded by fatigue. 2. XMPP push notifications get "Ship spotted!" on your phone while the game runs in another window. (Any XMPP/Jabber account works.) The crew screen is live: the crew collector reads the real roster names, ranks, stations, and fatigue levels straight from game memory, so you can see exactly who's standing watch, who's asleep in the bunks, and who's about to keel over in the engine room. And the part I had the most fun with: the patrol log writer. It accumulates a digest per in-game day (sightings, radio traffic, weather, grids, dive/speed stats, course changes) and once a day writes a first-person recap in the captain's voice to a wiki page one page per patrol, entries upserted by date so nothing duplicates. It talks to any OpenAI-compatible LLM endpoint (I run a local one) and any Gollum wiki. This is entirely opt-in and off by default. How it works (briefly) It reads /proc/<pid>/mem directly no injection, no DLLs, nothing written to the game. Log-message collectors find the game's message buffers by scanning for known string signatures (with a two-phase discovery process, cached between sessions), and the numeric collectors read the player-boat structure. Everything is event-driven and modular, so adding a collector for a new log message is ~30 lines. The restrictions please read before trying I want to be upfront about how narrow the compatibility window is: - Linux only. It reads /proc/<pid>/mem and uses pgrep. There is no Windows support and porting would mean a completely different memory access layer. - X11 only (for now). The weather collector drives the game window with xdotool, which needs an X display. Wayland users: run the game under XWayland and it should work, but I've only tested plain X11. - One specific game build: GWX OneAlex Edition 1.53 (running under Wine/Lutris or Proton/Steam). This is the big one. The memory signatures and structures were reverse-engineered from that exe (sh3.exe). A different exe vanilla, other mega-mods, different OneAlex versions will very likely fail discovery or read garbage. The scanner framework is there if someone wants to map another build, but I make no promises. - Root required. Reading another process's memory needs sudo. If that makes you nervous (fair!), the code is right there to audit it only ever reads. - First-run discovery is slow-ish. The log collectors scan memory to find the message buffers; expect a minute or two on first launch, then it's cached and fast. - Python 3 + a couple of deps (slixmpp for notifications, xdotool for weather queries). Everything else is stdlib. Known limitations - The weather query sends Ctrl-W to the focused game window it works because the game runs fullscreen, but don't alt-tab at the wrong moment. - Patrol log recaps trigger at real-time midnight, not the in-game day rollover (time compression is handled pending days each get their own entry but the trigger is wall-clock). - The LLM patrol log needs you to bring your own OpenAI-compatible endpoint and your own Gollum wiki. No cloud services are hardcoded; everything is configured via a .env file. - It's a personal tool that grew the code is more "well-commented hobby project" than "polished product". The ncurses UI is labeled experimental for a reason. Quick start Code:
git clone https://github.com/SzzoekzZx9/Silent-Hunter-Monitor.git cd Silent-Hunter-Monitor cp .env.example .env # optional: notifications / patrol log config sudo python3 sh3_master_ncurses.py Feedback wanted If you're running the same OneAlex build on Linux, I'd love to hear whether it works for you. If you run a different build and are comfortable with memory scanning, the memory-tools/ directory has the scanners I used to map the structures porting to another exe is mostly re-finding signatures. Fair seas and Happy Hunting! Disclaimer: this is a fan-made, slop code, educational tool for monitoring a game you own. It reads game memory only, writes nothing to the game. |
|
|
|
|
