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):

FunctionSignaturePurpose
AddRaccoonFGuid (ERaccoonType, FString Name="")Create FRaccoonData from URaccoonTypeDataAsset defaults (random within stat ranges). Generate name if empty. Add to TArray<FRaccoonData>. Broadcast OnRosterChanged.
RemoveRaccoonvoid (FGuid)Remove from array. Unassign from station if assigned. Broadcast. Used for desertion and capture.
GetRaccoonFRaccoonData (FGuid)Return copy for Blueprint. Internally return pointer.
GetAllRaccoonsTArray<FRaccoonData> ()Full roster for UI.
GetEffectiveStatsFStatBlock (FGuid)Base + Training + Gear. Sums FRaccoonData::BaseStats + TrainingBonus + resolved gear modifier from UDataTable. Clamped to 100 per stat. C++ because it iterates gear table.
GetInheritedStatsFStatBlock (FGuid)Base + Training (no gear). Used by breeding to determine parent contribution.
GetCrewStatSumFStatBlock (TArray<FGuid> Crew)Sum GetEffectiveStats across all crew members. C++ — iterates collection. Used by encounter resolution (Block 4).
SetStatusvoid (FGuid, ERaccoonStatus)Validate transition legality, update, broadcast OnRosterChanged.
GetRaccoonsByStatusTArray<FGuid> (ERaccoonStatus)Filter roster by status. C++ — iterates collection.
EquipGearbool (FGuid, FName GearRow)Set EquippedGearRowName. Returns false if raccoon not found or already equipped.
UnequipGearFName (FGuid)Clear gear slot, return row name for inventory.
GenerateNameFString ()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):

MemberTypePurpose
OnRosterChangedFOnRosterChanged (DYNAMIC_MULTICAST_DELEGATE)BlueprintAssignable. Broadcast on any roster mutation. UI binds to this
OnRaccoonAddedFOnRaccoonAdded (DYNAMIC_MULTICAST_DELEGATE_OneParam)BlueprintAssignable. Param: FGuid RaccoonId. Fired from AddRaccoon only. Used by UProgressionSubsystem to track recruitment milestones
GearTableUDataTable*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:

AssetPrimary StatSecondaryStarting Ranges
DA_ScoutStealth (15–25)Cunning (12–20)Speed 8–15, Strength 5–10, Luck 5–15
DA_HaulerStrength (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::OnRosterChanged delegate to auto-refresh

Widget lives in Content/TrashNTreasure/UI/WBP_Roster.uasset.

Starter Raccoon

ATNTGameMode::BeginPlay calls:

  1. 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
  • GetEffectiveStats returns correct values (base + training for now — gear tested in Block 8)
  • GetInheritedStats returns base + training (no gear component)
  • GetRaccoonsByStatus(Idle) returns the starter
  • Raccoons persist through save/load cycle
  • OnRosterChanged delegate fires and roster UI refreshes

References

Units MOC · Scout · Hauler · Raccoon Stats