Block 2 — Raccoon Roster (1 day)
Goal: Raccoons exist as persistent, named entities the player can inspect. Starter crew spawns on game start. Full URaccoonSubsystem operational.
Depends on: Block 1 data model (FRaccoonData, FStatBlock, subsystem stubs).
Deliverables
URaccoonSubsystem — Full Implementation (C++)
All functions UFUNCTION(BlueprintCallable):
| Function | Signature | Purpose |
|---|---|---|
AddRaccoon | FGuid (ERaccoonType, FString Name="") | Create FRaccoonData from URaccoonTypeDataAsset defaults (random within stat ranges). Generate name if empty. Add to TArray<FRaccoonData>. Broadcast OnRosterChanged. |
RemoveRaccoon | void (FGuid) | Remove from array. Unassign from station if assigned. Broadcast. Used for desertion and capture. |
GetRaccoon | FRaccoonData (FGuid) | Return copy for Blueprint. Internally return pointer. |
GetAllRaccoons | TArray<FRaccoonData> () | Full roster for UI. |
GetEffectiveStats | FStatBlock (FGuid) | Base + Training + Gear. Sums FRaccoonData::BaseStats + TrainingBonus + resolved gear modifier from UDataTable. Clamped to 100 per stat. C++ because it iterates gear table. |
GetInheritedStats | FStatBlock (FGuid) | Base + Training (no gear). Used by breeding to determine parent contribution. |
GetCrewStatSum | FStatBlock (TArray<FGuid> Crew) | Sum GetEffectiveStats across all crew members. C++ — iterates collection. Used by encounter resolution (Block 4). |
SetStatus | void (FGuid, ERaccoonStatus) | Validate transition legality, update, broadcast OnRosterChanged. |
GetRaccoonsByStatus | TArray<FGuid> (ERaccoonStatus) | Filter roster by status. C++ — iterates collection. |
EquipGear | bool (FGuid, FName GearRow) | Set EquippedGearRowName. Returns false if raccoon not found or already equipped. |
UnequipGear | FName (FGuid) | Clear gear slot, return row name for inventory. |
GenerateName | FString () | Pick from curated TArray<FString> of raccoon-appropriate names. Avoid duplicates within current roster. |
Internal state (extends Block 1 stubs — Raccoons and NamePool declared there):
| Member | Type | Purpose |
|---|---|---|
OnRosterChanged | FOnRosterChanged (DYNAMIC_MULTICAST_DELEGATE) | BlueprintAssignable. Broadcast on any roster mutation. UI binds to this |
OnRaccoonAdded | FOnRaccoonAdded (DYNAMIC_MULTICAST_DELEGATE_OneParam) | BlueprintAssignable. Param: FGuid RaccoonId. Fired from AddRaccoon only. Used by UProgressionSubsystem to track recruitment milestones |
GearTable | UDataTable* | Reference to gear modifier table. Used by GetEffectiveStats to resolve EquippedGearRowName → stat bonuses. Assigned in editor or loaded on init |
Raccoon Type DataAssets
Author URaccoonTypeDataAsset content assets:
| Asset | Primary Stat | Secondary | Starting Ranges |
|---|---|---|---|
DA_Scout | Stealth (15–25) | Cunning (12–20) | Speed 8–15, Strength 5–10, Luck 5–15 |
DA_Hauler | Strength (15–25) | — | Speed 5–10, Stealth 5–10, Cunning 5–10, Luck 5–15 |
Values are tunable placeholders. Each DataAsset lives in Content/TrashNTreasure/Data/RaccoonTypes/.
Stat Display UI (UTNTRosterWidget)
Blueprint UMG widget toggled by hotkey (Tab). Functional readout, no styling:
- Scrollable list of raccoon cards
- Per card: Name, Type, all 5 stats (base / training / gear shown as layers, current total displayed), gear slot (empty or item name), current assignment (none), status
- Binds to
URaccoonSubsystem::OnRosterChangeddelegate to auto-refresh
Widget lives in Content/TrashNTreasure/UI/WBP_Roster.uasset.
Starter Raccoon
ATNTGameMode::BeginPlay calls:
URaccoonSubsystem::AddRaccoon(ERaccoonType::Scout)→ auto-named Scout
Player starts with a single Scout. First Hauler is a guaranteed reward from scouting the first house — tutorial-as-gameplay-progression rather than a freebie spawn.
Save/Load
UTNTSaveGame extending USaveGame:
UTNTSaveGame
TArray<FRaccoonData> Raccoons
FResourceLedger Ledger
TMap<EStationType, FStationRuntimeState> Stations
TArray<FActiveRaid> ActiveRaids
TMap<FName, FMilestoneProgress> Milestones
float GameClockTime // 0–1440 game-minutes, see Game Clock system
FActiveRaid includes phase state, travel/loot progress, backup crew, and encounter pending state — expanded in Block 4. On load, URaidSubsystem::LoadFromSave reconstructs raid state: respawns AI pawns for active raids and teleports them to interpolated positions based on saved TravelElapsed / LootProgress.
Each subsystem implements SerializeToSave(UTNTSaveGame*) and LoadFromSave(UTNTSaveGame*). Orchestrated by a save manager (can live on GameMode or a dedicated subsystem). Uses UGameplayStatics::SaveGameToSlot / LoadGameFromSlot. This block only serializes raccoons — other subsystems add their data in later blocks.
Done When
- Game starts with 1 named Scout visible in the roster UI (Tab to open)
- Player can see the raccoon’s name, type, and all 5 stats
-
GetEffectiveStatsreturns correct values (base + training for now — gear tested in Block 8) -
GetInheritedStatsreturns base + training (no gear component) -
GetRaccoonsByStatus(Idle)returns the starter - Raccoons persist through save/load cycle
-
OnRosterChangeddelegate fires and roster UI refreshes
References
Units MOC · Scout · Hauler · Raccoon Stats