A browser-based 2D isometric RTS (Real-Time Strategy) game built with Phaser 3.
GooseCraft is a real-time strategy game where you command a flock of geese to gather resources, construct buildings, and expand your goose civilization. The game features:
- Isometric graphics for a classic RTS feel
- Resource gathering - collect food, water, sticks, and tools
- Building system - construct various structures with unlock progression
- Pathfinding - units navigate intelligently around obstacles
- Unit management - select and command multiple units
- A modern web browser (Chrome, Firefox, Safari, Edge)
- Node.js (v16+) and npm (optional, for development tools)
- Clone or download the repository
- Open
index.htmldirectly in your browser
That's it! The game runs entirely in the browser with no build step required.
For the best experience, run the game through a local HTTP server:
# Using Python 3
python -m http.server 8080
# Using Python 2
python -m SimpleHTTPServer 8080
# Using Node.js (if you have http-server installed)
npx http-server -p 8080 -c-1Then open http://localhost:8080 in your browser.
If you want to run tests or use development tools:
npm install- Left Click - Select units or buildings
- Right Click - Command selected units to move or gather resources
- Click & Drag - Select multiple units with selection box
- WASD / Arrow Keys - Pan camera
- Mouse Wheel - Zoom in/out
- ESC - Deselect all units
- You begin with a Coop (your main building) and one Goose unit
- Click on your goose to select it
- Right-click on resource nodes (wheat, trees, water) to gather resources
- Resources are automatically deposited at your Coop
- Food - Gathered from wheat fields
- Water - Gathered from water tiles
- Sticks - Gathered from trees
- Tools - Crafted or gathered (advanced)
- Select the Build Menu button at the bottom
- Choose a building (if you have enough resources)
- Click on the map to place it (green = valid, red = blocked)
- Buildings take time to construct
- Complete buildings to unlock new structures
- Some buildings require specific prerequisites
- Check the building panel for unlock conditions
- Coop - Main base, resource dropoff point
- Barracks - Train military units
- Factory - Produce advanced units
- Power Station - Generate power
- Research - Unlock technologies
- Resource Extractor - Passive resource generation
- Tower - Defense structure
- Airstrip - Air unit production
GooseCraft/
├── index.html # Main entry point
├── css/
│ └── style.css # Game styling
├── js/
│ ├── main.js # Game initialization
│ ├── scenes/ # Phaser scenes
│ │ ├── BootScene.js # Asset loading
│ │ ├── MenuScene.js # Main menu
│ │ ├── GameScene.js # Main gameplay
│ │ └── UIScene.js # HUD and UI
│ ├── entities/ # Game entities
│ │ ├── Unit.js # Base unit class
│ │ ├── Goose.js # Worker unit
│ │ ├── Building.js # Base building class
│ │ └── ResourceNode.js # Resource nodes
│ ├── systems/ # Game systems
│ │ ├── IsometricMap.js # Tile map
│ │ ├── PathfindingManager.js # A* pathfinding
│ │ ├── SelectionManager.js # Unit selection
│ │ ├── ResourceManager.js # Resource tracking
│ │ ├── BuildingManager.js # Building placement
│ │ └── BuildingUnlockManager.js # Progression
│ ├── buildings/ # Specific building types
│ │ ├── Coop.js
│ │ ├── Barracks.js
│ │ └── ...
│ ├── ui/ # UI components
│ └── utils/ # Utilities
│ ├── Constants.js # Game constants
│ ├── IsometricUtils.js # Coordinate conversion
│ ├── Logger.js # Logging system
│ └── SpatialHash.js # Spatial partitioning
├── lib/ # External libraries
│ ├── phaser.min.js # Phaser 3 game engine
│ └── easystar-0.4.4.min.js # Pathfinding library
└── assets/ # Game assets
├── terrain/ # Terrain tiles
├── units/ # Unit sprites
├── buildings/ # Building sprites
└── resources/ # Resource sprites
The game follows a component-based architecture:
- Scenes manage different game states (boot, menu, game)
- Systems handle specific game logic (pathfinding, selection, resources)
- Entities are game objects (units, buildings, resources)
- Utils provide helper functions and constants
The game uses an isometric grid system. Conversion utilities in IsometricUtils.js handle transformation between:
- Screen coordinates (mouse position)
- World coordinates (Phaser world space)
- Grid coordinates (tile indices)
Uses EasyStar.js for A* pathfinding with:
- Diagonal movement enabled
- Corner cutting disabled
- Dynamic grid updates when buildings are placed
- Grid caching for performance
Resource nodes use a spatial hash grid (SpatialHash.js) for efficient nearest-neighbor queries, improving performance when many units search for resources.
- Create a new class in
js/buildings/extendingBuilding - Define the building configuration in
Constants.js - Add unlock conditions in
BuildingUnlockManager.js - Add the building sprite to
assets/buildings/ - Load the sprite in
BootScene.js
Run tests (requires dependencies installed):
npm testWatch mode for development:
npm run test:watchnpm run lintThe codebase includes several performance optimizations:
- Minimap caching - Static terrain rendered once, dynamic elements updated separately
- Spatial hashing - O(1) proximity queries for resource searches
- Pathfinding grid caching - Grid only updated when terrain changes
- Input validation - Prevents invalid operations early
- No save/load system yet
- Mobile controls not optimized
- No multiplayer support
- Save/load game state
- More building and unit types
- Campaign mode
- Mobile touch controls
- Multiplayer/networking
- Game Engine: Phaser 3
- Pathfinding: EasyStar.js
- Music: Suno AI
- Sound Effects: ElevenLabs
- Art Assets: Google Gemini (via Nanobanana)
MIT License - see LICENSE file for details