A Pixel-Art Farming Simulation β Built From Scratch
A farming and life simulation game built entirely from scratch in JavaScript with no game engine. Custom rendering, custom physics, custom everything β just HTML5 Canvas and code. Features a deep genetic breeding system where you cross-breed plants, discover rare strains, and build a thriving farm with NPCs, quests, and a living world.
No Unity. No Godot. No Phaser. No engine at all.
Every system in Green Valley β rendering, input handling, collision detection, game loop, UI, audio, saving β was built by hand. This means understanding every line of code that makes the game work, and having total control over how it behaves.
The game runs entirely in a web browser using the HTML5 Canvas 2D API. No installations, no plugins, just open and play.
Full crop lifecycle from seed to harvest:
Seed β Seedling β Vegetative β Flowering β Harvestable
- Soil management β Nutrients deplete as crops grow; restore with fertilizer
- Watering system β Crops need water; track moisture levels per plot
- Seasons β Spring, Summer, Fall, Winter affect what grows and how fast
- Weather effects β Rain waters your crops; heatwaves stress them; snow halts growth
- Quality system β Plant health, water efficiency, and care affect harvest quality
The signature feature. Cross-breed plants to create offspring with inherited traits:
| Trait | What It Controls |
|---|---|
| Yield | How much you harvest |
| Quality | Grade of the harvest |
| Growth Speed | How fast it grows |
| Water Efficiency | How much water it needs |
| Disease Resistance | Survival against disease |
| Pest Resistance | Survival against pests |
| THC% | Specialized strain potency |
| CBD% | Specialized strain properties |
How breeding works:
- Select two parent plants
- Offspring inherits a mix of both parents' traits
- 5% mutation chance on each trait (Β±0.2 variance)
- Color genetics β visual phenotype mixing from parents
- Multi-generation tracking β plants know their lineage
Strain tiers:
- Starter strains β Basic cultivars for new players
- Rare strains β Unlocked through skilled breeding and quests
- Legendary strains β Exceptional genetics, extremely rare
8-22 NPCs with daily lives:
- Schedules β Each NPC has hourly routines (work, shop, walk, sleep) that vary by day
- Relationships β 0-300+ point system: Stranger β Friend β Best Friend β Close
- Gift system β Every NPC has loved, liked, neutral, disliked, and hated gifts
- Occupations β Herbalist, farmer, merchant, each with role-specific activities
- Dialogue β Relationship-level dialogue variants, quest conversations, casual chat
| Building | Function |
|---|---|
| Greenhouse | Climate control, humidity regulation, automated watering, weather protection |
| Barn | Storage + animal care |
| Coop | Poultry management |
| Shed | Tool and item storage |
| Silo | Bulk crop storage |
| Well | Water source |
| House | Player home, rest, save point |
Buildings have tiered upgrades: Basic β Advanced β Specialized (e.g., Hydroponics greenhouse)
100+ recipes across multiple stations:
- Tools β Hoe, Watering Can, Axe, Pickaxe, Scythe (with durability tiers)
- Seeds β Craft specialized seeds from harvested genetics
- Products β Transform raw harvests into sellable goods
- Quality inheritance β Output quality based on input ingredient quality
| Type | Description |
|---|---|
| Main story | 5+ chapter narrative arc |
| Side quests | NPC-driven tasks and favors |
| Daily quests | Repeatable daily objectives |
| Weekly quests | Longer-term challenges |
Multi-stage objectives (e.g., plant seeds β water β harvest β deliver) with XP, gold, item, and blueprint rewards.
| Skill | Levels | Effect |
|---|---|---|
| Farming | 1-10+ | Crop growth speed, yield, plot management |
| Breeding | 1-10+ | Mutation rates, strain discovery, genetics mastery |
| Processing | 1-10+ | Harvest yield, drying/trimming efficiency |
| Social | 1-10+ | NPC relationship bonuses, gift effectiveness |
- Multiple shops with dynamic pricing and buy/sell restrictions
- Gold currency with wallet management
- Market fluctuations based on season and supply
- Stock tracking β shops restock periodically
- Day/night cycle β Syncs to your real system clock; street lanterns glow warm from dusk to dawn
- 4 seasons β 30-day cycles each, affecting crops and NPC behavior
- Dynamic weather β Season-specific patterns:
- Winter: Snow (30%), Clear (70%)
- Spring: Rain (50%), Storm (20%), Clear (30%)
- Summer: Heatwave (20%), Rain (20%), Clear (60%)
- Fall: Wind (30%), Rain (30%), Clear (40%)
- 100-point stamina pool β Actions drain energy (tools, sprinting, farming)
- Regeneration β Sleep, food consumption
- Fatigue β Reduced efficiency when tired
Built as a modular vanilla JavaScript application with an event-driven architecture:
main.js (entry point)
β
βββ Game.js (core game loop + state)
β
βββ Core Systems
β βββ InputManager β Keyboard + mouse handling
β βββ AudioManager β Web Audio API sounds
β βββ SaveManager β LocalStorage persistence
β βββ EventBus β Pub/sub event system
β βββ GameBootstrap β Initialization sequence
β
βββ Rendering
β βββ EnhancedRenderer β Canvas 2D rendering + camera
β βββ Animation β Sprite frame animation
β βββ SpriteSheet β Texture atlas system
β βββ Particles β Particle effects
β βββ Lighting β Day/night visual effects
β βββ Transitions β Scene fade/wipe transitions
β
βββ World
β βββ GameWorld β Zone management
β βββ TileMap β Tile-based collision + interaction
β βββ Camera β Viewport tracking
β βββ Zones: Farm, Forest, Cave, Town, Greenhouse
β
βββ Game Systems
β βββ FarmingSystem β Crop lifecycle management
β βββ QuestSystem β Quest tracking + completion
β βββ AchievementSystem β Achievement tracking
β βββ TimeSystem β Day/night, seasons, year
β βββ WeatherSystem β Dynamic weather patterns
β βββ EconomySystem β Pricing + transactions
β βββ EnergySystem β Stamina management
β βββ ShopSystem β Buy/sell interface
β βββ CraftingSystem β Recipe processing
β βββ ToolSystem β Tool durability + tiers
β
βββ Entities
β βββ Player β Stats, skills, inventory
β βββ NPCs β Dialogue, relationships, schedules
β βββ Plants β Growth, genetics, health
β
βββ Genetics Module
β βββ Genome β Trait container
β βββ Breeding β Cross-breed logic
β βββ Mutations β Random trait variance
β βββ ColorGenetics β Visual phenotype mixing
β βββ StrainRegistry β Starter/Rare/Legendary
β
βββ UI
βββ HUD β Heads-up display
βββ MenuSystem β Main/pause/settings
βββ DialogSystem β NPC conversations
βββ InventoryUI β 32-slot grid (8Γ4)
βββ JournalUI β Quest + achievement log
βββ MapUI β Zone overview
Full architecture deep-dive in ARCHITECTURE.md
| Component | Technology | Notes |
|---|---|---|
| Language | JavaScript ES6+ | Vanilla β no frameworks |
| Rendering | HTML5 Canvas 2D API | Pixel-perfect with imageSmoothingEnabled: false |
| Audio | Web Audio API | Deferred init (browser requirement) |
| Persistence | LocalStorage | Compressed save data (Base64) |
| Architecture | ES6 Modules | Native browser imports, no build pipeline |
| Input | Keyboard + Mouse events | Centralized InputManager |
| PWA | Service Worker + Manifest | Installable, offline-capable |
| Assets | PNG spritesheets | Optimized texture atlases |
No game engine. No bundler. No transpiler. Just JavaScript, Canvas, and hand-crafted game systems.
Full breakdown in TECH_STACK.md
| Key | Action |
|---|---|
| WASD / Arrow Keys | Move |
| E / Space | Interact |
| I | Inventory |
| 1-9 | Tool/item hotbar |
| Left Click | Use tool / interact |
| Right Click | Context action |
Screenshots coming soon.
Green Valley is playable with major systems functional:
- β Custom game engine (rendering, input, physics, audio)
- β Full farming lifecycle (seed β harvest)
- β Genetic breeding system with mutations and strain tiers
- β NPC system with schedules, relationships, and dialogue
- β Building construction with tiered upgrades
- β 100+ crafting recipes
- β Quest system with multi-stage objectives
- β Day/night cycle, seasons, and weather
- β Economy with shops and dynamic pricing
- β Achievement system
- β Save/load with compressed LocalStorage
- β PWA support (installable, offline-capable)
- π Story chapters and endgame content
This project was built using VybeCoder β an execution-verified AI software system that plans, generates, debugs, and verifies complete applications.
Unlike traditional AI coding assistants that generate snippets and leave you to debug, VybeCoder manages the entire lifecycle: architecture decisions, multi-file coordination, error detection, automated repair, and runtime verification.
What does that mean in practice?
- Every file was planned, generated, and tested through VybeCoder's build pipeline
- Errors were caught and fixed automatically β not manually
- The final output was verified to run, not just compile
Want to build something like this? Start building with VybeCoder β no coding experience required.
This repository contains documentation and architecture references only. The source code is proprietary and not publicly available.
Β© 2024-2026 DevStudio AI Inc.. All rights reserved.
See LICENSE for details.
