# LifeTown Online πŸ™οΈ An **original browser-based multiplayer life simulation** β€” create a character, move into Maple Court, get a job, furnish your home, befriend the townsfolk and other players, and live an ongoing simulated life. No installation, no plugins: it runs in a modern desktop or mobile browser. > All characters, world design, UI, code, audio and visuals are original to this project. > No copyrighted assets, names, logos or UI from any existing game are used. --- ## Quick start ```bash npm install # three, ws, vite npm run build # bundles the client into client/dist npm start # serves game + WebSocket on http://127.0.0.1:7788 ``` Open **http://127.0.0.1:7788** in two browser windows to play multiplayer. Environment overrides: `GAME_PORT` (default `7788`). Player saves are JSON files in `saves/`. ## Controls | Action | Desktop | Mobile | |---|---|---| | Move | WASD / arrows | virtual joystick (bottom-left) | | Run | hold Shift | joystick edge / πŸƒ button | | Interact | E or πŸ‘‹ Act | βœ‹ button | | Dance emote | F or πŸ’ƒ | β€” | | Orbit camera | left-drag | drag on scene | | Zoom | wheel | pinch area | | Chat focus | Enter | tap chat box | Walk up to glowing POI rings (cafΓ©, gym, pond, stage…) or furniture at home and press **E**. ## What's in the MVP - **Character creator** β€” live 3D preview; body type, height, skin tones, hair styles & colours, eyes, brows, nose, mouth, outfits, shoes, accessories, voice, age and up to 3 personality traits. - **One living district β€” Maple Court** β€” main street with cafΓ©, City Hall, gym, home-goods store and arcade. **Every venue is enterable**: walk to a street-facing door and press E to step into a shared furnished interior with activity spots (order coffee, hit the gym mats, browse the shop catalogue, play the arcade); apartment doors lead straight into your home. store, apartments, arcade faΓ§ade, central plaza with fountain & stage, park with pond, food truck, bus stop, benches, lamps and trees. - **Needs & mood** β€” hunger, energy, hygiene, fun, social, comfort decay over time; weighted mood engine with 13 moods + transient moodlets drive facial expressions and HUD. - **NPCs with routines** β€” 10 original townsfolk walk POI-to-POI on daily schedules, chatter ambiently and react to your interactions. - **Jobs & economy** β€” 12 careers Γ— 5 ranks with pay, XP and promotions; shifts worked at real workplaces; TownCoins earned/spent across shops, homes, food and gifts. - **Housing & build mode** β€” studio apartment instanced per player (5 more tiers purchasable), drag-to-place furniture on a snap grid with rotate/duplicate/sell tools, 58-item catalogue whose items boost needs recovery, cooking speed and productivity. - **Friendship & romance** β€” contextual interaction wheels (Friendly/Romantic/Funny/Negative) gated by two independent relationship meters with tier labels and partner status. - **Multiplayer** β€” server-authoritative sessions/rosters/economy/relationships over one WebSocket; 12 Hz snapshots with client-side interpolation; zone instances for town and every home; invitations to visit; global + local chat with speech bubbles. - **Day/night & weather** β€” full day cycle (24 min/day) with dawn/dusk skies, sun/moon lighting, window glow and street lamps; sunny/cloudy/rain/storm/fog with rain particles, puddles that soak in, fog banks and lightning flashes. - **Mini-games** β€” fishing (timing bar) and cooking (memory) feeding back into needs & fun. - **Phone** β€” Messages, Contacts (relationship bars), Map, Careers, Bank (transaction log), LifeFeed social posts with in-game screenshots, Calendar of recurring town events, Home (teleport, property market, invites). - **Progression** β€” player levels gate catalog/homes; 8 achievements incl. First Home, Social Butterfly, Millionaire, Interior Designer. - **Save/load** β€” profiles autosave server-side (money, job, house, layout, inventory, relationships, achievements, needs); clients resume via token. - **Audio** β€” fully procedural WebAudio: location-based music (home/town/night), rain beds, footsteps, door/cash/UI blips, achievement jingles. ## Architecture ``` lifetown/ β”œβ”€ shared/data.mjs # single source of truth: jobs, catalog, NPCs, interactions… β”œβ”€ server/ β”‚ β”œβ”€ index.mjs # Node http static server + ws upgrade (/ws) β”‚ β”œβ”€ game.mjs # GameServer: sessions, zones, snapshots, NPCs, clock/weather, β”‚ β”‚ # economy, relationships, achievements, persistence β”‚ └─ persist.mjs # atomic JSON profile storage β”œβ”€ client/ β”‚ β”œβ”€ index.html # shell: title, creator, HUD, phone, build bar, modals β”‚ └─ src/ β”‚ β”œβ”€ gfx/engine.ts # renderer, ACES tone-mapping, day/night lighting rig β”‚ β”œβ”€ gfx/avatar.ts # modular stylized characters + procedural animation set β”‚ β”œβ”€ gfx/town.ts # procedural district geometry β”‚ β”œβ”€ gfx/interior.ts # instanced home shells + grid scaffolding β”‚ β”œβ”€ gfx/furniture.ts # 58 procedural furniture builders β”‚ β”œβ”€ gfx/weatherfx.ts # rain particles, puddles, lightning hooks β”‚ β”œβ”€ controller.ts # input, collision, camera rig, network transform sync β”‚ β”œβ”€ world.ts # actor manager, interpolation, bubbles/name-tags β”‚ β”œβ”€ systems.ts # needs simulation + mood derivation β”‚ β”œβ”€ audio.ts # WebAudio sequencer & SFX synth β”‚ └─ ui/* # HUD, chat, phone apps, dialogs/minigames, build UI, creator └─ scripts/ β”œβ”€ e2e.mjs # 20-check two-client protocol test └─ shot.mjs # headless-browser walkthrough of every screen ``` **Performance notes:** static geometry is modest-draw-call by construction, shadows come from a single tight sun cascade, remote players interpolate between 12 Hz snapshots, and interiors are separate zone scenes so only one district is ever loaded. ## Verification ```bash node scripts/e2e.mjs # exercises auth, movement sync, chat, social gates, jobs, # cooldowns, shopping, housing, zones, invites, persistence node scripts/shot.mjs # drives the real client headless through all major screens ``` ## Roadmap beyond MVP Beach zone & swimming, nightclub with DJ events, vehicles (bicycle β†’ sports car), weddings & festivals, group activities, Postgres/Redis backing stores, WebRTC voice, seasonal events, pets, and expanded careers with skill mini-courses at the university.