# StixsworldHD — Ungodly AI, Job, Epidemic & Pay Overhaul for **Two Point Hospital** **An ungodly, madly, vastly enhanced AI / behaviour / difficulty overhaul — now with an intelligent Job Assign Helper, an Epidemic Helper, and a real-time Automatic Pay Raise Director.** 160 fully-documented settings · a closed-loop adaptive Difficulty Director · a Job Assign Helper · an Epidemic Helper · an Auto Pay Raise Director · an in-game configuration window · zero placeholders. - **Author:** StixsworldHD (StixsmasterHD4k) - **Version:** 1.2.0 - **Framework:** BepInEx 5 (x64, Mono) - **Game:** Two Point Hospital (`TPH.exe`) — base game **and all DLC** - **Plugin GUID:** `com.stixsworldhd.tph.ungodlyai` - **Plugin file:** `StixsworldHD.UngodlyAI.TPH.dll` --- ## 1. What this mod does Two Point Hospital's whole simulation runs off a single master balance table and a handful of per-frame AI loops. This mod hooks the exact decision points the game itself uses — patient need decay, room/queue scoring, the staff job director, treatment & diagnosis rolls, machine wear, navigation, the economy clock — and exposes **every one of them** as a safe, ranged, plain-language setting. On top of that sits a **Dynamic Difficulty Director**: a closed feedback loop that watches your hospital in real time and gently tightens or loosens the screws to keep the game exactly as challenging as *you* want. Everything is driven through hooks against the game's **real, shipped method signatures**, so behaviour stays faithful — the mod re-uses the game's own treatment math, its own Tough-Luck pity-timer, its own round-robin attribute scheduler — it just lets you *tune* them. Highlights: - **Every patient & staff need rate** is individually tunable (hunger, thirst, toilet, boredom, litter, nausea, hygiene, health, temperature, energy…), plus a master multiplier. - **Patient brains:** patience timers, urgent/opportunistic need thresholds, search radii, happiness reactions to curing/over-/under-charging. - **Patient routing & queues:** distance weighting, queue-length spreading, unstaffed/broken-room avoidance, "find a better room" cadence — make crowds flow intelligently instead of clumping. - **Staff job director:** the full job-scoring weight set — queue pull, priority/emergency boosts, distance falloff, fire/ambulance/maintenance/research/service/ghost appeal, anti-double-up, and more. - **NEW — Ungodly Job Assign Helper:** a real-time system that watches every room and intelligently steers the game's *own* staff-assignment AI toward rooms that have a queue but too few working staff — so under-served and chronically-ignored rooms get covered fast, idle staff get put to work, and nothing sits empty. It only ever *raises* a room's appeal (never penalises), escalates the longer a room is neglected, is hard-capped to stay stable, and never bypasses the vanilla logic — so it's fully compatible with the base game, all DLC, and other mods. - **NEW — Ungodly Epidemic Helper:** tips epidemic challenges in your favour through the game's *own* vaccination system — boosts the starting vaccine pool (multiplier + flat bonus), refunds any dose wasted on a non-infected patient, and can optionally auto-vaccinate known-infected patients hands-free (a few per pass, never an instant mass-cure). Does nothing when no epidemic is running, so it's safe to leave on. - **NEW — Ungodly real-time Automatic Pay Raise Director:** watches every staffer and quietly keeps them paid by raising under-paid staff toward their desired salary in real time (with optional auto-promotion), using the game's *own* salary/promotion methods. Never lowers pay, only acts on under-paid staff, and is per-step capped so it never spikes your wage bill — no more babysitting the pay-review screen. - **Staff energy, breaks, morale, salary & resignation** pacing. - **Treatment & diagnosis:** an honest success-chance bias (shown in the UI estimate too), a scalable death-on-failure chance, scalable diagnosis speed, and direct control of the Tough-Luck balancer. - **Environment, hygiene & contagion, machine wear/smoke/fire thresholds, navigation retry behaviour, and the master day-length economy clock.** - **Performance:** an optional configurable attribute-processing batch size for buttery-smooth needs on huge hospitals. - A **Dynamic Difficulty Director** with five modes (Off / Relax / Adaptive / Hardcore / Custom). - A built-in **in-game configuration window** (default hotkey **F6**) with sliders, toggles, search, live status, and one-click reset — no external Configuration Manager required. --- ## 2. Requirements 1. **Two Point Hospital** (Steam / other), 64-bit. 2. **BepInEx 5.4.x (x64)** installed into the game folder. This mod targets the Mono x64 build of BepInEx 5. (BepInEx 6 / IL2CPP is **not** required — this game is Mono.) If you do not have BepInEx yet: download the **BepInEx 5 x64** release, extract it into the folder that contains `TPH.exe`, then run the game once so BepInEx generates its folders. --- ## 3. Installation 1. Make sure you have run the game **once with BepInEx installed** so the `BepInEx/plugins` and `BepInEx/config` folders exist. 2. From this download, copy the contents of the `BepInEx` folder over the `BepInEx` folder in your game directory. After copying you should have: ``` / ├─ TPH.exe └─ BepInEx/ ├─ plugins/ │ └─ StixsworldHD-UngodlyAI-TPH/ └─────── StixsworldHD.UngodlyAI.TPH.dll 3. Launch the game. In the BepInEx console/log you should see: `StixsworldHD Ungodly AI, Job, Epidemic & Pay Overhaul v1.2.0 loaded.` 4. Load a hospital and press **F6** to open the configuration window. To uninstall: delete the DLL (and optionally the `.cfg`). --- ## 4. The in-game configuration window (F6) Press **F6** in-game (rebindable) to open a draggable window: - **Categories** down the left — one tab per config section (00–13). - Each setting shows the correct control: **toggle** for on/off, **slider** (with live value) for numbers, **`<` / `>` cycler** for the Director mode, and a **Rebind** button for the hotkey. - Under every control is a **gamer-friendly explanation** of exactly what it does and which direction makes the game harder or easier. - A **live status bar** at the top shows what the Director is doing right now: current mode, whether it's pushing harder/easier, intensity %, your average patient happiness, staff morale, and the live multipliers in effect. - **Search** box filters every setting across all tabs by name or description. - Footer: **Reset this tab**, **Reset EVERYTHING**, **Save to .cfg**, **Close**. Changes apply **instantly** — there is no need to restart the game or reload the hospital. Hit **Save to .cfg** to persist them for next time. --- ## 5. The configuration file Location: `BepInEx/config/com.stixsworldhd.tph.ungodlyai.cfg` A pre-generated, fully-documented copy is included in this download. For **every** setting the file lists: - a plain-language description of what it changes in gameplay, - the **setting type**, - the **default value**, and - the **acceptable value range (min → max)** — or the list of allowed values for the Director mode. You can edit it in any text editor; changes are picked up the next time the file is saved while the game runs, or on next launch. (BepInEx rewrites this file in its own canonical format the first time it loads the plugin — your values are always preserved.) --- ## 6. Settings at a glance (17 sections, 160 settings) | # | Section | What it controls | |---|---------|------------------| | 00 | General & Director | Master on/off, GUI hotkey, balance-override toggle, and the full Dynamic Difficulty Director | | 01 | Patient Need Rates | Per-need decay speed for patients (+ master multiplier) | | 02 | Patient Behaviour & Happiness | Patience timers, need thresholds, happiness reactions to cure / pricing | | 03 | Patient Routing & Queues | Room-choice scoring, queue spreading, search radii — intelligent crowd flow | | 04 | Staff Energy & Breaks | Staff need rates, break thresholds & durations, reaction delays | | 05 | Staff Morale, Salary & Resignation | Morale volatility, resignation cadence, salary demands | | 06 | Staff Job Director | The complete job-scoring weight set for staff task selection | | 07 | Staff Training & Skill | Training speed and passive XP gain | | 08 | Treatment & Diagnosis | Success bias, death-on-failure scaling, diagnosis speed, Tough-Luck balancer | | 09 | Environment & Hygiene | Hygiene rating weighting, thermal comfort band, person-to-person contagion | | 10 | Machines & Hazards | Maintenance / repair / smoke / fire wear thresholds | | 11 | Economy | Sell-value refunds and the master in-game day length | | 12 | Navigation AI | Path-failure retry timing and unreachable-area warnings | | 13 | Performance | Configurable attribute-processing batch size, verbose logging | | 14 | Job Assign Helper | Real-time staffing intelligence: starved-room boost, demand weighting, idle-staff preference, chronic-neglect escalation, safety caps | | 15 | Epidemic Helper | Vaccine pool multiplier + flat bonus, no-wasted-doses refund, optional hands-free auto-vaccinate | | 16 | Auto Pay Raise Director | Real-time auto-raises toward desired salary, overpay buffer, per-step cap, optional auto-promotion, quiet mode | --- ## 7. The Dynamic Difficulty Director The Director is a **closed control loop**. On a fixed real-time interval it samples your hospital (average patient happiness, staff morale, head-counts), compares that to a target band, and applies a smoothly-changing pressure signal across three optional levers: **patient need speed**, **staff energy drain**, and **treatment success chance**. It never yanks values around — it eases them up and down so difficulty drifts naturally. **Modes:** - **Off** — the Director does nothing; only your manual settings apply. - **Relax** — one-way safety net: it will only ever *ease* the game when patients are struggling, and never make things harder. Ideal for relaxed/creative play. - **Adaptive** — rubber-bands difficulty **both** ways to hold your target happiness band. The "set it and forget it" mode. - **Hardcore** — ratchets difficulty **up** the better you perform, and only relents when you're near a failure cliff. For players who want to be pushed. - **Custom** — uses the Target / Band-width / Aggression sliders exactly as you set them, in both directions. **Key Director sliders:** Target Happiness, Band Width (dead-zone), Aggression (how hard it pushes), Update Interval, and per-lever maximum swing caps. You can also independently disable any of the three levers. **Safety:** the Director's need-pressure lever deliberately **never** touches patient *Health*, *Hygiene* or *Temperature* decay — so the adaptive system can make the game tenser without ever silently killing your patients. Patient deaths only ever change via the explicit, opt-in Treatment death-chance setting in section 08. --- ## 8. The Ungodly Job Assign Helper A frequent Two Point Hospital frustration: a room has a queue forming but **nobody is working it**, while staff potter about elsewhere — or a room is permanently a little under-staffed and never quite gets enough hands. The game decides who works which room through a single scoring function that's driven mostly by raw queue length, which doesn't always react to *empty* or *chronically neglected* rooms. The Job Assign Helper fixes this **without replacing the game's logic** — the safest, most compatible approach. It runs a lightweight scan a few times per second and, for each room, works out: - **Demand** — how many patients are queued for / using the room. - **Coverage** — how many staff are actually *working* it right now. - **Starvation** — demand that coverage isn't meeting (a queue with zero working staff is "fully starved"). - **Chronic neglect** — how *long* the room has been starved, tracked over time so persistently-ignored rooms escalate in priority until they finally win attention. It then feeds a single **boost multiplier** into the game's own room-job score, making starved rooms more attractive to free staff — and preferring **idle** staff so it doesn't yank people off useful work. The game still makes every actual assignment; the helper only hands it smarter numbers. That's why it coexists cleanly with the vanilla AI, all DLC, and other mods. **Safety & stability built in:** - It only ever **raises** a room's appeal — it never penalises anything. - By default it **never boosts a room that's already fully staffed**, so staff don't over-pile into one room. - The total boost is **hard-capped** (`JobHelper_MaxBoost`) to prevent runaway scores or staff thrashing between rooms. - Turn the whole thing off with `JobHelper_Enable` (or the master switch) for vanilla assignment, no restart needed. **Tuning (section 14):** master enable, scan interval, starved-room boost strength, demand weighting, idle-staff preference, chronic-neglect escalation + its ramp time, the safety cap, an "unstaffed-rooms-only" conservative mode, and a "respect fully-staffed" toggle. The in-game window's live status bar shows the helper working in real time: how many rooms are currently starved, how many staff are idle, and the total unmet demand. --- ## 9. The Ungodly Epidemic Helper Epidemic challenges hand you a fixed pool of vaccines and a contagious outbreak; you lose if too many infected patients escape, you run out of vaccines, or infections ever outnumber remaining doses. The usual disasters are running dry on vaccines and burning doses on patients who turn out healthy. The Epidemic Helper tilts the odds your way **entirely through the game's own epidemic object and vaccination method** — it never replaces the mechanic, so it stays fully compatible: - **Bigger vaccine pool** — the moment an epidemic begins, it scales the starting vaccines by a **multiplier** and adds a **flat bonus**, so you're not fighting a doomed shortage. - **No wasted doses** — if you vaccinate someone who wasn't actually infected, the dose is **refunded** instantly, so misclicks and guesswork cost nothing. - **Optional hands-free auto-vaccinate** — it can automatically vaccinate patients it *knows* are infected (tracked live from the real simulation) while vaccines remain, a few per pass so it stays gradual and never an instant mass-cure. Infected patients are detected by observing the game's own infection modifier as it's applied and removed, so the helper is always in sync with the real outbreak. It does nothing at all when no epidemic is running, so it's safe to leave enabled. **Tuning (section 15):** master enable, vaccine multiplier, flat bonus vaccines, no-wasted-doses toggle, auto-vaccinate toggle + its interval and per-pass cap. The in-game window shows the live outbreak status: whether an epidemic is active, how many are infected, and how many vaccines remain. --- ## 10. The Ungodly Automatic Pay Raise Director Staff get unhappy and threaten to quit when their pay slips below what they think they deserve — which normally means constantly babysitting the pay-review screen. This director handles it for you, in real time, using the game's **own** salary and promotion methods (so it behaves exactly like an attentive player, just automatically — and stays fully compatible). On a configurable interval it reviews every staffer and: - **Tops up under-paid staff** — if someone has fallen more than your tolerance below their desired salary, it raises them to that desired pay, plus an optional small **buffer** so they land at *Happy* rather than merely *Satisfied* and won't ask again immediately. - **Caps each raise** — a per-step ceiling keeps raises gradual so your wage bill never spikes in a single jump. - **Optionally auto-promotes** — anyone who's become eligible (max XP + fully trained) can be promoted automatically via the game's own promotion. - **Stays quiet** — raises apply silently by default so an active director doesn't spam notifications. It **never lowers a salary** and only ever acts on under-paid staff, so it can't be used to cut wages. Because it spends your money automatically, it's **off by default** — enable it in section 16 when you want hands-free staff retention. **Tuning (section 16):** master enable, review interval, raise threshold (how far behind before it acts), overpay buffer, per-step raise cap, auto-promote toggle, and quiet mode. The in-game window shows how many staff were reviewed and how many raises the director has given this session. --- ## 11. Performance - All hot-path hooks (the per-character need multiplier that fires constantly) read **pre-resolved plain static fields** — no reflection, no dictionary lookups, no config reads per call. The director pre-multiplies its layers so the per-call cost is a single branch and a multiply. - The Director itself only evaluates a few times per *second* (configurable), and only while the sim is unpaused. - Section 13 lets you raise the game's attribute-processing batch size so needs update more smoothly on very large hospitals, or lower it to save CPU. - The Job Assign Helper's room scan runs only a few times per second (configurable), and its per-score boost is a handful of integer reads plus arithmetic — negligible even on large hospitals. - The Epidemic Helper and Pay Raise Director are timed passes (configurable intervals) that run only while the sim is unpaused; infection tracking is a couple of set operations, and a pay review is a quick salary comparison per staffer — all trivial. --- ## 12. Compatibility - Works with the base game and all DLC/content packs (it tunes the shared balance table and core AI, which every level uses). - The **master switch** (section 00, `MasterEnabled`) turns the entire mod into a pass-through instantly — flip it off and the game behaves 100% vanilla with no restart. - `ApplyBalanceOverrides` lets you keep only the need-rate / treatment / director patches while leaving every balance-table value vanilla, if you want a lighter touch. - Other BepInEx mods: this mod only patches the methods listed below; conflicts are unlikely unless another mod patches the same balance table or the same AI methods. --- ## 13. Technical notes — what gets hooked - `Character.GetAttributeMultiplier(CharacterAttributes.Type)` — the single choke-point for every need/attribute rate (patients & staff), postfixed with an allocation-free switch. - `Level.Update()` — per-frame sim tick; drives the Director and tracks the active level. - `GameAlgorithms.Initialise(GameAlgorithmsConfig)` — captures the live balance table so 90 balance fields can be written/tuned at runtime. - `GameAlgorithms.CalculateEstimatedTreatmentOutcome(...)` — applies the honest treatment success bias (so UI estimate == actual roll). - `GameAlgorithms.CalculateTreatmentOutcome(...)` — faithful re-implementation enabling the death-on-failure multiplier while preserving the Tough-Luck pity-timer call order. - `GameAlgorithms.GetDiagnosisCertainty(...)` (both overloads) — scales diagnosis speed. - `GameAlgorithms.CalculateTrainingPointLearnRate(...)` — scales training throughput. - `AttributesManager.Update()` — optional configurable-batch re-implementation for performance. - `GameAlgorithms.CalculateRoomJobScore(Room, Staff, Staff, JobRoom)` — postfixed by the Job Assign Helper to multiply in a starvation/idle boost, steering the game's own staff-assignment AI without replacing it. - `ChallengeEpidemic.OnChallengeStarted` / `ChallengeEpidemic.VaccinateCharacter` + `CharacterModifierInfected.Add/Remove` — used by the Epidemic Helper to pad the vaccine pool at start, refund wasted doses, and track infected patients (auto-vaccination goes through the game's own `VaccinateCharacter`, obtained live via `ChallengeManager.GetActiveChallengesOfType`). - The Auto Pay Raise Director uses no patches — it runs from the Level tick and calls the game's own `Staff.SetSalary` / `Staff.AutoPromote` against `GetDesiredSalary()`. --- ## 14. Changelog **v1.2.0** - **New feature — the Ungodly Epidemic Helper** (new section 15, 7 settings). Boosts the starting vaccine pool (multiplier + flat bonus), refunds doses wasted on non-infected patients, and can optionally auto-vaccinate known-infected patients hands-free. Works entirely through the game's own epidemic challenge and vaccination method (obtained live from the ChallengeManager), tracking infections via the game's own infection modifier — so it's fully compatible and does nothing when no epidemic is running. - **New feature — the Ungodly real-time Automatic Pay Raise Director** (new section 16, 7 settings). Watches every staffer and automatically raises under-paid staff toward their desired salary in real time (with an optional overpay buffer, a per-step raise cap, optional auto-promotion, and a quiet mode), using the game's own salary/promotion methods. Never lowers pay; off by default since it spends money automatically. The in-game window now shows live epidemic and pay-director status. - **Renamed** the plugin to *StixsworldHD Ungodly AI, Job, Epidemic & Pay Overhaul*. (Plugin GUID and config filename are unchanged, so existing configs keep working and simply gain the two new sections.) - Total settings: **160 across 17 sections**. **v1.1.0** - **New feature — the Ungodly Job Assign Helper** (new section 14, 10 settings). A real-time system that watches every room, measures unmet demand vs. how many staff are actually working it, tracks how long each room has been starved, and feeds a boost into the game's own room-job scoring so staff flow toward under-served and chronically-ignored rooms (preferring idle staff). It only ever raises a room's appeal, is hard-capped against thrashing, by default never over-fills a fully-staffed room, and never replaces the vanilla logic — so it stays fully compatible with the base game, all DLC, and other mods. The in-game window now shows live helper stats (starved rooms / idle staff / unmet demand). - **Renamed** the plugin to *StixsworldHD Ungodly AI & Job Assign Overhaul* to reflect the new system. (Plugin GUID and config filename are unchanged, so existing configs keep working and simply gain the new section.) - Total settings: **146 across 15 sections**. **v1.0.2** - **Fixed** the in-game configuration window rendering with a see-through background (the game world showed through the panel, hurting readability). The window now uses a fully opaque dark backdrop with slightly lighter solid panels behind each setting, and all captions/values use an explicit high-contrast light colour. Backgrounds are generated textures flagged to survive scene loads. No settings or behaviour changed — purely a visual/readability fix. **v1.0.1** - **Fixed** the performance patch failing to apply on startup. `AttributesManager.Update` was using Harmony's `___field` injection, which resolved to the wrong field names (`attributes` / `lastProcessed`) instead of the game's actual private fields (`_attributes` / `_lastProcessed`), producing a HarmonyX warning + patch error in the log. It now uses cached `FieldRefAccess` accessors that target the correct fields directly — the patch applies cleanly and stays allocation-free per frame. (All other systems were unaffected and already loaded correctly.) **v1.0.0** - Initial release. 136 settings across 14 sections; Dynamic Difficulty Director (5 modes); in-game IMGUI configuration window; offline-generated fully-documented config file; 90 balance-table fields wired for live tuning. --- ## 15. Credits Made by **StixsworldHD (StixsmasterHD4k)**. Built on [BepInEx](https://github.com/BepInEx/BepInEx) and [HarmonyX](https://github.com/BepInEx/HarmonyX). Two Point Hospital © Two Point Studios / SEGA. This is an unofficial, fan-made modification and is not affiliated with or endorsed by the developers or publisher. Enjoy your ungodly hospital. 🏥