📋 Changelog
Full history of SimFarm updates, improvements, and fixes.
New Features
- NEWiOS PWA — Add to Home Screen — SimFarm now installs as a full-screen app on iPhone and iPad. Tap Share → Add to Home Screen in Safari. App icon, splash screen, and black-translucent status bar fully configured. Works on iOS 16.4+.
- NEWCapacitor scaffold — Native iOS & Android wrapper ready in
mobile/. When a production backend is deployed, the app can be submitted to the App Store via npx cap open ios → Xcode → Archive.
- NEWOffline shell caching (sw v3) — Service worker now pre-caches all 17 game JS modules, CSS, icons, and the game shell at install time. Returning players load instantly even on slow connections.
Bug Fixes
- FIXHarvest All limited to 20 tiles — The action rate-limiter (20 actions / 10 s) was silently stopping bulk harvests. Harvest All now uses a dedicated
POST /action/harvest-all endpoint that bypasses the rate limiter and processes every ready tile in a single database transaction.
- FIXMobile toolbar dropdowns invisible — Crop, Build, Animals, and Actions dropdowns were being painted behind the page on iOS Safari due to a
backdrop-filter GPU compositing conflict. Panels are now reparented to document.body on open and styled as full-width bottom sheets — always visible, always scrollable.
Bug Fixes
- FIXRoad tile plow block — Plowing or planting on a road tile now returns an error (same as fence). Both single-tile and batch-drag paths are protected.
- FIXLeaderboard Animals N+1 query — Animals leaderboard wrapped in a subquery so ORDER BY reuses the pre-computed
animals_alive alias instead of re-running a correlated subquery per player.
- FIXLivestock feed/collect crash —
handleFeed and handleCollect now return 400 immediately if no active farm is found, preventing a null farmId from reaching the database query.
- FIXAudio fade-in double-loop — Background music fade-in interval is now stored at module scope and cleared before being re-created. Rapid mute/unmute no longer produces a volume spike from stacked intervals.
- FIXSeason HUD timer accumulation —
updateSeasonBanner now clears and restarts the 1 s tick interval on every call. Switching farms no longer stacked multiple simultaneous intervals.
- FIXSparkline canvas state leak —
_drawSparkline now wraps drawing in ctx.save() / ctx.restore() so stroke style and line-width changes don't bleed into adjacent sparklines.
- FIXEmoji picker global listener duplicate — Document-level click handler for closing the emoji picker is now guarded by a
_pickerListenerAdded flag; it is registered exactly once per page lifetime.
- FIXFarm name null crash —
createFarm now validates farmName is a non-empty string before calling .slice(); falls back to "My Farm" if missing.
Performance
- IMPROVEDTile coordinate lookup O(n²) → O(1) — Hungry-animal crop damage in
state.js now builds a Map<"x,y", tile> before iterating animals. Eliminates Array.find() inside a nested loop over all tiles.
- IMPROVEDBackground music track updated to Small Steps.
Code Quality
- IMPROVEDShared farm constants —
BLOCKING_BUILDINGS, CROP_TYPES, BASE_TOOL_COST, and building footprint sizes extracted to engine/farmConstants.js. Removes duplication between action.js and batchAction.js.
New Features
- NEWCrop Tile Inspector — select the Inspect tool and click any planted tile to see moisture %, soil quality, pest status, and estimated harvest time in a popup.
- NEWDaily Quests — 3 auto-generated objectives each day (harvest crops, earn gold, feed animals) with cash rewards on claim. Resets at midnight. Access from the Quests panel.
- NEWLeaderboard — public top-25 ranking by Wealth, Crops Harvested, and Animals. Clickable player names open their farm in read-only view mode.
- NEWMarket Sparklines — every market row shows a 50×24 mini price-history chart so you can see price trends at a glance and time your sales.
- NEWOnboarding Tutorial — a 5-step illustrated guide auto-shows on first login. Re-open any time from the topbar. Now has a "Don't show again" checkbox.
- NEWWhat's New modal — shows once per version bump with a summary of changes. Has a "Don't show again for vX.X" checkbox.
- NEWFarm Visit Mode — visit any player's farm in read-only mode via
/farm-view.html?farmId=X or from the leaderboard. Respects the farm's public/private flag.
- NEWPWA Support —
manifest.json + service worker + offline fallback. Install SimFarm to your home screen on mobile or desktop.
- NEWChat Emoji Picker — 60 farm-themed emoji with keyword search. Inserts at cursor position in world chat and DMs.
- NEWToast Notifications — non-blocking slide-in toasts for harvests, random events, and errors. Stack up to 4; auto-dismiss with a progress bar.
- NEWSeason HUD Timer — a live countdown chip shows time remaining in the current season. Updates every second.
Bug Fixes
- FIXCrops leaderboard —
crops_harvested counter was never incremented on harvest; now correctly updated on every harvest action.
- FIXPESTICIDE and MULCH tools were incorrectly routed through the building-remove path — fixed by removing them from
BUILDING_TOOLS.
- FIXRect-drag batch action now fires in
mouseUp (was relying on click which browsers don't reliably fire after a real drag).
- FIXProfile page stats (total crops, animals, balance) no longer show null for new players — wrapped in COALESCE.
- FIXEvent listener leak in
chat.js and market.js — _initialized guard prevents duplicate handlers on re-render.
Improvements
- IMPROVEDWiki fully redesigned — search bar, season tabs on crop table, building category filters, tips card grid, grouped FAQ, v3.0 roadmap.
- IMPROVEDMigration 015: balance ≥ 0 constraint + 6 new query indexes for measurable performance gains on large farms.
- IMPROVEDLeaderboard now shows formatted numbers with commas and includes proper error handling for fetch failures.
- IMPROVEDBatch drag performance — Plow / Water / Harvest / Fertilize / Mulch / Pesticide / Plant now submit a single
POST /batch-action request regardless of selection size. A full 20×20 field (400 tiles) was 400 sequential HTTP requests; it is now 1 request + 1 DB transaction.
- IMPROVEDPlant uses rectangle-drag — the Plant tool now uses the same rect-drag interaction as Plow. Drag a green bounding box over plowed tiles; release to plant the entire field at once. No more painting individual tiles.
Chat System Overhaul
- FIXServer no longer crashes when the sender's player record is missing (null guard in Socket.IO message handlers).
- FIXFriends list and friend-request list no longer accumulate duplicate event listeners on each render — refactored to event delegation.
- FIXDM history now loads before joining the socket room — fixes a race condition where history could overwrite new incoming messages.
- FIXMessage log trimmed to 100 when it grows past 150 entries (was only removing 1 at a time at 200).
- NEWSocket disconnect/error status bar — a persistent yellow bar appears when chat is offline or reconnecting.
- NEWSending a message while offline now shows an error instead of silently dropping it.
- NEWReject friend request — each incoming request now has a ✕ Reject button.
- NEW
friend:accepted socket event — you are notified in real-time when someone accepts your friend request.
- NEWLive player search — type in the Add Friend box to get instant search results; click + Add instead of typing exact username.
- IMPROVEDFriend search uses a dedicated
/players/search endpoint instead of loading the entire leaderboard.
Stability & Performance
- IMPROVEDDB constraint ensures player balance never goes negative, even under concurrent load.
- IMPROVED6 new query indexes for player inventory, farm tiles, livestock, and chat — measurable speed boost on busy farms.
- FIXFriend request now validates that the target player actually exists before inserting.
UX & Farm Tools
- NEWBuilding placement preview — selecting any PLACE tool now shows a transparent ghost footprint under the cursor before you click. Green = valid; Red = blocked or out of bounds. Multi-tile buildings (Farmhouse 2×2, Grand Silo/Barn 3×3) centre the ghost on the cursor so you can see the full area before committing.
New Features
- NEWRectangle-drag farm tools — Plow, Water, Harvest, Fertilize, Pesticide, and Mulch now use click-and-drag to select a clean rectangle. A yellow bounding box with the tool icon and a W×H = N tiles count label is shown as you drag; releasing the mouse applies the action to every tile in the rectangle at once.
- NEWGrand Silo & Grand Barn hover AoE — hovering over a Grand Silo or Grand Barn now renders a full-canvas subtle tint indicating the farm-wide effect radius, plus a tooltip label showing the exact bonuses. The hover border now covers the full 3×3 footprint instead of a single tile.
- NEWGrand Silo & Grand Barn inspect popup — clicking either mega-structure now shows a live storage capacity bar (used / total) and a bonus confirmation line in the inspect panel.
Bug Fixes
- FIXFarm canvas failed to load ("sprite is not defined") — a SyntaxError in canvas.js from a missing
function keyword on pixelToTile caused the entire ES module to fail silently.
- FIXPesticide and Mulch single-tile clicks were incorrectly routed to the building-remove API path — they are now correctly handled as farm tile operations.
- FIXBatch drag actions now apply immediately on mouse-up instead of waiting for the click event — browsers don't reliably fire
click after a real drag, causing large selections to silently no-op.
Input Validation
- FIXAll action/building/livestock endpoints now reject coordinates outside 0–19 with HTTP 400.
- FIXGrand Silo and Grand Barn now registered as 3×3 footprints on the client — clicking them works correctly.
- FIXAnimal drag destination clamped to grid bounds — can no longer drag to out-of-range tiles.
Memory & Timers
- FIXRate-limiter map pruned hourly — was growing unbounded with player count.
- FIXSeason banner setInterval correctly cleared on page unload.
- FIXBuilding upgrade validated against level bounds to prevent undefined cost.
New Structures
- NEWGrand Barn 🏰 ($6,000, unique) — 3×3 mega structure. Adds +15,000 animal product storage, boosts livestock yield +40%, and grants +25% sell price on all animal products. One per farm.
Bug Fixes
- FIXGrand Silo placement crash — server was querying a non-existent
grid_size column; now uses a constant.
- FIXProfile page showing null stats —
balance field was missing from the /auth/me response.
- FIXGrand Barn and Grand Silo now register as 3×3 footprints on the client; clicking them no longer misses the building.
- FIXAnimal drag destination clamped to valid grid bounds — dragging to the canvas edge no longer sends out-of-range coordinates.
- FIXFarm name rendered safely in sidebar — HTML special characters in farm names no longer cause display glitches.
Stability & Performance
- IMPROVEDAll action/building/livestock endpoints now validate that coordinates are integers 0–19; out-of-range requests are rejected with 400.
- IMPROVEDRate-limiter memory map is now pruned hourly to prevent unbounded growth with many players.
- IMPROVEDSeason banner interval is now correctly cleared on page unload.
New Features
- NEWGrand Silo ⭐ ($5,000, unique) — 3×3 mega silo. Adds +15,000 crop storage and +25% crop sell price bonus at the Market. One per farm.
- NEWHourly player snapshots — balance, earnings, and crop stats are recorded hourly for historical analytics.
Bug Fixes & Stability
- FIXFarm events older than 90 days are now purged daily to keep the database lean.
- FIXBuildings and farm tiles with null
farm_id are backfilled on startup — fixes stale data from early versions.
- FIXMigration 014 adds 7 key indexes and a livestock uniqueness constraint for faster queries.
Balancing
- IMPROVEDPer-player action rate limiter — max 20 actions per 10 seconds for a fair experience.
- IMPROVEDAnimal wander speed reduced 33% and interval increased 25% for a calmer farm experience.
Bug Fixes
- FIX"Invalid tool" error when grabbing an animal and releasing on a fence tile —
handleTileClick now bails immediately in GRAB_ANIMAL mode.
- FIXGrab tool now detects animals at their animated screen position instead of their last saved server tile — animals are always clickable where you see them on screen.
- FIXMOVE_ANIMAL 500 error — occupied-tile check now scopes to the current farm; animals on other farms of the same player no longer cause a duplicate key constraint error.
New Features
- NEWAction favorites — HARVEST ALL, FEED ALL, COLLECT ALL, and all other action buttons can now be pinned to the quick-access favorites bar (⭐ star icon).
- NEWRoad traffic BFS v2 — vehicles now pathfind via a parent-tracking BFS between two distinct edge road tiles; trivial 2-tile "trips" are skipped. Roads must be at least 3 tiles long to spawn traffic.
Performance
- IMPROVEDAnimal wander speed reduced ~50% and wander interval increased from 4 s → 7.5 s — farm feels calmer and CPU usage from animation drops.
Bug Fixes
- FIXSelling crops/products now correctly reports earnings (was showing $0.00).
- FIXMoving animals no longer causes a 500 error when multiple farms share a player — occupation check is now farm-scoped.
- FIXGrab tool now hits animals by their visual animated position, not the stale server tile coordinate.
- FIXWells, compost bins, scarecrows, windmills, beehives, ponds, and shrubs now correctly block plowing and planting.
New Features
- NEWSell by quantity — each crop/product row now has a number input so you can choose exactly how many bushels to sell.
- NEWRoad vehicles now follow the actual road path (BFS routing). They enter from an edge road tile and exit at another edge tile, mirroring when heading left.
Visual Improvements
- IMPROVEDBarn — full pixel-art red barn with pitched roof, windows, and arched door. No solid background.
- IMPROVEDSilo — tall concrete cylinder with dome, horizontal bands, and door. No solid background.
- IMPROVEDWell — stone well with wooden frame, rope, and hanging bucket. No solid background.
Balancing
- IMPROVEDAnimals wander more slowly and less frequently (interval 7.5s, speed reduced ~50%) for a calmer farm feel.
New Crops
- NEWBlueberry 🫐 — Summer favorite, matures ~14 min. +20% yield bonus in Summer.
- NEWWatermelon 🍉 — Giant payout, matures ~22 min. Thrives in Summer heat.
- NEWPepper 🫑 — Quick Summer crop, matures ~7 min. Fast turnaround.
- NEWMushroom 🍄 — Cool Fall crop, matures ~8 min. Best yields in autumn.
- NEWCoffee ☕ — Luxury Spring crop, matures ~28 min. Highest sell value.
- NEWHops 🌱 — Brewing ingredient, matures ~14 min. Best in Fall season.
New Buildings
- NEWGreenhouse 🌿 ($800) — Protects crops from frost; boosts growth +25% in 3-tile radius.
- NEWCompost Bin ♻️ ($120) — Regenerates +2 soil quality per tick in 2-tile radius.
- NEWScarecrow 🪄 ($60) — Reduces pest damage 60% in 3-tile radius.
- NEWWindmill 🌬️ ($400, Unique) — Boosts all crop growth +10% in 4-tile radius.
- NEWBeehive 🐝 ($150) — Pollination bonus: +15% harvest yield in 3-tile radius.
New Tools & Mechanics
- NEWPesticide 🧪 ($25/tile) — Clears pest damage from a tile. Small soil penalty (-3).
- NEWMulch 🍂 ($15/tile) — Reduces moisture evaporation 50%. Resets on tile erase.
- NEWSeasonal crop preference: harvest in a crop's preferred season for +20% yield bonus.
- NEWCrop rotation bonus: planting a different crop than last time gives +10 soil quality.
Improvements
- IMPROVEDGreenhouse protects crops from frost (converts frost to 50% growth) and boosts growth +25% in 3-tile radius.
- IMPROVEDScarecrow reduces pest damage 60% in radius; Beehive adds +15% yield to all crops in range.
- IMPROVEDCompost Bins slowly regenerate soil quality (+2/tick); Windmill boosts crop growth +10% farm-wide.
- IMPROVEDBuilding hover now shows effect radius for Greenhouse, Windmill, Beehive, Scarecrow, and Compost Bin.
- IMPROVEDAll 20 crops now visible in Market panel and Build toolbar.
- NEWInventory capacity bars show silo (crop) and barn (product) storage levels with warning at 95%.
- NEWAchievement toast notifications — gold slide-in popup with chime when you unlock a new title.
- NEW17 additional achievements across earnings, buildings, multi-farm, and combined milestone categories.
- NEWCollection barns now enforce capacity; multiple collection barns stack storage (+500 each).
- IMPROVEDLivestock panel shows hunger levels and highlights critical animals (⚠️).
- IMPROVEDClick any animal in the livestock panel to highlight it on the farm canvas.
- IMPROVEDDrag animals in INSPECT mode to reposition them anywhere on the farm.
- NEWSilo capacity enforced on harvest (500 base + 1000 per silo). Error shown when full.
- NEWBarn capacity enforced on collect (100 base + 500 per barn). Excess stays on animal.
- NEWCrop inspect popup: stage progress, estimated yield, soil quality bar, pest/wither status.
- FIXAnimal breeding now properly assigns farm_id — no more silent breed failures.
- FIXDead animals (0 HP) no longer show in the livestock panel.
- IMPROVEDTractor and shrubs render with clean pixel-art style (no colored backgrounds).
- IMPROVEDCrop statistics show time to harvest, soil health bar, and full stage timeline.
- IMPROVEDMarket is fully scrollable on mobile; livestock tab shows all animals without overflow.
- FIXNavbar correctly floats on mobile devices; season status bar integrated into top toolbar.
- NEWDrag-and-paint road and fence placement — hold and drag to build multiple tiles at once.
- NEWRemove buildings for 50% cash refund using the Erase tool.
- FIXCrops no longer get stuck across season transitions — growth timing fully fixed.
- NEWBackground music (SimFarm theme) with volume control slider in the nav bar.
- NEWGrab-and-drag livestock to reposition them on the farm.
- NEW500+ animal name variety — no more "Baby_" names in the herd.
- NEWLarger livestock panel with hunger and health tracking per animal.
- FIXVolume popup now properly floats outside the toolbar frame.
- NEW8 additional crop types: Lettuce, Carrot, Potato, Strawberry, Rice, Sugarcane, Cotton, Grapes.
- NEWGoat 🐐 and Duck 🦆 livestock with unique Goat Milk and Duck Eggs products.
- NEWCollection Barn — auto-collects animal products within 4-tile radius each game tick.
- NEWDairy Barn, Chicken Coop, and Pig Pen specialty buildings with production bonuses.
- NEWFeed Trough auto-feeds animals within 2 tiles each tick.
- NEWWater Tower — auto-waters entire farm in 5-tile radius (upgrade from Well).
- NEWRandom world events: tax bills, bounties, neighbor requests, drought warnings.
- NEWFarm specializations (6 types) with stat bonuses for focused playstyles.
- NEWWiki page with full game reference, strategies, and building guide.
- NEW4-season cycle (Spring / Summer / Fall / Winter) — 45 minutes per season.
- NEWSoil quality system — fertilize tiles for better crop yields.
- NEWPest events: Locusts, Blight, and Aphids spawn seasonally and damage crops.
- NEW5 weather types (Sunny, Cloudy, Rainy, Stormy, Frost) each affecting growth and evaporation.
- IMPROVEDCurrent season and weather shown in the top nav bar with growth effect label.
- LAUNCHMulti-user cloud SimFarm — multiple players, persistent farms.
- LAUNCH6 core crops: Wheat, Corn, Tomato, Pumpkin, Soybeans, Sunflower.
- LAUNCH5 livestock: Cow, Pig, Chicken, Sheep, Horse with breeding.
- LAUNCHCore buildings: Barn, Silo, Well, Fence, Road, Tractor.
- LAUNCHWorld chat, player profiles, and title-based achievements.