Beginning Game Programming with Go

Beginning Game Programming with Go

Luigi Vanacore
This is a sample of the book's content.Buy on Leanpub

Table of Contents

Beginning Game Programming with Go

  • 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
    • Feedback and Errata
    • 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
    • Running the chapter
    • 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
    • Running the chapter
  • Chapter 3: Resource Manager, Layers and Sprites
    • Technical requirements
    • The resource manager and asset loading
    • The layer structure
    • Load textures and create sprites
    • Draw order, floor first, player centered
    • Running the chapter
    • Summary
  • Chapter 4: Input and Player Movement
    • Technical requirements
    • Overview of the input system
    • rawinput.go, physical input abstraction
    • action.go, Action with trigger mode
    • actionmap.go, ActionID to Action mapping
    • statebuffer.go, tracking state across frames
    • inputmanager.go, two input APIs
    • engine.go, adding InputManager and Update
    • Game setup and movement
    • run.go and cmd/main.go, entry point
    • Running the chapter
    • Summary
  • Chapter 5: Tileset, Tilemap, and Camera
    • Technical requirements
    • Tileset - cutting tiles from a spritesheet
    • Tilemap - from a finite pattern to an infinite floor
    • Camera - the moving window over the world
    • World - orchestrating the render pass
    • Chapter 5 setup - file by file
    • Optional extensions
    • Running the chapter
    • Summary
  • Chapter 6: Enemy and Collisions
    • Technical requirements
    • Understanding collisions in 2D games
    • node2d.go, add GetWorldPosition
    • collision.go, CollisionCircle and overlap test
    • collisionMask.go, layers and collision filtering
    • collider.go, Node2D with collision
    • collisionManager.go, CheckCollision
    • spawnEnemyFarFrom, enemy spawn for infinite map
    • game.go, setup and logic
    • Running the chapter
    • 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
    • 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
    • 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
    • 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
    • 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
Beginning Game Programming with Go/Chapter 14: Packaging, Distribution, and the Road Ahead

Chapter 14: Packaging, Distribution, and the Road Ahead

https://leanpub.com/gameprogramminggolang

Technical requirements

https://leanpub.com/gameprogramminggolang

What you have built

https://leanpub.com/gameprogramminggolang

Preparing for a production build

https://leanpub.com/gameprogramminggolang

Building native executables

https://leanpub.com/gameprogramminggolang

Shipping to the web with WebAssembly

https://leanpub.com/gameprogramminggolang

Measuring performance

https://leanpub.com/gameprogramminggolang

Extending Gopher Survivor

https://leanpub.com/gameprogramminggolang

Resources and community

https://leanpub.com/gameprogramminggolang

Summary

https://leanpub.com/gameprogramminggolang

Previous

Chapter 13: Game Feel, Particles and Visual Effects

Up next

Conclusion

In this chapter

  • 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