Introduction
- What This Book Is About
- What Is Go (Golang)?
- What Is Ebitengine?
- Why Go for Games?
- Conventions Used in This Book
- The Game We Are Building: Gopher Survivor
- What Comes Next
Chapter 1: Ebiten Basics
- Technical requirements
- Getting Go on Your Machine
- A Quick Sanity Check: Hello, World
- What Is Ebiten?
- The Ebiten Game Interface
- Creating a Go Module for Your Project
- Building the Code Step by Step
- Full Source Code
- Summary
Chapter 2: The Scene Graph and Framework Structure
- Technical requirements
- Why a Scene Graph?
- Vector2D: 2D Coordinates and a Bit of Vector Math
- The SceneNode Interface
- The Node Struct: Base Implementation
- Transform and Transformable
- Node2D: Nodes with Transforms
- The Drawable Interface
- The Sprite: A Drawable Node2D
- The Engine: Delegating to the World
- How the World Traverses the Scene
- Complete Example: Rotating Logo
- Summary
- Code Structure for Chapter 2
Chapter 3: Resource Manager, Layers and Sprites
- Technical requirements
- Part 1: The Resource Manager and asset loading
- Part 2: The Layer Structure
- Part 3: Load Textures and Create Sprites
- Part 4: Draw Order — Floor First, Player Centered
- Code Structure
- Summary
Chapter 4: Input and Player Movement
- Technical requirements
- Overview of the Input System
- 1. rawinput.go — Physical Input Abstraction
- 2. action.go — Action with Trigger Mode
- 3. actionmap.go — ActionID to Action Mapping
- 4. statebuffer.go — Tracking State Across Frames
- 5. inputmanager.go — Two Input APIs
- 6. engine.go — Adding InputManager and Update
- 7. Game Setup and Movement
- 8. run.go and cmd/main.go — Entry Point
- Code Structure
- Summary
Chapter 5: Tileset, Tilemap, and Camera
- Technical requirements
- Part 1: Tileset - Cutting Tiles from a Spritesheet
- Part 2: Tilemap - From a Finite Pattern to an Infinite Floor
- Part 3: Camera - The Moving Window over the World
- Part 4: World - Orchestrating the Render Pass
- Part 5: Chapter 5 Setup - File by File
- Part 6: Optional Extensions
- Code Structure
- Summary
Chapter 6: Enemy and Collisions
- Technical requirements
- Understanding collisions in 2D games
- Part 1: node2d.go — Add GetWorldPosition
- Part 2: collision.go — CollisionCircle and Overlap Test
- Part 3: collisionMask.go — Layers and Collision Filtering
- Part 4: collider.go — Node2D with Collision
- Part 5: collisionManager.go — CheckCollision
- Part 6: spawnEnemyFarFrom — Enemy Spawn for Infinite Map
- Part 7: game.go — Setup and Logic
- Part 8: Running the chapter
- Part 9: go.mod — Dependencies
- Summary
Chapter 7: Weapons and Projectiles
- Technical requirements
- Weapons and projectiles in games
- The cursor: a pointer that follows the mouse
- The timer: a cooldown for the weapon
- The projectile: layers and spawn logic
- Collision: a projectile kills an enemy
- Projectile movement and cleanup
- Enemy waves: the spawner and the EnemyManager
- Summary
Chapter 8: UI, Health, XP, and Level Up
- Technical requirements
- Drawing the UI in screen space
- The reusable progress bar
- The floating message
- Composing the HUD
- Giving the player health, XP, and level
- Adding pickup collision layers
- Spawning and collecting XP orbs
- Wiring it together in game.go
- Running the chapter
- Summary
Chapter 9: Health Potion, Sacred Book, and Holy Shield
- Technical requirements
- How loot drops on enemy death
- Loading the potion and sacred-book sprites
- Extending the PickupManager
- Modeling the health potion
- Dropping loot when an enemy dies
- Collecting orbs and potions
- A common interface for player weapons
- The Sacred Book: an orbiting weapon
- The Holy Shield: a static ring weapon
- Mounting all three weapons
- Keeping XP and the level-up popup
- Running the chapter
- Summary
Chapter 10: Weapon Upgrade UI, Additional Weapons, and a Survival Timer
- Technical requirements
- Centralizing weapon stats in WeaponManager
- Threading the manager through the weapon interface
- Reading multipliers inside each weapon
- The Flying Axe: a spinning projectile weapon
- Mounting all four weapons
- The upgrade flow and pausing the world
- An exponential XP curve
- Modeling upgrades: options, factories, and random sampling
- From options to HUD choices
- The HUD: panels, input, and overlays
- The upgrade panel and stable icons
- Drawing gameplay versus the upgrade screen
- The survival timer and game over
- Restarting from the game-over screen
- Running the chapter
- File layout (highlights)
- Full listing pointers
- Summary
Chapter 11: Weapon Unlock and Gated Upgrades
- Technical requirements
- What changes since Chapter 10
- Setting the upgrade caps and weapon IDs
- Reusing the infinite floor, input, and movement
- From mount-all to construct-all, mount-one
- Counting upgrades and scaling difficulty over time
- Surviving longer: enemy variety and time scaling
- From flat factories to gated strategies
- Biasing the panel toward bonus items
- Writing the strategies
- One-time bonus items
- Falling back when the pool is capped
- Splitting display from apply
- Loading the new sprites
- Drawing: unchanged from Chapter 10
- Full listing reference
- Summary
Chapter 12: Audio and a State Machine for Menus, Gameplay, and Pause
- Technical requirements
- Sound: looping music
- What is a state machine, and why games use it
- Understanding the state machine
- Decoupling the core from the game package
- The State and StateMachine types
- App: the single ebiten.Game
- Shared menu helpers
- The main menu state
- The game state: delegating to Game
- The pause state
- The options state
- The pause action and IsPausePressed
- The main package
- Transition diagram
- File layout (new and changed)
- Full listing reference
- Summary
Chapter 13: Game Feel — Particles and Visual Effects
- Technical requirements
- Understanding game feel
- Sound effects
- The particle system
- Emitting effects on damage
- Weapon trails
- Floating damage numbers
- Flashing enemies white
- Shaking the camera
- Wiring it into the frame loop
- Full listing reference
- Summary
Chapter 14: Packaging, Distribution, and the Road Ahead
- Technical requirements
- What you have built
- Preparing for a production build
- Building native executables
- Shipping to the web with WebAssembly
- Measuring performance
- Extending Gopher Survivor
- Resources and community
- Summary
Conclusion
- The journey, chapter by chapter
- What you actually learned
- Thank you
- Where you go now