TI Crew Extended

If you liked this item, please rate it up on Steam Workshop page.

Author: Henrik Long

Last revision: 12 May at 22:36 UTC

File size: 1.05 MB

On Steam Workshop

Description:

# TICrewExtended + Fleet Academies

## Overview
This mod adds a full Crew resource system to Terra Invicta through a Unity Mod Manager DLL and Harmony patches.

## Required
– Unity Mod Manager –> https://www.nexusmods.com/site/mods/21

## Main Features
– New global Crew resource shown in the vanilla top bar next to Mission Control.
– Display format: `Free / Required / Pool`.
– Monthly Crew gain from controlled nation population.
– Additional monthly Crew gain from special station hab modules.
– Ship construction can begin without enough free Crew, but completion waits until Crew is available.
– Ship completions are prioritized over hab-module activations when both are blocked by Crew.
– Crew is committed dynamically from real vanilla `crew` and `crewBillets` values.
– Only ships and space stations count toward Crew usage.
– Ground bases are excluded from Crew usage.
– Alien faction is excluded from the Crew system.
– Destroyed ships permanently reduce `CrewPool`.
– Scuttled ships free Crew again.
– Ships under refit free their Crew while the refit is in progress.
– Crew data is persisted directly into the save JSON / GZ file under `tiCrewExtended`.
– Crew gain from academy modules is JSON-driven.
– The base population divider is hardcoded in C# to `20,000,000`.
– Crew shortage warnings can appear in the top bar and as in-game notifications.
– translation provided in german and english

## Crew Model
– `CrewPool`: Total trained crew owned by the faction.
– `CrewAssigned`: Crew already tied up in active ships and completed active station modules.
– `CrewRequired`: Total Crew demand including assigned Crew plus active in-progress ship construction and hab-module construction.
– `AvailableCrew`: `CrewPool – CrewRequired`.

## Monthly Crew Gain
Base monthly gain:
– `population / 20,000,000`

Divider research projects:
– `Project_ExpandedCrewRegistries`: lowers divider to `15,000,000`
– `Project_OrbitalCrewStandardization`: lowers divider to `10,000,000`
– `Project_StrategicCrewMobilization`: lowers divider to `5,000,000`

Station academy bonus:
– `FleetAcademy`: `crewGain_month = 5`
– `FleetWarCollege`: `crewGain_month = 15`
– `GrandFleetAcademy`: `crewGain_month = 40`

## Construction Rules
– A ship may enter the queue and start construction even if free Crew is currently insufficient.
– A ship only completes when enough free Crew is available.
– `Required` includes active in-progress ship construction and hab modules that are currently under construction.
– Paused ship construction is excluded from `Required` and from the waitlist until the shipyard actually resumes building.
– A shipyard counts as active only when its current queue head is really running. If the shipyard is inactive, unpowered, or otherwise not building, that ship is not counted as active Crew demand.
– Hab modules under construction count toward `Required`, but only start competing in the waitlist once they are actually ready to complete.

## Waitlist Behavior
The mod keeps an internal Crew waitlist to decide what gets staffed first when free Crew is insufficient.

Rules:
– Ships always have priority over hab modules.
– Ships use first-come-first-serve ordering once they enter the waiting-for-crew state.
– For ships, “first come” means the ship that reaches completion and starts waiting for Crew first keeps priority over later ships.
– Hab modules are processed only after ship reservations are handled.
– Two identical ships or two identical hab modules are tracked separately by runtime instance, not just by template name.

## Fleet Academy Modules
The following station-only hab modules are defined in `TIHabModuleTemplate.json` and expose their Crew gain through the custom JSON field `crewGain_month`.

### Fleet Academy
– Unlock project: `Project_FleetAcademy`
– Crew gain: +5 / month
– Influence: +1 / month
– Ops: -0.5 / month
– Mission Control: -1

### Fleet War College
– Unlock project: `Project_FleetWarCollege`
– Upgrades from: `FleetAcademy`
– Crew gain: +15 / month
– Influence: +2 / month
– Ops: -1 / month
– Mission Control: -2

### Grand Fleet Academy
– Unlock project: `Project_GrandFleetAcademy`
– Upgrades from: `FleetWarCollege`
– Crew gain: value defined in `TIHabModuleTemplate.json`
– Influence: +4 / month
– Ops: -2 / month
– Mission Control: -3

## Research and Project Chain
Defined in `TITechTemplate.json`:
– `FleetAcademyDoctrine`
– `FleetWarCollegeDoctrine`
– `GrandFleetCommandTheory`

Defined in `TIProjectTemplate.json`:
– `Project_FleetAcademy`
– `Project_FleetWarCollege`
– `Project_GrandFleetAcademy`
– `Project_ExpandedCrewRegistries`
– `Project_OrbitalCrewStandardization`
– `Project_StrategicCrewMobilization`

## JSON Fields You Can Edit
### In `TIHabModuleTemplate.json`
– `crewGain_month`
Static Crew added each month by that station module.

### In `TIProjectTemplate.json`
– `crewPopulationDivider`
The effective divisor used once that project is completed. Lower is stronger.

## Performance Notes
The heaviest Crew work happens during daily completion windows, when Terra Invicta checks whether ships and station modules can finish construction. This is the period that most commonly lines up with visible stutter in accelerated time.

Current optimizations:
– Live Crew usage and total Crew requirement share the same cache refresh path.
– Monthly Crew gain is cached separately from Crew usage.
– Daily completion checks reuse a short-lived completion snapshot instead of recalculating Crew state for every waiting ship and module.
– Waitlist ordering is stored per faction so ships keep stable first-come-first-serve priority without recomputing order from scratch every time.
– The top-bar transient warning UI is throttled and only refreshes when warning state changes or after a short interval.
– Reflection-based collection lookups cache their preferred member names after first resolution.
– Waitlist logging is deduplicated by plan signature to avoid unnecessary log spam.
– Paused shipyards are excluded early, so inactive queue entries do not waste time in later Crew checks.

## Notes
– The Crew resource is not a native JSON resource, so the actual resource behavior is implemented in C# with Harmony patches.
– The academy modules and divider projects are standard JSON content, and the DLL reads their custom Crew fields at runtime.
– If you want faster or slower growth, edit `crewGain_month` or `crewPopulationDivider` values.

## Disclaimer
– This mod is not intended to be removed after game start. Mid Game implementation should be possible.
– Please report any bugs! Only a known bug can be fixed.