Prisons and Levels
The Escapists 2 - Prisons and Levels system documentation
Overview
The Escapists 2 uses a layered floor-based prison system composed of tile grids, rooms, building blocks, facades, lighting, weather, cameras, and maps — all orchestrated by managers (singletons) that handle data loading, save/load, networking, and level editor operations. Prisons are defined by PrisonData (ScriptableObject) and PrisonConfig (ScriptableObject) and are built dynamically at runtime from building instructions stored in a serialised binary format.
1. Prison Definitions & Enums
LevelScript.cs (LevelScript)
- Class:
LevelScript : MonoBehaviour - Provides
GetInstance()singleton - Inner enums:
PRISON_ENUM — All built-in prison IDs
| Value | ID | Notes |
|---|---|---|
| 1 | Centre_Perks | Centre Perks 2.0 |
| 2 | OldWestFort | Rattlesnake Springs |
| 3 | POW_Camp | K.A.P.O.W Camp |
| 4 | Space_Prison | U.S.S Anomaly |
| 5 | Gulag_Prison | Fort Tundra |
| 6 | Oil_Rig | HMP Offshore |
| 7 | Transport_Train | Cougar Creek Railroad |
| 8 | Transport_Boat | HMS Orca |
| 9 | Transport_Plane | Air Force Con |
| 10 | Area_17 | Area 17 |
| 11 | Dictator | The Glorious Regime |
| 12 | GDC_Centre_Perks | A specialised version of Centre Perks 2.0 used within the Game Developers' Conference. |
| 13 | Tutorial | Precinct 17 |
| 14–18 | DLC02–DLC06 | DLC prisons |
| 99 | JamesTest | Debug |
| 100 | AITest | Debug |
| 1000 | ImportedPrison | Custom import |
| –1 | CustomPrison | Player-made |
| 0 | Unassigned | Default/unset |
PRISON_ENUM_MASK — Bitmask flags
| Flag | Value |
|---|---|
PlayerMade | 0x800 |
Tutorial | 0x1000 |
DLC | 0x40000 |
DLC02 | 0x10000 |
DLC03 | 0x20000 |
DLC04 | 0x80000 |
DLC05 | 0x100000 |
DLC06 | 0x200000 |
PRISON_TYPE — Prison category
Normal— Standard prisonTransport— Moving transport (train/boat/plane)Tutorial— Tutorial level
LEADERBOARD_PRISON_ENUM
m_LeaderboardPrisonFirstthroughm_LeaderboardPrisonLast(1..kMaxLeaderboardPrisons)
Other enums
GAME_STATE:NotPlaying=0, Playing, Escaped, OverePrisonEscapeMethod:UNASSIGNED, Key, PickedLock, CutFence, DrilledVent, DugTunnel, GenuineVisit, UseHelicopter, UseSpeedboat, Disguise, WalkOut, InmateLabour_Outside_CutFence, InmateLabour_Outside_DigChase, UseParachute, UseRocket, UseTeleporter, UsePortal, UseDragon, UseYetiESCAPE_TYPE:ESCAPE_INVALID, ESCAPE_VAN, ESCAPE_HELICOPTER, ESCAPE_SPEEDBOAT, ESCAPE_CUT_FENCE, ESCAPE_EXIT, ESCAPE_DIG_ESCAPE, ESCAPE_PARACHUTE, ESCAPE_ROCKET, ESCAPE_TELEPORTER, ESCAPE_PORTAL, ESCAPE_DRAGON, ESCAPE_YETITutorialState:OFF, Movment, Disguise, Escape, Guard, Contraband, Attribute, Routine, Checklist, CleanCHECKLIST_TYPE:CHECKLIST_MOVEMENT, CHECKLIST_DISGUISE, CHECKLIST_ESCAPE, CHECKLIST_GUARD, CHECKLIST_CONTRABAND, CHECKLIST_ATTRIBUTE, CHECKLIST_ROUTINE, CHECKLIST_CLEANTutorialItem:OFF, MOVEMENT_DISGUISE, DISGUISE_GUARD, ESCAPE_CONTRABAND, CONTRABAND_ATTRIBUTE, ATTRIBUTE_ROUTINE, ROUTINE_CLEAN, CLEAN_COMPLETE
PrisonData.cs (PrisonData)
- Class:
PrisonData : ScriptableObject [CreateAssetMenu]asset definitionLevelInfoinner class:m_PrisonEnum(PRISON_ENUM),m_PrisonType(PRISON_TYPE),m_AssociatedFile(scene name for built-in, save file path for custom)PrisonDifficultyenum:Invalid=-1, Easy, Medium, Hard, Count- Key fields:
m_NameLocalizationKey,m_DescriptionLocalizationKey— Localised name/descriptionm_ImagePath,m_PrisonSetupImagePath,m_ImageLockedPath,m_RoundResultsImagePathm_bIsDLC,m_DLCData— DLC ownershipm_bIsDebug— Debug-only prisonm_PrisonDifficulty— Difficulty ratingm_bAddRobinsonCharacter— Add extra Robinson NPCm_CustomisationOutfitCivilians,m_CustomisationBodyguardOutfit— Outfit configsm_StarterItems— Starting items for playerm_TotalJobs,m_JobSamples,m_TotalJobTime— Job configurationm_RoutineOverrides— Routine overridesm_SpawnedGuards— Custom guard placementm_MusicBank,m_AmbientBank,m_EffectsBank— Audio banks
PrisonConfig.cs (PrisonConfig)
- Class:
PrisonConfig : ScriptableObject ConfigTypeenum:Cooperative,Versus,Singleplayer- Contains:
GlobalCombatConfig— Combat settingsAIConfig— AI behaviourJobConfig— Job settingsCharacterConfig[]— Player, Inmate, Guard, RiotGuard, Dog configsItemContainerConfig— Desk/locker contentsRoutineConfig— Daily routinesOpinionConfig— NPC opinionsVendorConfig— Vendor/item shopQuestConfig— Quest systemMinigameConfig— Minigame settingsGeneralMinigameConfig— Global minigame configScoreSystemConfig— Scoring
- Versus duration:
m_VersusDays,m_VersusHours,m_VersusMinutes - Override lists:
m_ItemDataOverrides,m_AIEventOverrides,m_QuestOverrides
2. Level Data & Flow
LevelScript.cs (role)
- Stores
m_LevelSetup(level data),m_SubLevels(SubLevel[] with root Transform + scene name) - References: controllers, net views, dynamic objects, escape colliders
LevelDataManager.cs (LevelDataManager)
- Class:
LevelDataManager : MonoBehaviour - Singleton:
m_Instance PlaylistTypes:Campaign,Versus,External- Key fields:
PrisonData[] m_T17Levels— All built-in prisonsList<PlaylistData> m_CampaignPlaylists— Campaign playlistsList<PlaylistData> m_VersusPlaylists— Versus playlistsList<PlaylistData> m_CustomPlaylists— Custom playlistsm_ForceFirstPrison— Force first prison (debug/tutorial)m_Order[]— Playlist orderingm_CustomPrisonConfigs[3]— Custom config per game mode
LevelDetailsManager.cs (LevelDetailsManager)
-
Class:
LevelDetailsManager : MonoBehaviour -
LevelStateenum — Main state machine:State Description IdleDoing nothing CreateLevel_PendingLevel creation requested CreateLevel_LoadBuilderSceneLoading builder scene CreateLevel_FindManagersFinding manager references CreateLevel_CollectBuildInstructionsCollecting instructions (from disk/network) CreateLevel_ProcessBuildInstructionsProcessing instructions list CreateLevel_GenerateBuildingBlocksGenerating blocks from instructions CreateLevel_PlaySceneLoadLoading play scene LoadLevel_PendingLevel load requested LoadLevel_BuildBuilding level from instructions SaveLevel_PendingSave requested SaveLevel_FindManagersCollecting manager data for save SetUpLevel_CollectSetting up: collect data SetUpLevel_ProcessSetting up: process data MakeLevel_InitInitialise level creation MakeLevel_PendingLevel building pending LoadLevel_UpdateLevelUpdating level LoadLevel_UpdateRegenerateRegenerating level LoadLevel_ValidateZoneValidating zones SuccessCompleted successfully FailedFailed UNKNOWNUnknown/error state -
LevelEditorDataVersionenum:UNKNOWN,V1_InitialRelease,V2_AddedZoneEditing,ALL_VERSIONS -
LevelMode:Build,Play -
DiffecultyLevel:Easy,Medium,Hard,Random -
SerializationFlag(byte flags): File/Type/Version/Difficulty/Name/Description/Author headers, then per-manager flags (building blocks, routines, inmates, guards, items, rooms, alertness, power, weather, jobs, vendors, scores, quests, objectives, NPCs, visitors, solitary, guard towers, customisation, time) -
Uses
RequestResultdelegate for async callbacks -
Serialisation format: writes to
PrisonSnapshotIOvia byte stream
LevelFlow.cs (LevelFlow)
LevelFlow : BaseFlowBehaviour— empty/stub class
LevelBuilder.cs (LevelBuilder)
LevelBuilder : MonoBehaviour— stub class
BaseLevelManager.cs (BaseLevelManager)
-
Class:
BaseLevelManager : MonoBehaviour(abstract) -
LevelLayersenum:Layer Description UndergroundBelow ground (sewers, tunnels) GroundFloorMain prison floor GroundFloor_VentVent layer on ground floor FirstFloorUpper floor FirstFloor_VentVent layer on upper floor RoofRoof layer TOTALCount sentinel -
TilePropertyflags (int bitmask):Flag Bit Description Blocked_H 1 Blocked horizontally Blocked_V 2 Blocked vertically NoBlocking 4 Cannot be blocked WallInRoom 8 Wall belongs to a room Room 16 Tile is in a room Scanned 32 Visited in scan ScanBlocked 64 Blocked during scan Available 128 Tile is usable Helper constants:
Blocked = Blocked_H | Blocked_V,Blocked_All = All, multipleInverse*masks -
TileIDDatastruct:m_iID(tile index),m_iVariant(tile variant), with static masks (IDMask = 0xFFFF,VariantMask = 0xFFFF0000) -
InterestingLocationsclass:LocationTypeenum (NowhereSpecial,OutsideDoor),m_v2Position,m_iValue,m_Layer -
BuildingLayerDatanested class (per layer):m_Tiles— Ground tile system (Rotorz TileSystem)m_Walls— Wall tile systemm_TileProperties—TileProperty[14400](120×120 flags)m_ScratchTileProperties— Temporary copy for scanningm_NavGraph,m_PathGrid— Pathfindingm_VoxelMeshes,m_GroundTiles— Mesh datam_bRebuildNavGraph— Dirty flagm_SolidifyGroundTileID— Default ground tilem_LightsInLayer— Light objectsm_ObjectsOnLayer— Object listm_InBound,m_OutOfBound,m_BuildingBoundary— Boundary definitionsm_DoorsOnLayer,m_VentCoversOnLayer— Doors/ventsm_Voxels,m_iVoxelBoundsX/Y— Voxel gridRoomObjectCollectionType— Generic lookup for objects by type in a room
-
Abstract methods:
AddSingle(),RemoveSingle(),GetInstance(),IsEverythingSetUp() -
Handles voxel generation, pathfinding node creation per layer, tile flag manipulation
3. Prison State Managers
PrisonAlertness.cs (PrisonAlertness)
- Enum values:
Value Name 0 Stars_01 Stars_12 Stars_23 Stars_34 Stars_45 Stars_56 Lockdown
PrisonAlertnessManager.cs (PrisonAlertnessManager)
- Class:
PrisonAlertnessManager : MonoBehaviour, IDeserializable, Saveable, INetworkLoadable - Singleton:
m_Instance AlertnessReasonenum:UNASSIGNED, MissedRoutine, CharacterBound, NaughtyLocation, StandingOnDesk, Naked, HasContraband, Digging, Chipping, Cutting, Looting, CarryingObject, AttackingInmate, AttackingGuard, ContrabandOnFloor, ContrabandInContainer, DamagedTile, MissingTile, DugHole, Flooded, SearchingDesk, Escaping, Tardy, Disguised, ItemMissing, OutDuringLightsOut, FromMasterClientNetSaveData:short Alertness- Events:
AlertnessChangeddelegate - Key fields:
m_Alertness(current level),m_bLockdownActive,m_fLockdownTimer,m_fMorningRollCallReduction - Key methods:
IncreaseAlertness(int amount, AlertnessReason reason)— Raises alertness, triggers responsesDecreaseAlertness(int amount)— Lowers alertnessStartLockdown()— Activates lockdown, notifies AI/lightingEndLockdown()— Deactivates lockdownResetAlertness()— Resets to 0ReduceAlertnessForMorningRollCall()— Routine-based reductionGetAlertnessLocalisationKey()— Returns localisation key for current alertness
PrisonPowerManager.cs (PrisonPowerManager)
- Class:
PrisonPowerManager : MonoBehaviour - Singleton:
m_Instance GeneratorDataclass:m_GeneratorColour,m_Generator,m_ElectricFences(list)- Events:
PowerChangedHandlerdelegate - Key fields:
m_bPowerActive,m_GeneratorDataList - Key methods:
OnGeneratorStateChanged(Generator gen)— When a generator is disabled/enabled, updates fence stateIsPowerActive()— Returns overall power stateGetGeneratorsOnFloor(int floorIndex)— Per-floor generator lookup
PrisonCustomisationManager.cs (PrisonCustomisationManager)
- Class:
PrisonCustomisationManager : T17MonoBehaviour, Saveable, IDeserializable - Singleton:
m_Instance - Static fields:
m_NpcCustomisations,m_CustomisationSeed,m_NetNpcCustomisations,m_PrisonForCustomisation,m_bNpcCustomisationsInit,m_bUGCBlockEnforced - Custom byte array serialisation (Photon
RegisterType) - Handles seed-based NPC outfit/colour customisation, enforces UGC content blocks
PrisonSetupMenu.cs (PrisonSetupMenu)
- Class:
PrisonSetupMenu : FrontendMenuBehaviour, ICustomisableCharacters - Frontend UI for prison setup: game room type, password, customisation dialog, avatar grid
- Unlock panel:
ProgressMilestone+CriteriaDisplay - Handles centre perks popup, character customisation modification
PrisonAlterationSaveFixer.cs (PrisonAlterationSaveFixer)
- Class:
PrisonAlterationSaveFixer : MonoBehaviour - Singleton:
m_Instance - Fields:
m_InValidTiles(BoxCollider[] — tiles that are invalid),m_InValidRoom(RoomBlob[] — rooms that are invalid),m_SafeWayPoint RunAllChecks(): Repositions characters found inside invalid tiles or rooms to safe waypoints
PrisonEscapeCollider.cs (PrisonEscapeCollider)
- Class:
PrisonEscapeCollider : ColliderEvents - Fields:
m_EscapeCutscene(Cutscene),m_EscapeMethod(EscapeMethod enum) - On trigger, calls
EscapePrisonFunctionalityto trigger escape sequence - Uses cutscene if specified, otherwise generic escape
4. Room System
RoomBlob.cs (RoomBlob)
-
Class:
RoomBlob : T17MonoBehaviour— the core room class -
eLocationenum (world location types):Location Description NowhereSpecialDefault/unassigned CorridorHallways InmateCellPrison cells MealHallCafeteria GymExercise yard/gym RollCallAssembly area ShowerShower room LibraryLibrary SolitarySolitary confinement InfirmaryMedical bay InfirmaryStockRoomMedical storage JobOfficeJob assignment office ControlRoomGuard control room ContrabandRoomContraband checkpoint KitchenKitchen (job) KennelsDog kennels WardensOfficeWarden's office GuardQuartersGuard quarters SocialAreaSocial/common area MaintenanceMaintenance (job) JobRoomGeneric job room BuildingBoundaryEdge of building RoofAreaRoof access VisitorAreaVisitor centre CarParkCar park GuardRoomGuard room GuardTowerGuard tower WasteCollectionWaste disposal ShowTimeEntertainment stage CrowdSeatingAudience seating VisitorsCentreVisitor's centre -
RoomAffinityenum:SuperPopular=15, Interesting=8, Meh=5, Dull=2, UtterlyBoring=1 -
RoomSubIdentity_Location:Indoors,Outdoors -
RoomSubIdentity_Rules:Inbounds,OffLimits -
WaypointSortType:HeadsFirst,TailsFirst -
Key fields:
m_ID— Unique room identifierlocation—eLocationtypecolour— Room colour (visual)m_RoomAffinity— Inmate affinitym_RoomAffinityGuard,m_RoomAffinitySupport— Separate affinitiesm_InmateSafeSpace,m_GuardSafeSpace,m_SupportSafeSpace— Safety flagsm_AllowSniping— Allow sniping in this roomm_FloorMaterial— Footstep sound materialm_Waypoints—List<RoomWaypoint>m_InmateRoomObjects,m_GuardRoomObjects— Per-faction object listsm_InmateSpawnPoints— Spawn points for inmates
-
Key methods:
FindObject(InteractionType, bool bFreeTimeObjects, bool bReserve)— Find interactive objectGetBetterWaypoint(Vector3 pos)— Get nearest free waypointGenerateRoomMesh()— Create room visual meshGenerateAllWaypoints()— Create pathfinding waypoints from room shape
RoomBlobData.cs (RoomBlobData)
- Class:
RoomBlobData : T17MonoBehaviour(abstract) - Fields:
m_RoomSpecificObjects—List<InteractiveObject> - Abstract methods:
AutoSetup(),AutoSetupZone(),AutoSetupRoomBlob(),AutoSetupZoneBlob() - All room subtype classes inherit from this
RoomBlob Subtypes
| Class | Inherits | Key Fields | AutoSetup collects |
|---|---|---|---|
RoomBlob_Cell | RoomBlobData | m_SpawnPoints, m_Door | SpawnPoint, DeskInteraction, BedInteraction, ToiletInteraction, Door |
RoomBlob_ContrabandRoom | RoomBlobData | m_Desk | DeskInteraction |
RoomBlob_ControlRoom | RoomBlobData | Computer | GuardComputerInteraction, InteractiveObject |
RoomBlob_CrowdSeating | RoomBlobData | (none specific) | RoomWaypoint |
RoomBlob_GuardQuarters | RoomBlobData | m_Crates | GuardOutfitCrateInteraction |
RoomBlob_Gym | RoomBlobData | GymEquipment | GymInteraction |
RoomBlob_Infirmary | RoomBlobData | m_MedicBeds, m_Medics | MedicBedInteraction, AICharacter |
RoomBlob_JobOffice | RoomBlobData | (via BlockTagger) | BlockTagger (chairs/officers/desks) |
RoomBlob_JobRoom | RoomBlobData | m_JobType, m_Door, m_Dispensers, m_Processors, m_Collectors, m_CustomerWaitObject, m_JobBehaviour, m_JobTaunters, m_TutorialBoard | Multi-interaction |
RoomBlob_Kennel | RoomBlobData | m_Bed, m_SecondaryBeds | KennelInteraction, AICharacter_Dog |
RoomBlob_MealHall | RoomBlobData | Chairs, Tray | ChairInteraction, TrayInteraction |
RoomBlob_RollCall | RoomBlobData | (none specific) | RoomWaypoint, AICharacter_Guard |
RoomBlob_Shower | RoomBlobData | Showers | ShowerInteraction |
RoomBlob_ShowTime | RoomBlobData | m_PerformanceInteractions | (stub) |
RoomBlob_Solitary | RoomBlobData | m_Door, m_Bed, m_TaskObject, m_CharacterInSolitary | Door, BedInteraction, SolitaryPotatoesInteraction |
RoomFloor.cs (RoomFloor)
- Class:
RoomFloor : MonoBehaviour - Constants:
kFloorWidth = 121,kFloorHeight = 121,c_iRoomMaxSize = 16 - Fields:
m_Rooms—Dictionary<int, RoomBlob>(room ID → room)m_RoomTypeLookup—Dictionary<RoomBlob.eLocation, List<RoomBlob>>m_FloorMap—int[14641](121×121 array) storing room ID per tile (0 = no room)m_FloorWidth,m_FloorHeight,m_FloorIndexm_AssociatedNavGraph— ArrowTracer pathfinding graph
- Methods:
SetDims(int w, int h)— Resize floor mapAddRoom(RoomBlob room)— Register room, assign ID, update floor mapGetRoom(int id)— Get room by IDGetRoomList()— All rooms on this floorGetTileRoom(int x, int y)— Room at tileFloodFillForRoom()— Flood fill to detect room boundaries
RoomManager.cs (RoomManager)
- Class:
RoomManager : T17MonoBehaviour, INetworkLoadable, IDeserializable, Saveable - Singleton:
m_Instance - Fields:
m_Floors—List<RoomFloor>roomUtil(RoomUtility),nextRoomID,defaultWidth = 121,defaultHeight = 121m_InmateSpawnPoints,m_SpawnPointForCharacter,m_SpawnPointsKeyForRandom- Safe space arrays:
mInmateSafeStart,mInmateSafeEnd,mGuardSafeStart,mGuardSafeEnd,mSupportSafeStart,mSupportSafeEndper floor
- Methods:
GetSpawnPointForCharacter(Character c)— Assign spawn pointAssignInmateToRandomCell(InmateController ic)— Random cell assignmentGetInmateSafeCell()/GetGuardSafeRoom()— Safe room lookupFindContrabandDesk()— Contraband desk lookup
- Inner
SaveData:v(int[]) ands(int[]) — version and serialised data
RoomMarker.cs (RoomMarker)
- Class:
RoomMarker : MonoBehaviour MarkerTypeenum:Normal,Escape,RollCall,Interactive,KeepClearSpot,BlockEscape
RoomWaypoint.cs (RoomWaypoint)
- Class:
RoomWaypoint : MonoBehaviour - Fields:
m_ChildToRemove,m_FacingDirection(Direction:Up,Down,Left,Right),m_WaypointSide,m_Reservation(Character ref),m_bReservable GetPosition()— Returns cached Transform.position
RoomLabel.cs (RoomLabel)
- Enum:
None,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,COUNT
RoomInteraction.cs (RoomInteraction)
- Class:
RoomInteraction : ActionTask<AICharacter>(NodeCanvas action task) - Parameters:
m_InteractionType,m_RoomLocation,m_bFreeTimeObjects,m_bReserve,m_fMinRunDistance,m_fMaxRunDistance - Agent finds object via
FindObject()on RoomBlob, moves to it, performs interaction - Uses
NetObjectLockfor network synchronisation
RoomFilterButtonToggle.cs
- UI toggle for filtering room types in editor/views
RoomMeshGenerator.cs
- Generates mesh geometry for rooms (walls, floors)
RoomOcclusionMesh.cs
- Occlusion culling meshes for room visibility
RoomProcessingTool.cs
- Editor tool for processing room data
RoomUtility.cs
- Utility/helper methods for room operations
5. Floor System
FloorManager.cs (FloorManager)
- Class:
FloorManager : T17MonoBehaviour, IDeserializable, INetworkLoadable, Saveable FLOOR_TYPEenum:Floor_Roof,Floor_Vent,Floor_Prison,Floor_UnderGroundTileSystem_Typeenum:TileSystem_Ground,TileSystem_Wall,TileSystem_GroundPlops,TileSystem_ObjectPlops,TileSystem_Lights,TileSystem_WallPlopsFloornested class:m_FloorName,m_FloorType,m_zPos,m_FloorIndex,m_bIsStartFloorm_FloorRootObject(Transform root)m_TileSystems[](Rotorz TileSystem per type)m_RoomFloor(RoomFloor ref)m_bLocked(locked/unlocked)m_MapTexture(Texture2D for minimap)m_FloorUINumber(display index)- Key fields:
m_Floors—List<Floor>m_FloorCount— typically 5 (Underground, Ground, Ground Vent, First, Roof)m_DefaultWidth = 120,m_DefaultHeight = 120Tile alias dictionaries for block ID ↔ tile ID mapping - Methods:
CreateFloor(FloorType, string, int zPos)— Creates a new floorFindFloorByIndex(int idx)— Lookup by indexFindFloorAtZ(float z)— Lookup by Z positionGetTileGridPoint(Vector3 worldPos)— World → tile coordsAddVentCover(VentCover cvr)— Register vent coverLoadFloorFromSave(byte[] data)— Deserialise floorGenerateAllFloorMeshes()— Rebuild visual meshes
FacadesManager.cs (FacadesManager)
- Class:
FacadesManager : MonoBehaviour - Singleton:
m_Instance - Fields:
m_FacadeFloors—List<FacadeFloor>,defaultWidth = 120,defaultHeight = 120 Init()— Loads/creates facade floors, matching FloorManager floors
FacadeFloor.cs (FacadeFloor)
- Class:
FacadeFloor : MonoBehaviour - Constants:
kFloorWidth = 120,kFloorHeight = 120 - Fields:
m_FloorMap—int[14400](120×120), stores facade tile IDs - Indexer:
FloorMap[x, y]get/set
ZoneDetailsManager.cs (ZoneDetailsManager)
- Class:
ZoneDetailsManager : MonoBehaviour ZoneTypesenum:INVALID, InmateCell, MealHall, Gym, RollCall, Shower, Library, Solitary, Infirmary, JobOffice, ControlRoom, ContrabandRoom, Kitchen, Kennels, WardensOffice, GuardQuarters, Maintenance, GuardRoom, SocialArea, JobRoom, Generators, Job_Woodwork, Job_Blacksmith, TOTALLimitationType:FixedSize,FromBlockGroupMustBeReachableBy:Player,AnyoneZoneDetailsclass: Zone definition with size constraints, required block groups, light rules, reachabilityLayerLightclass: Light rules per layer (AboveBlockGroup,DistanceFromStuff,LightObject,BlockGroup, nearest allowed distances)ZoneLimitations: Validation rules per zone type
CullingBuckets.cs
- Organises objects into spatial buckets for efficient culling
CullingObjectCollector.cs
- Collects objects that should be culled
CullingForceFloor.cs
- Forces a specific floor to remain visible (not culled)
6. Destructibles & Vents
DamagableTile.cs (DamagableTile)
- Class:
DamagableTile : T17MonoBehaviour, ISaveableTileComponent DamageActionenum:Dig,Chip,Cut,Unscrew,Hole- Fields:
m_DamageAction— How this tile is damagedm_LimitDamageToItems[]— Items that can damage this tilem_LimitCoverToItems[]— Items that can cover this tilem_InitialHealth— HP (default –1)m_StayVisible— Stay visible when destroyedm_AllowRandomRock— Spawn rocks when damagedm_Materials[]— Damage stage materialsm_ReclaimedItem— Item gained when reclaimedm_Renderer,m_Collider,m_filter— Visual/collisionm_Health— Current HPm_ElectricFence— Linked fencem_HoldingItemViewID,m_HoldingItemName— Held item (cover)m_ItemCover— Cover objectm_DamageStage— Current visual stage (0–3+)m_DestroyedBy— Character who destroyed itm_TileRow,m_TileColumn— Tile positionm_GroundTileUnder— Ground tile beneathm_PinID— Map pinm_DiggableNeighbours,m_ChippableNeighbours,m_IndestructableNeighbours— Adjacent tiles
- Neighbour offsets: 8-directional array
[−1,−1]..[1,1] - Health threshold triggers: damage stages at HP thresholds
- On destroy: propagates to neighbours, updates pathfinding, drops items
DamagableTileLink.cs (DamagableTileLink)
- Links damagable tiles together for damage propagation
IndestructibleTile.cs (IndestructibleTile)
- Tile that cannot be damaged/destroyed
PreventTileDamage.cs (PreventTileDamage)
- Component that prevents damage to tiles in its range
VentCover.cs (VentCover)
- Class:
VentCover : MonoBehaviour CoverTypeenum:Vent,Sewer- Fields:
m_TileRow,m_TileColumn,m_TileFloor,DamagableTileref, light child - On health changed → can break open → different behaviour depending on cover type (vent vs sewer)
VentRepresentation.cs (VentRepresentation)
- Class:
VentRepresentation : BaseLevelEditorKeepers - Instantiates visual prefab on the walls layer to represent vent locations
Setup()returnsAfterSetup.Disable
7. Building Blocks
BuildingBlockManager.cs (BuildingBlockManager)
- Class:
BuildingBlockManager : MonoBehaviour - Singleton:
m_Instance LimitationGroupinner class:m_Perminent,m_TextResourceName,m_GroupName,m_Min,m_Max,m_Valid,m_ErrorResourceID,m_Hashcode,m_Routine,m_AutoMinimums,m_ZoneType,m_ErrorID,m_CurrentTotalHasMetRequirements()/IsWithinLimits()— Validation
DefaultLimitationGroupsenum:InmateCell, MealHall, Gym, RollCall, Shower, Library, Solitary, Infirmary, JobOffice, ControlRoom, ContrabandRoom, Kitchen, Kennels, WardensOffice, GuardQuarters, Maintenance, Visitor, GuardTower, WasteCollection, GuardRoom, Inmate, Guard, InfirmaryStockRoom, SocialArea, JobRoom, Generators, Job_Woodwork, Job_Shoemaker, Job_Blacksmith, Job_Mining, Job_Plumbing, Job_Electrician, Job_Kitchen, Job_Farming, Job_WasteDisposal, Job_MailSorting, Job_CanineCarer, Job_Painting, Job_PumpkinCarving, Job_VampireLaundry, Job_TrickOrTreat, TOTALDashedBorderEnumflags: L, R, T, B and composite (TL, TR, etc.) plus inverse valuesFamilyTypes: Active flag, FamilyName, OrderBlockThemeData: BlockSet, TextResourceTitle, SpriteDefaultBlocksstruct: Inside/outside default block IDs per floor- Fields:
m_BuildingBlocks[]— All building blocks (indexed by ID)m_LimitationGroups[]— Limitation groupsm_DashLines_Materials[16]— Dash line border materials (3 sets)m_FamilyTypes[63]— Family type configsm_BlockThemeData— Theme data listm_DefaultTileBlock[6]— Default inside/outside tiles per layerm_MaterialPaths,m_DoubleHeightMaterialPaths,m_BlockIconPaths,m_ZoneIconPaths,m_StampPaths,m_PrefabPaths— Resource pathsm_DefaultRoutines[24]— Default routines- Audio banks:
m_MusicBank,m_AmbientBank,m_EffectsBank
- Methods:
RebuildData()— Re-indexes all building blocks in childrenAddBlockTheme()/RemoveBlockTheme()GetBlock(int id)— Get block by IDGetLimitationGroup(int id)— Get group by index
BaseBuildingBlock.cs (BaseBuildingBlock)
- Class:
BaseBuildingBlock : MonoBehaviour(abstract) BuildingBlockTypeenum:UNKNOWN, Tile, Wall, Decoration, Object, Complex, Room, TOTALBuildingBlockDrawingModeenum:INVALID, Stamp, Paint, Marquee, MarqueeLine, TOTALCompletionStateenum:Complete, Nearly_Complete, Unfinished, TOTALBlockSetflags:CentrePerks(1), CougarCreek(2), RattleSnake(4), POW(8), HMSOrca(0x10), HMPOffshore(0x20), FortTundra(0x40), Area17(0x80), AirForceCon(0x100), USSAnomaly(0x200), GloriousRegime(0x400), WickedWard(0x800), SantasShakedown(0x1000)PurposeGroupsflags: General, RollCall, InmateCell, SocialArea, Library, Gym, Showers, Kitchen, MealHall, GuardQuarters, GuardRoom, ControlRoom, ContrabandRoom, WardensOffice, Kennels, Solitary, Infirmary, Maintenance, JobOffice, Job_Woodwork, Job_Blacksmith, EscapeGroupFlags: 32 group flags with inverse masks
BuildingBlock Subtypes
| Class | BlockType | Description |
|---|---|---|
BuildingBlock_Complex | Complex | Multi-block composite |
BuildingBlock_Decoration | Decoration | Visual-only decoration |
BuildingBlock_Object | Object | Interactive object block |
BuildingBlock_Room | Room | Room-defining block |
BuildingBlock_Single | Tile | Single tile placement |
BuildingBlock_Tile | Tile | Tile with variants |
BuildingBlock_TMS | Tile | Tile Management System tile |
BuildingBlock_UIButton | — | Editor palette button |
BuildingBlock_Wall | Wall | Wall block |
BuildingBlock_UIButton.cs
- Stores
m_BlockIDreference for palette UI
BuildingBlock_FilterManager.cs
- Filters available blocks by context (block set, purpose, groups)
BuildingBlockHelper.cs
- Utility methods for building block operations
BuildingBlockGroupManager.cs
- Manages groups of building blocks (used for zone requirement validation)
BaseBuildInstruction.cs (BaseBuildInstruction)
- Class:
BaseBuildInstruction(Serializable) InstructionTypeEnum:UNKNOWN, Draw_Once, Draw_Area, Complex, ChangeLayer, ChangeEnvironment, Command, Draw_OnceWall, Draw_AreaWall, Delete, PreventUndo, IncrementLayer, DecrementLayer, Zone- Fields:
m_Type,m_BuildingBrickID,m_XPosition,m_YPosition,m_iRandomSeed,m_XCount,m_YCount,m_Layer,m_bInside,m_ZonePrint - Factory methods:
CreateOnce(sbyte x, sbyte y, int blockID, int seed)— Single tileCreateOnceWall(sbyte x, sbyte y, int blockID, int seed)— Single wallCreateArea(sbyte x, sbyte y, sbyte w, sbyte h, int blockID, int seed)— Area fillCreateAreaWall(...)— Area wall fillCreateZone(ZoneTypes, x, y, w, h, zonePrint, id)— Zone definitionDeleteZone(sbyte x, sbyte y)— Zone deletionCreateLayerChange(LevelLayers layer)— Layer switchCreateChangeEnvironment(bool inside)— Inside/outside toggleIncrementLayer()/DecrementLayer()— Layer offset
BuildingInstructionManager.cs (BuildingInstructionManager)
-
Class:
BuildingInstructionManager : MonoBehaviour -
Instruction data containers (all serialisable with marker bytes):
Container Marker Content InstructionList202/102 Ordered list of (InstructionTypeEnum, index)pairsInstruction_Complex203/102 Complex instructions with sub-instructions Instruction_Once204/102 Single tile placements: (blockID, x, y, seed)Instruction_OnceWall205/102 Single wall placements: (blockID, x, y, seed)Instruction_Area206/102 Area fill: (blockID, x, y, seed, xCount, yCount)Instruction_AreaWall207/102 Area wall fill Instruction_Delete208/102 Delete instructions Instruction_Environment209/102 Environment change Instruction_Zones210/102 Zone definitions Each has
SerializeOurData(ref List<byte>)/DeserializeOurData(ref List<byte>, ref int)with marker byte envelopes -
InstructionOnceElement:m_BuildingBlockID,m_XPosition,m_YPosition,m_iRandomSeed,m_Previous(for undo) -
InstructionAreaElement: Same as Once +m_XCount,m_YCount,m_Previous[] -
InstructionComplexElement:m_BuildingBlockID+m_ComplexInstructions(InstructionList)
BuildingInstructionManagerV2.cs
- Updated/refactored version of the instruction pipeline
EditorLevelEditorManager.cs (EditorLevelEditorManager : BaseLevelManager)
- Editor-time level manager
- Overrides
AddSingle()andRemoveSingle()to place/remove tiles, decorations, objects, and walls - Tracks
m_DeleteingRoomflag IsEverythingSetUp()checks all 6 layers for tile, wall, and object data
EditorLevelEditorManagerV2.cs
- Updated version of editor level manager
EditorFlowInterface.cs
- Interface for editor flow control
8. Level Editor
LevelEditor_Controller.cs (LevelEditor_Controller)
- Class:
LevelEditor_Controller : MonoBehaviour - Singleton:
m_Instance EditModeenum (state machine):INVALID, NoBrush, BlockSelected, FreeDrawing, Marquee, MarqueeLine, Deleting, MovingCamera, SelectingObjectInLevel, SelectedObjectInLevel, MovingBlock, CopyMarquee, CopyMarqueeAdd, CopyMarqueeDelete, CopySelectedObjectInLevel, CopySelectedObjectInLevel_Edit, Zone_WaitingToCreate, Zone_Creating, Zone_Selected, Zone_Editing, Zone_Adding, Zone_DeletingDrawingStatus:Nothing, Painting, MarqueeCopyEnumflags:Empty, Marked, MarkedRoom1..4, Scanned, ScannedRoom1..4+ compositesScanBitsflags:EMPTY, OCCUPIED, SCANISLAND, SCANHOLE, ADDEDAudioTypes: Ambient, floor change, delete, marquee, place, zoom, redo/undo, error, tab, save- Key fields:
- References:
m_LevelManager,m_InstructionManager,m_BlockManager,m_BrushController,m_UIController,m_HighlightManager,m_LevelDetailsMan,m_ZoneManager,m_Cursor m_MainCamera,m_Mouse,m_Player(Rewired)m_PreviewTexture,m_ValidPreviewTexturem_EditMode,m_PreviousEditModem_CurrentBlock,m_CurrentVariation,m_NumberOfVariationsm_CopyArea[14400],m_CopyAreaFlags[14400]- Camera:
m_fOrthographicSize, zoom levels, pan speed, edge distance m_Brush,m_BrushVisibility,m_BrushOffset- Marquee: position, size, audio timeout, resource
- Zone editing:
m_CurrentZone,m_OverZone,m_ZoneToCreate,m_BadZone - Undo/redo:
m_UndoButton,m_RedoButton,m_bCanUndo,m_bCanRedo - Snapshot:
m_SnapshotDelegate,m_SnapshotActionDelegate,m_TriggerSnapshot
- References:
- Methods (extensive): brush management, marquee operations, zone creation, camera control, undo/redo, copy/paste, audio, snapshot, validation
LevelEditor_UIController.cs (LevelEditor_UIController)
- Editor UI management: tabs, palettes, toolbars
LevelEditor_ZoneManager.cs (LevelEditor_ZoneManager : MonoBehaviour)
-
Singleton:
m_Instance -
Zonenested class:m_bActive,m_bValid,m_bReachablem_ZoneType,m_ZoneDetails,m_IDm_IconPosition,m_Bottom,m_Left,m_Width,m_Heightm_ZonePrint(byte[] — bitmask of tiles in zone, 1 bit per tile)m_Layer,m_TotalTiles,m_TotalIgnoredTilesm_strErrors,m_RequiresUpdate,m_RequiresZonePrintUpdatem_BlocksInZone(List),m_Required,m_RequirementsMetm_AllocatedRoomID,m_ZoneGraphic,m_ZoneIcon- Methods:
IsFullyValid(),IsGameObjectInZone(),GetMap(),GetRequireDataForBlockGroup()
-
ObjectsInZone:m_X,m_Y,m_BlockID,m_Object,m_ComplexID,m_InteractPoints,m_BeingBlocked,m_OnlyPartiallyIn -
StillRequired:m_BlockGroupIndex,m_Minimum,m_Maximum,m_CurrentTotal,m_Error -
Errors:m_StrError,m_BlockSetIndex -
ZoneMap:int[14400]— maps tiles to zone ID -
ZonesInAreaenum:JustOurs, Nothing, Others, OursAndOthers -
Key fields:
m_Zones[],m_TotalZonesInUse,m_BlockGroupManagerm_ZoneMap[6]— Per-layer zone maps- Prefabs:
m_ZoneIconPrefab,m_ZoneMarqueePrefab,m_FlashingErrorMarqueePrefab,m_SolidErrorMarqueePrefab
-
Methods:
AddZone(ZoneTypes, x, y, w, h, byte[] zonePrint)— Create new zoneRemoveZone(int id)— Delete zoneValidateZone(int id)— Check requirements/validityValidateAllZones()— Full validation passUpdateZonePrint(int id)— Rebuild zone bitmapGetZonesForLayer(LevelLayers layer)— Per-layer zone list
LevelEditor_ZoneManager.Zone validation flow:
- Zone print is updated (converts tile positions to bitmask)
- Zone is validated: checks block group requirements, size, reachability
- Results cached in
m_Required/m_RequirementsMet - UI updates via zone cards
LevelEditor_Settings.cs (LevelEditor_Settings)
- Editor configuration/settings
LevelEditor_PrisonSettingsDialog.cs
- UI dialog for prison settings (name, description, difficulty, etc.)
LevelEditor_PrisonCheckerDialog.cs
- Validation dialog that checks prison completeness
Additional LevelEditor Components
| File | Class | Purpose |
|---|---|---|
LevelEditor_BaseTab.cs | LevelEditor_BaseTab | Base class for editor tabs |
LevelEditor_BlockSection.cs | LevelEditor_BlockSection | Block category UI section |
LevelEditor_ButtonToolTip.cs | LevelEditor_ButtonToolTip | Tooltip component |
LevelEditor_ButtonWithToolTip.cs | LevelEditor_ButtonWithToolTip | Button with tooltip |
LevelEditor_CheckList.cs | LevelEditor_CheckList | Check list widget |
LevelEditor_CheckList_Entry.cs | LevelEditor_CheckList_Entry | Check list item |
LevelEditor_CreateTooltip.cs | LevelEditor_CreateTooltip | Tooltip factory |
LevelEditor_Cursor.cs | LevelEditor_Cursor | Editor cursor visual |
LevelEditor_ErrorList.cs | LevelEditor_ErrorList | Error list panel |
LevelEditor_FilterButton.cs | LevelEditor_FilterButton | Filter toggle |
LevelEditor_FlashingMarquee.cs | LevelEditor_FlashingMarquee | Flashing selection marquee |
LevelEditor_GridCellPopulator.cs | LevelEditor_GridCellPopulator | Grid cell filler |
LevelEditor_InvalidZoneCard.cs | LevelEditor_InvalidZoneCard | Invalid zone display |
LevelEditor_Marquee.cs | LevelEditor_Marquee | Marquee selection |
LevelEditor_RequirementsPopulator.cs | LevelEditor_RequirementsPopulator | Zone requirements display |
LevelEditor_RoutineEntry.cs | LevelEditor_RoutineEntry | Routine entry UI |
LevelEditor_SavingIcon.cs | LevelEditor_SavingIcon | Saving indicator |
LevelEditor_ToolTip.cs | LevelEditor_ToolTip | General tooltip |
LevelEditor_UIRequirement.cs | LevelEditor_UIRequirement | UI requirement display |
LevelEditor_ValidZoneCard.cs | LevelEditor_ValidZoneCard | Valid zone card |
LevelEditor_ZoneCard.cs | LevelEditor_ZoneCard | Zone card base |
LevelEditor_ZoneCardNoneSelected.cs | LevelEditor_ZoneCardNoneSelected | None-selected card |
LevelEditor_ZoneControl.cs | LevelEditor_ZoneControl | Zone control widget |
LevelEditor_ZoneCreateButton.cs | LevelEditor_ZoneCreateButton | Create zone button |
LevelEditor_ZoneIconControl.cs | LevelEditor_ZoneIconControl | Zone icon display |
LevelEditor_ZoneInvalidIndicator.cs | LevelEditor_ZoneInvalidIndicator | Invalid zone indicator |
LevelEditor_ZoneTab.cs | LevelEditor_ZoneTab | Zone tab UI |
LevelEditor_ZoneWarning.cs | LevelEditor_ZoneWarning | Zone warning display |
LevelEditorBorderElement.cs | LevelEditorBorderElement | Border visual |
LevelEditorBrushController.cs | LevelEditorBrushController | Brush controller |
LevelEditorBrushElement.cs | LevelEditorBrushElement | Brush element visual |
LevelEditorHighLightManager.cs | LevelEditorHighLightManager | Highlight management |
LevelEditorQuantizer.cs | LevelEditorQuantizer | Grid snapping |
LevelEditorTileHighlight.cs | LevelEditorTileHighlight | Tile highlight visual |
LevelEditorUISetup.cs | LevelEditorUISetup | UI initialisation |
LevelEditor_AutoScale.cs | LevelEditor_AutoScale | Auto-scaling |
9. Lighting
LightingManager.cs (LightingManager)
- Class:
LightingManager : T17MonoBehaviour, IControlledUpdate, ISerializationCallbackReceiver LightGroupinner class:m_Name,m_ID,m_Lights(List),m_Effects(List)TimeOnOff:m_StartHour/Minutes,m_EndHour/Minutes,m_bAlwaysOn, computedStartInMinutes/EndInMinutesSerializedLightEffect:effectType(int),data(string)— for serialisationm_Times(List) — Multiple on/off schedulesm_ChangedMinutes— Accumulated time changeIsActive,Init(),Update(float timeInMinutes)
- Fields:
m_LightGroups—List<LightGroup>- Serialisation callbacks for custom data
ControlledUpdate— Frame-rate independent update
LightControl.cs (LightControl)
- Controls individual light state: on/off, dimming, colour
LightEffect.cs (LightEffect)
- Class:
LightEffect— abstract base for light effects
LightEffect Subtypes
| Class | Description |
|---|---|
LightEffect_Lockdown | Red/alert lighting during lockdown |
LightEffect_LockdownFadeOut | Fade-to-black during lockdown |
LightEffect_Party | Coloured/celebratory lighting |
LightEffect_ShowTime | Stage/performance lighting |
CustomLight.cs / CustomLightManager.cs / CustomLightRenderer.cs
- Custom light entities with their own rendering pipeline
- Manager handles lifecycle and updates
LightOcclusionManager.cs / LightOcclusionRenderer.cs
- Light occlusion system: manages and renders occlusion geometry for light sources
- Prevents light from passing through walls
10. Weather
WeatherEffectManager.cs (WeatherEffectManager)
- Class:
WeatherEffectManager : MonoBehaviour - Singleton:
m_Instance - Constants:
kMaxFullscreenWeatherEffects = 5 - Fields:
m_TiledFullScreenWeatherEffects[5]— Active weather effectsm_PlayerCameras[4]— Player camera refsm_WeatherRendererPrefab— Prefab for weather visualm_WeatherRenders[4]— Spawned weather renderers per camera
- Methods:
Enable()/Disable()— Global toggleCleanUpWeatherAssets()— Destroy renderers, stop audioStart()— Spawn weather renderers for each camera
WeatherEffectData.cs (WeatherEffectData)
- Weather effect configuration data
WeatherRenderer.cs (WeatherRenderer)
- Renders weather particles/effects for a camera
WeatherObjectRenderer.cs (WeatherObjectRenderer)
- Class:
WeatherObjectRenderer : MonoBehaviour m_ParentCam— Camera reference- Renders weather effects on scene objects (rain on surfaces, etc.)
11. Cameras
CameraManager.cs (CameraManager)
- Class:
CameraManager : MonoBehaviour, IControlledUpdate CameraOpModesenum:Unassigned, Game, CutscenePlayerBindingIDenum:CM_PBID_UNSET=0, CM_PBID_PLAYER_ALPHA=1, CM_PBID_PLAYER_BETA=2, CM_PBID_PLAYER_GAMMA=3, CM_PBID_PLAYER_DELTA=4, CM_PBID_WORLD_CAM_TOGGLE=666, CM_PBID_WORLD_CAM_VISIBLE=999CameraBindinginner class:m_PlayerBinding,m_Camera,m_Character(bound character)m_TargetPosition,m_NewTargetPositionm_ListenerIndex,m_CameraIDm_MaxCameraPos,m_MinCameraPos— Boundsm_NormalizedViewportHeight— Split-screen height factorm_CameraView— CameraView componentm_CullerUpdateMode— Culling modem_CharacterStencilRenderer,m_Blur,m_CombatHitShakem_OverscanCamera,m_CameraPreCuller- Events:
OnBoundCharacterAttacked→ shake
- Delegates:
CameraManagerHandler,CameraManagerModeChangeHandler,ManagerCreationHandler,CameraViewChangedHandler - Key fields:
m_CameraBindings[4]— Up to 4 player camerasm_OpMode— Current operation modem_CachedTrackableObject— Cutscene trackingm_FollowDeadZone,m_Smooth— Camera follow parametersm_ZOffsetsFromPlayer— Z-depth per playerm_SplitThreshold— Distance to trigger split-screenm_bAlwaysSplit— Force split-screenm_MapBoundsBR,m_MapBoundsTL— Camera boundsm_bShowFacade— Facade visibilitym_CombatHitShakeIntensity/Duration— Shake on damagem_BlurEffectEnabled/Allowed— Blur controlm_FixedCameraViewportRects— Pre-defined viewport layouts for 1–4 players
- Methods (1875 lines): Camera creation, binding, split-screen layout, shake effects, cutscene transitions, controlled update loop
CameraView.cs (CameraView)
- Camera view configuration component
CompositePlayerCameras.cs (CompositePlayerCameras)
- Handles split-screen / composite camera setup for multiple players
- Manages viewport rectangles for 1–4 player layouts
12. Map System
MainMap.cs (MainMap)
- Class:
MainMap : MonoBehaviour - Fields:
m_ActiveRawImage,m_BGRawImage— Map texturesm_UnderImages[]— Underground layer imagesm_InitBGWidth/Height= 50 — Background dimensionsm_MaxMapZoom = 8f,m_MinMapZoom = 1f,m_MapZoom = 4fm_StepScale = 120f,m_mapMovementSpeed = 20f,m_mapZoomSpeed = 2fm_FloorMan,m_Floor— Floor manager refsm_PinMan— Pin managerm_IconPool— Object pool for map iconsm_ActiveFilterType— Current pin filterm_MapViewScale,m_ScaleOfIconsm_FilterHeader,m_Filter,m_KeyRoot— Filter UIm_ToolTip,m_MouseToolTip— Tooltip componentsFloorButtons[]— Floor selection buttons- Layer objects:
m_PlayerLayerObject,m_CharacterLayerObject,m_ShopLayerObject,m_FavoursLayerObject,m_ObjectiveLayerObject,m_TagLayerObject m_FloorIconPos16x16,m_FloorIconPos32x32— Icon positions per screen size
MainMapKeyFilter.cs (MainMapKeyFilter)
- Filter key/toggle for main map display layers
MainMapMenu.cs (MainMapMenu)
- Menu overlay on the main map screen
MiniMap.cs (MiniMap)
- Class:
MiniMap : MonoBehaviour - Fields:
m_Target— Follow target transformm_player— Player referencemapTexture— T17RawImage for texture displaym_MapZoom = 4f,m_ScaleOfIconsm_FloorMan,m_LastFloor— Floor trackingm_PinMan,m_IconPool— Pin/icon managementm_FloorIconPos16x16/32x32- Layer objects: player, character, shop, favours, objective, tag
m_ImageAspectRatio
MapItemTracker.cs (MapItemTracker)
- Tracks items on the map (dynamic item markers)
MapPinComponent.cs (MapPinComponent)
- Class:
MapPinComponent— Map pin marker component
MapTextureInfo.cs (MapTextureInfo)
- Texture data/info for map rendering
MapToolTip.cs (MapToolTip)
- Tooltip displayed on map hover
PinManager.cs (PinManager)
- Class:
PinManager : T17MonoBehaviour Pininner class:PinFilterTypeenum:All, Characters, Shops, Favours, Objectives, Tags, CountPlayerIcons:m_MainMapIcon,m_MiniMapIcon, icon pool refsm_Target(GameObject),m_TargetCharacterm_Floor,m_IconSprite,m_MapPos,m_UpdatePositionm_Edgable,m_FloorTrackable,m_Directional,m_Animatedm_SpriteAnimation,m_PinID,m_bOverrideIconScalem_IconMapWorldPositionOffset,m_FilterTypem_PlayerIcons(Dictionary<int, PlayerIcons>),m_ToolTipTagm_LocaliseToolTipTag,m_bForAll,m_bIsPlayer,m_PlayerIDToIgnore
IconPriority:m_Type,m_SortingOrder- Methods: Create/remove pins, update positions, filter management
UndergroundMaterialMapper.cs (UndergroundMaterialMapper)
- Maps underground materials for minimap rendering
13. Transitions & Spawns
TransitionPoint.cs (TransitionPoint)
- Class:
TransitionPoint : MonoBehaviour - Static:
s_TransitionPointList— All transition points - Fields:
m_Partner(GameObject),m_AINodeLink(NodeLink for pathfinding),m_TransitionPosition - Methods:
FindClosest(Vector3 pos)— Static: find nearest transition- OnTriggerEnter — Teleports character to partner (cross-floor movement)
m_bExitNode— True if no partner (path endpoint)
TransitionExitPoint.cs (TransitionExitPoint)
- Marks the exit destination of a transition
SpawnPoint.cs (SpawnPoint)
- Class:
SpawnPoint : MonoBehaviour - Fields:
m_StartingItems—List<ItemData>for initial inventorym_AttachedDesk,m_AttachedBed,m_AttachedToilet,m_AttachedCalendarm_SpawnPointID,m_CharacterToAddTo,m_RoomBlob
- Methods:
SetCharacterOwner(Character c)— Wire up attached objects to characterAddStartingItems()— Give items to character via ItemManager
14. Generator System
Generator.cs (Generator)
- Class:
Generator : T17MonoBehaviour, INetworkLoadable, Saveable - Fields:
m_NetView,m_Animator,m_Particles,m_Disabled,m_Switch(GeneratorInteraction),m_InactiveTime = 30f - Methods:
GeneratorActive()— Returns true if not disabled and timer ≤ 0DisableGenerator()— Sets disabled flag, starts recharge timer, notifiesPrisonPowerManager
GeneratorInteraction.cs (GeneratorInteraction)
- Class:
GeneratorInteraction : AnimatedInteraction - Fields: Linked
Generator - On interaction: calls
m_Generator.DisableGenerator() - Methods:
SetGenerator(),SetState()(animator parameter)
15. Culling System
CullingBuckets.cs (CullingBuckets)
- Organises objects into spatial buckets for efficient frustum/occlusion culling
CullingObjectCollector.cs (CullingObjectCollector)
- Collects cullable objects from the scene
CullingForceFloor.cs (CullingForceFloor)
- Forces a specific floor to be visible (ignores culling)
16. Save/Load System
SaveManager.cs (SaveManager)
- Class:
SaveManager : T17MonoBehaviour PrisonsSaveInformationnested class:PrisonData: per-prison save infom_strPrisonName,m_strPrisonFileNamePrisonTypeenum:eDefault,eCustomLevel,eUGCLevelm_bNeedsSaving,m_iContinueSlotm_strSerializedSlots[10]— JSON serialised slot datam_strPrisonTitle,m_strPrisonDescriptionm_NumPrisonRoles[2],m_ePrisonDifficultyLevelm_OutfitType,m_EditorVersion,m_bHasFinishedm_Slots[10]— SlotData arraySlotData:SlotStatusenum:Empty, Used, Corrupt, OldVersion, INVALIDm_strFileName,m_Status,m_strDate,m_iDays,m_iDataVersionm_GameRoomType,m_bSomethingChanged,m_iDateAsLong,m_RoomPassword
- Methods:
SerializeData(),DeSerializeData(),GetSlotFileName(),GetMostRecentSave(),GetPrisonDirectoryName()
- Top-level:
m_Prisons,m_strSerializedPrisons - Methods:
SerializeData(),DeSerializeData(),CreatePrison(),DeletePrison(),LoadPrison(),GetPrisonIndex()
SaveManagerStatusenum:WaitingForLogin, WaitingForPlatform, WaitingToGetDirectory, Ready- File naming:
Save{SanitizedName}S{slot}.sav - Directories:
ESC2P{name}(default),ESC2U{name}(custom),ESC2UGC{name}(UGC)
PrisonSnapshotIO.cs (PrisonSnapshotIO)
- Class:
PrisonSnapshotIO : T17MonoBehaviour ManagerSaveSecondaryIdsenum — All saveable managers:RoutineManager=1, ItemManager, PrisonCustomisationManager, FloorManager, RoomManager, JobsManager, VendorManager, ScoreManager, PlayerDataManager, PrisonAlertnessManager, QuestManager, ObjectiveManager, NPCManager, VisitorManager, SolitaryManager, GuardTowerManager, JobCustomerRequesterSnapshotData_Base/SnapshotData_SaveGame_Base/SnapshotData_SaveGame_V2:- Versioned containers
- Fields: days in prison, date saved, data version, game room type, password, leaderboard eligibility
- Contains serialised data for each manager as byte arrays
- Serialisation/deserialisation to/from byte streams
SaveData.cs (SaveData)
- Save data container
SaveDataRegister.cs (SaveDataRegister)
- Registers a component for automatic save/load participation
GlobalSave.cs (GlobalSave)
- Class:
GlobalSave : MonoBehaviour - Private serialisable entry types:
Entry (JSON),EntInt,EntFloat,EntString,EntBool,EntInt64Array,EntIntArray GlobalData: Serialisable collection of key-value pairs- Stores game-wide persistent data (settings, progress, etc.)
GlobalLoader.cs (GlobalLoader)
- Loads global save data on startup
17. Other Supporting Systems
RoomInfo.cs / RoomOptions.cs
- Photon networking room info (not prison rooms)
Room : RoomInfo— Network room with Name, IsOpen, IsVisible, MaxPlayers, etc.
ActorProperties, GamePropertyKey, GameRoomType
- Network room property definitions and game room type enum
18. Architecture Summary
Data Flow: Level Creation
LevelDetailsManager (Request)
→ Load building scene
→ Collect BuildingInstruction data (from .sav file or network)
→ Process instructions (InstructionList → per-layer lists)
→ Generate building blocks (tiles, walls, objects, zones)
→ Set up level (rooms, spawns, AI, routines)
→ Success callbackData Flow: Level Save
LevelDetailsManager (Request)
→ Find all saveable managers
→ Collect per-manager data
→ Serialise to PrisonSnapshotIO byte stream
→ Write to .sav file via SaveManagerState Management Pattern
Most systems follow a singleton pattern:
public class XManager : MonoBehaviour
{
private static XManager m_Instance;
public static XManager GetInstance() { return m_Instance; }
// ...
}Key managers: FloorManager, RoomManager, BuildingBlockManager, CameraManager, LightingManager, PinManager, SaveManager, PrisonAlertnessManager, PrisonPowerManager, WeatherEffectManager, FacadesManager, LevelEditor_X, LevelDataManager, PrisonCustomisationManager, PrisonAlterationSaveFixer
Room ↔ Building Block ↔ Zone Relationship
- Building blocks are placed on layers (tiles, walls, objects)
- Zones are defined areas with specific block group requirements (e.g., "a cell needs 1 bed + 1 toilet + 1 desk")
- Rooms (RoomBlob) are created from zones at runtime — each zone maps to a RoomBlob with a specific
eLocationtype - RoomBlobData subtypes provide specialised behaviour for each room type (cell, kitchen, infirmary, etc.)
Floor Layer Layout
Layer 0: Underground (sewers, tunnels)
Layer 1: Ground Floor (main prison)
Layer 2: Ground Floor Vent (ventilation)
Layer 3: First Floor (upper prison)
Layer 4: First Floor Vent (ventilation)
Layer 5: RoofEach layer has its own:
- Tile system (ground, walls, plops, objects, lights)
- Room floor map (121×121 grid mapping tiles to room IDs)
- Pathfinding nav graph
- Voxel mesh
- Zone map (editor)