Update the game name in project.godot, export presets, UI/marquee/title strings, packaging (AppImage/NSIS/desktop/appdata), tools, docs, and the generated prop GLBs. Packaging assets and README screenshots are regenerated. Headless suite 209/209 and Python tooling tests pass.
14 KiB
Architecture
This document follows the structure of the arc42 architecture documentation template.
1. Introduction and Goals
Functional goals
- Simulate believable security work at multiple public-facing venues.
- Provide clear, low-pressure deterrence options before verbal or physical escalation.
- Make access verification a meaningful gameplay decision.
- Support distinct NPC behaviors and scenario events.
- Make emergency response rare, consequential, and justified by observable danger.
- Provide shift-level feedback so players can learn from decisions.
Quality goals
- Clarity: Players should understand why an NPC is allowed, denied, or escalated.
- Extensibility: New venues should reuse shared systems and primarily provide configuration and content.
- Testability: Rules and outcomes should be testable without rendering or real-time input.
- Consistency: Similar situations should follow predictable venue and escalation rules.
- Respectful representation: Mental-health crises and public interactions should not be reduced to stereotypes or treated as automatic threats.
2. Constraints
- The first implementation should be small enough for a playable vertical slice.
- The engine is Godot 4 with GDScript; a playable prototype vertical slice is implemented.
- Venue-specific policies must be configurable rather than hard-coded into individual NPCs.
- The game must preserve the de-escalation-first design described in
PLAN.md. - The project uses the repository workflow described in
AGENTS.md. - The project follows Semantic Versioning (
MAJOR.MINOR.PATCH).
Version management
- MAJOR — incompatible changes to the game's core systems, save format, or public-facing behavior.
- MINOR — new venues, NPC archetypes, systems, or features that are backward compatible.
- PATCH — bug fixes and small polish that do not change behavior.
The single source of truth for the version is config/version in project.godot (currently 0.1.0). Each release is tagged in git as v<version> (e.g. v0.1.0). The 0.x series is pre-1.0, so MINOR bumps may introduce breaking changes while the prototype is still stabilizing. tools/build_releases.sh and tools/publish_release.sh read the version from project.godot, so bumping it there is the only required step before a release. The full bump checklist lives in RELEASING.md.
3. Context and Scope
The player interacts with NPCs, venue entrances, access artifacts, equipment, staff, and response services. The game itself owns the simulated world, rules, scoring, events, and shift review. External services are currently out of scope; radio, body camera, and emergency response are simulated systems.
4. Solution Strategy
- Use a shared simulation core with venue-specific scenario data.
- Represent NPC behavior using state machines or behavior trees with configurable traits.
- Model escalation as explicit, auditable state transitions.
- Separate access verification from NPC identity and presentation details.
- Keep scoring and reputation event-driven so every action can be reviewed.
- Use authored scenario events alongside procedural routine traffic.
- Make the first playable target one venue and one complete shift before adding breadth.
5. Building Block View
Level 1: Major components
- Presentation layer: Camera, UI, prompts, interaction feedback, queues, and shift review.
- Input and interaction layer: Player gestures, dialogue choices, access checks, equipment use, and radio controls.
- Simulation layer: NPC movement, perception, intent, navigation, crowd behavior, and venue state.
- Rules layer: Access policy, escalation policy, prohibited items, response thresholds, and venue configuration.
- Incident layer: Incident lifecycle, evidence, radio reports, consequences, reputation, and review.
- Content layer: Venue definitions, NPC profiles, dialogue, events, visual/audio assets, and shift schedules.
Level 2: Key components
ShiftCoordinatorstarts, advances, and ends a shift.VenueScenarioprovides venue rules, locations, event pools, and access policies.NPCControllermanages an NPC’s intent, movement, compliance, and reaction.InteractionSystemresolves gestures, dialogue, warnings, and physical positioning.AccessVerifierevaluates recognition, wristbands, IDs, tickets, credentials, and guest lists.EscalationManagertracks the current response level and available actions.RadioSystemreceives reports and schedules security or emergency responses.IncidentRecorderstores actions, observations, evidence, and outcomes.ReputationEvaluatorconverts incidents and shift outcomes into performance feedback.CrowdSystemmodels queues, attention, congestion, and public reaction.ShiftReviewpresents decisions, consequences, and improvement opportunities.SurfaceMaterials(src/game/materials.gd) holds the surface profiles, glass/emissive recipes, and the environment tune-up (tonemapping, glow, fog, grading) that the phase lighting applies.WorldBuilderassembles the procedural venue and instantiates the generated prop models fromassets/models/generated/with a procedural fallback.tools/model_pipeline.pybuilds and audits the street-prop.glbmodels and packs their colour atlases.tools/npc_pipeline.pybuilds and audits the skinned NPC base model (assets/models/generated/npc_base.glb) and its per-slot material maps, with an optional AI fabric override (ADR-0013).tools/asset_pipeline.pygenerates and audits role-aware textures;tools/screen_designs.pygenerates screen references and judges captures.
Confirmed game assets live in assets/textures/ai/game_ready/ (audited surface, UI, and card textures), assets/models/generated/ (prop and NPC .glb models plus their texture atlases), and assets/textures/npc/ (NPC material maps and palette.json). Development-only outputs — AI concept sheets, Blender sources, raw AI fabrics — are gitignored and regenerated by the tools.
6. Runtime View
Routine interaction
- An NPC selects or receives an intent such as taking a photo, entering, waiting, or trespassing.
- The player observes the NPC and chooses whether to intervene.
- A gesture or verbal interaction changes the NPC’s state.
- The NPC complies, negotiates, refuses, or escalates.
- The rules layer validates access and determines available next actions.
- The incident recorder stores the interaction.
- Reputation and crowd systems react to the outcome.
Access check
- The player stops or receives an approaching person.
- The player recognizes the person or inspects a wristband, ID, credential, ticket, or guest-list record.
- The access verifier checks the artifact against the venue policy.
- The player admits, redirects, holds, or refuses entry.
- The decision is recorded for shift review.
Emergency response
- NPC behavior crosses the configured immediate-threat threshold.
- The player holds and confirms the emergency-radio action.
- The player submits a concise report describing location and behavior.
- The response system dispatches an appropriate responder.
- Crowd, venue, reputation, and incident systems apply consequences.
- The shift review evaluates whether the call was justified.
7. Deployment View
The initial target is a single-player local game. The expected runtime consists of one client process containing presentation, simulation, rules, content, and persistence for local settings and shift results. No online backend is required for the first prototype.
Future options include external analytics, cloud saves, or replay sharing, but they are not part of the initial architecture.
CI/CD build pipeline
A continuous-integration pipeline keeps the headless test suite green on every change, with a planned extension to build and publish release artifacts automatically.
- CI workflow (
.github/workflows/ci.yml) runs on every push tomainand on every pull request. It installs the pinned Godot 4.3 editor, caches the.godotimport artifacts, imports the project to build the class cache, and runs the headless test suite (res://src/test/test_runner.gd). The job fails on a non-zero exit code or anySCRIPT ERRORin the output. - Planned extension grows the pipeline from "test only" to "test, build, and publish": a test stage (headless tests plus a
--quit-after 120boot smoke test as the merge gate), a build stage (install export templates, runtools/build_releases.sh), and a publish stage (on a version tag, upload artifacts viatools/publish_release.shwith aGITEA_TOKENsecret). - Hosting note: the repository lives on Gitea/Forgejo (
https://git.allucanget.biz/zwitschi/security-game); the workflow is authored for GitHub Actions and should be mirrored or ported to the host's own runner if Actions is unavailable there. Export templates must match the pinned engine version, and macOS builds are unsigned (production releases need notarization or clear quarantine guidance).
Release management
Releases are produced from a tagged commit and published to the repository host's release page, where the README "Downloads" links point.
export_presets.cfg— committed Linux, Windows Desktop, and macOS export presets so builds are reproducible.tools/build_releases.sh— exports all three desktop artifacts intobuild/, namedgig-line-<platform>-<version>.<ext>.tools/publish_release.sh— creates a release and uploads the artifacts via the Gitea/Forgejo API (requiresGITEA_TOKEN).RELEASING.md— step-by-step guide and release checklist.
The release process is: bump the version, run the full test suite and boot smoke test, run tools/build_releases.sh, run tools/publish_release.sh (or create the release via the web UI), and verify the README "Downloads" links resolve to the new release.
8. Cross-Cutting Concepts
- Event-based incident recording: Important actions emit records consumed by evidence, reputation, and review systems.
- Data-driven venue rules: Access, escalation, equipment, and event differences live in scenario data.
- State transitions: NPCs, incidents, and shifts expose explicit states for debugging and testing.
- Accessibility: Input alternatives should exist for gestures, dialogue, visual alerts, and audio cues.
- Safety and proportionality: The rules layer prevents ordinary noncompliance from automatically becoming a violent encounter.
- Determinism where useful: Scenario tests should be able to use fixed seeds and scripted NPC behavior.
- Localization: Dialogue and prompts should be externalized from logic.
- Observability: Debug overlays should show NPC intent, access status, escalation level, active incidents, and response timers during development.
9. Architecture Decisions
Architecture decisions are recorded as ADRs:
- ADR-0001: Venue-driven simulation architecture
- ADR-0002: De-escalation-first escalation model
- ADR-0003: Explicit access-verification system
- ADR-0004: Local single-player first
- ADR-0005: Event-based incident recording
- ADR-0006: Godot 4 with GDScript
- ADR-0007: Locomotion and input layers
- ADR-0008: Cone focus and focus circle
- ADR-0009: Radial action menu
- ADR-0010: Procedural NPC presentation
- ADR-0011: Aim-free selection and precision walk
- ADR-0012: Surface materials and generated props
- ADR-0013: Blender-authored NPC characters and baked materials
10. Quality Requirements
| Requirement | Target |
|---|---|
| Player comprehension | Players can identify the reason for an access or escalation decision through UI and feedback. |
| Response proportionality | Routine NPC behavior should be resolvable without emergency response. |
| Extensibility | A new venue can be added primarily through scenario data and content. |
| Performance | The target venue should support a believable crowd without harming input or simulation responsiveness. |
| Testability | Access and escalation rules can be tested independently of presentation. |
| Accessibility | Core actions are available through clear input alternatives and readable feedback. |
11. Risks and Technical Debt
- NPC behavior may feel artificial if traits and reactions are too deterministic.
- Crowd simulation may become expensive around busy studio or comedy-club entrances.
- Access verification can become frustrating if the UI does not clearly show what the player is checking.
- Emergency response can overshadow the core game if it is too powerful or too frequent.
- Mental-health-crisis scenarios require careful writing, playtesting, and respectful presentation.
- The choice of engine may affect navigation, crowd scale, tooling, and content authoring.
12. Glossary
- Access artifact: A wristband, ID, ticket, credential, or other item used to verify entry.
- Authorized person: Someone permitted to enter under the current venue policy.
- Door person: The entrance security worker in The Joke Shop scenario.
- Incident: A recorded interaction or event requiring player judgment.
- NPC: Non-player character.
- Scenario: A venue-specific configuration of rules, content, locations, and events.
- Shift: One playable work period, normally 10–15 minutes.
- Simple deterrence: A low-pressure gesture such as raising a hand, making eye contact, or pointing.