How ybz777/four-years works
Four Years is a browser-based, single-player college-life simulation. A player starts or resumes a life, configures a freshman character, then makes choices through academic, social, personal, financial, and career events as the game advances across four years to graduation and an ending. The React screens present scenes and choices; the game engine coordinates event selection, consequences, term progression, and outcomes. The README documents persistent saves and multiple career and graduate-school outcomes. Some subsystem links below reflect README capabilities because their implementation was not sampled.
Main entry points: engine.ts Game Engine · PlayScreen.tsx Gameplay Screen · App.tsx App Flow · CreateScreen.tsx Life Creation
Components 26
Player Experience
- App Flow
src/App.tsx - Title Screen
src/components/TitleScreen.tsx - Life Creation
src/components/CreateScreen.tsx - Gameplay Screen
src/components/PlayScreen.tsx - Ending Screen
src/components/EndingScreen.tsx - Persistent Save
src/game/save.ts
Simulation Engine
- Game Engine
src/game/engine.ts - Year Calendar
src/game/calendar.ts - Random Generation
src/game/rng.ts - Life Drafts
src/game/create.ts
College Life Systems
- Academic Progress
src/game/academics.ts - Finances
src/game/economy.ts - Housing
src/game/housing.ts - Majors
src/game/majors.ts - Backgrounds
src/game/backgrounds.ts - Character Traits
src/game/traits.ts
Events and Outcomes
- Dynamic Events
src/game/events/index.ts - Event Choices
src/game/events/types.ts - Life Outcomes
src/game/finale.ts
Scene Presentation
- Scene Layout
src/components/Painting.tsx - Character Figures
src/components/Figures.tsx - Portrait Looks
src/art/looks.ts - Scene Audio
src/audio/cues.ts - Scene Details
src/game/presentation.ts - Locations and Weather
src/game/locations.ts
Other components
- Player
Connections 36
- Player → App Flow: starts or resumes
src/App.tsx - App Flow → Title Screen: shows
src/App.tsx - App Flow → Life Creation: opens
src/App.tsx - App Flow → Gameplay Screen: opens
src/App.tsx - App Flow → Life Drafts: rolls draft
src/App.tsx - App Flow → Game Engine: starts game
src/App.tsx - App Flow → Persistent Save: loads and saves
src/App.tsx - Gameplay Screen → Game Engine: advances life
src/components/PlayScreen.tsx - Gameplay Screen → Persistent Save: saves changes
src/components/PlayScreen.tsx - Gameplay Screen → Ending Screen: shows ending
src/components/PlayScreen.tsx - Gameplay Screen → Scene Layout: renders scene
src/components/PlayScreen.tsx - Gameplay Screen → Character Figures: renders figures
src/components/PlayScreen.tsx - Gameplay Screen → Scene Audio: plays cues
src/components/PlayScreen.tsx - Game Engine → Year Calendar: converts time
src/game/engine.ts - Game Engine → Academic Progress: resolves terms
src/game/engine.ts - Game Engine → Finances: applies costs
src/game/engine.ts - Game Engine → Housing: assigns housing
src/game/engine.ts - Game Engine → Dynamic Events: selects events
src/game/engine.ts - Game Engine → Event Choices: uses event outcomes
src/game/engine.ts - Game Engine → Life Outcomes: builds ending
src/game/engine.ts - Game Engine → Backgrounds: reads background
src/game/engine.ts - Game Engine → Character Traits: loads traits
src/game/engine.ts - Game Engine → Random Generation: creates random stream
src/game/engine.ts - Game Engine → Life Drafts: gets draft attributes
src/game/engine.ts - Life Creation → Majors: offers majors
src/components/CreateScreen.tsx - Life Creation → Backgrounds: offers backgrounds
src/components/CreateScreen.tsx - Life Creation → Character Traits: offers traits
src/components/CreateScreen.tsx - Life Creation → Scene Layout: previews portrait
src/components/CreateScreen.tsx - Character Figures → Portrait Looks: uses looks
src/components/Figures.tsx - Scene Layout → Locations and Weather: reads location names
src/components/Painting.tsx - Gameplay Screen → Year Calendar: shows calendar
src/components/PlayScreen.tsx - Gameplay Screen → Scene Details: formats scene details
src/components/PlayScreen.tsx - Gameplay Screen → Locations and Weather: uses location data
src/components/PlayScreen.tsx - Title Screen → Scene Layout: renders artwork
src/components/TitleScreen.tsx - Ending Screen → Scene Layout: renders artwork
src/components/EndingScreen.tsx - Ending Screen → Scene Details: formats ending text
src/components/EndingScreen.tsx