Godot 4 Game Development Projects - Second Edition

Book description

Learn to create interactive cross-platform games such as a 3D Minigolf, a 2D Arcade classic, and much more with the all-new Godot Engine 4.0

Key Features

  • Master the art of developing cross-platform games
  • Harness the power of Godot's node and scene system to design robust and reusable game objects
  • Effortlessly and effectively integrate Blender into Godot to create powerful 3D games
  • Purchase of the print or Kindle book includes a free PDF eBook

Book Description

Godot 4.0 is one of the most sought-after open-source game engines, and if you’re enthusiastic about exploring its features, then this book is for you. Written by an author with over twenty-five years of experience, the Godot 4 Game Development Projects introduces the Godot game engine and its feature-rich 4.0 version. With an array of new capabilities, Godot 4.0 is a strong alternative to expensive commercial game engines. If you’re a beginner, this book will help you learn game development techniques, while experienced developers will understand how to use this powerful and customizable tool to bring their creative visions to life.

This updated edition consists of five projects with an emphasis on the 3D capabilities of the engine that will help you build on your foundation-level skills through small-scale game projects. Along the way, you’ll gain insights into Godot’s inner workings and discover game development techniques that you can apply to your projects.

Using a step-by-step approach and practical examples, this book covers everything from the absolute basics to sophisticated game physics, animations, and much more. By the time you complete the final project, you’ll have a strong foundation for future success with Godot 4.0 and you’ll be well on your way to developing a variety of games.

What you will learn

  • Get acquainted with the Godot game engine and editor if you're a beginner
  • Explore the new features of Godot 4.0
  • Build games in 2D and 3D using design and coding best practices
  • Use Godot’s node and scene system to design robust, reusable game objects
  • Use GDScript, Godot’s built-in scripting language, to create complex game systems
  • Implement user interfaces to display information
  • Create visual effects to spice up your game
  • Publish your game to desktop and mobile platforms

Who this book is for

This book is for game developers at all levels, from beginners seeking an introduction to experienced programmers aiming to delve into the intricacies of Godot Engine 4.0. It is a valuable resource for newcomers and a treasure trove of insights for experienced developers. Prior programming experience is a prerequisite.

Table of contents

  1. Godot 4 Game Development Projects
  2. Second Edition
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
    9. Download a free PDF copy of this book
  7. Chapter 1: Introduction to Godot 4.0
    1. General advice
      1. The secret to learning effectively
    2. What is a game engine?
    3. What is Godot?
    4. Downloading Godot
      1. Alternate installation methods
    5. Overview of the Godot UI
      1. Project Manager
      2. Editor window
    6. Learning about nodes and scenes
    7. Scripting in Godot
      1. About GDScript
    8. Summary
  8. Chapter 2: Coin Dash – Build Your First 2D Game
    1. Technical requirements
    2. Setting up the project
    3. Vectors and 2D coordinate systems
    4. Part 1 – the player scene
      1. Creating the scene
      2. Sprite animation
      3. Collision shape
      4. Scripting the player
      5. Moving the player
      6. Choosing animations
      7. Starting and ending the player’s movement
      8. Preparing for collisions
    5. Part 2 – the coin scene
      1. The node setup
      2. Coin script
    6. Part 3 – the Main scene
      1. Node setup
      2. Main script
      3. Starting a new game
    7. Part 4 – the user interface
      1. Node setup
      2. Message label
      3. Score and time display
      4. Score and time display
      5. Updating the UI via GDScript
      6. Game over
      7. Adding HUD to Main
    8. Part 5 – finishing up
      1. Visual effects
      2. Sound
      3. Powerups
      4. Coin animation
      5. Obstacles
    9. Summary
  9. Chapter 3: Space Rocks: Build a 2D Arcade Classic with Physics
    1. Technical requirements
    2. Setting up the project
      1. Rigid body physics
    3. The player’s ship
      1. Body and physics setup
      2. State machines
      3. Adding player controls
      4. Screen wrap
      5. Shooting
    4. Adding the rocks
      1. Scene setup
      2. Variable size rocks
      3. Instantiating rocks
      4. Exploding rocks
    5. Creating the UI
      1. Layout
      2. Scripting the UI
      3. The Main scene’s UI code
      4. Player code
    6. Ending the game
      1. Detecting collisions between rigid bodies
    7. Pausing the game
    8. Enemies
      1. Following a path
      2. Enemy scene
      3. Moving the enemy
      4. Spawning enemies
      5. Shooting and collisions
    9. Player shield
    10. Sound and visual effects
      1. Sound and music
      2. Particles
      3. Enemy trail
    11. Summary
  10. Chapter 4: Jungle Jump – Running and Jumping in a 2D Platformer
    1. Technical requirements
    2. Setting up the project
    3. Introducing kinematic bodies
      1. Collision response
    4. Creating the player scene
      1. Collision layers and masks
      2. About AnimationPlayer
      3. Animations
      4. Collision shape
      5. Finishing the player scene
      6. Player states
      7. Player script
      8. Player movement
      9. Player health
    5. Collectible items
      1. Scene setup
      2. Collectible script
    6. Designing the level
      1. Using TileMaps
      2. Designing the first level
      3. Adding dangerous objects
      4. Scrolling background
    7. Adding enemies
      1. Scene setup
      2. Scripting the enemy
      3. Damaging the enemy
      4. Player script
    8. Game UI
      1. Scene setup
      2. Scripting the HUD
      3. Attaching the HUD
    9. Title screen
      1. Scene setup
    10. Setting up the main scene
    11. Transitioning between levels
      1. Door scene
      2. Screen settings
    12. Finishing touches
      1. Sound effects
      2. Double jumping
      3. Dust particles
      4. Ladders
      5. Moving platforms
    13. Summary
  11. Chapter 5: 3D Minigolf: Dive into 3D by Building a Minigolf Course
    1. Technical requirements
    2. Introduction to 3D
      1. Orienting in 3D space
      2. Godot’s 3D editor
      3. Adding 3D objects
      4. Global versus local space
      5. Transforms
      6. Meshes
      7. Cameras
    3. Project setup
    4. Creating the course
      1. Understanding GridMaps
      2. Drawing the first hole
      3. Environment and lighting
      4. Adding the hole
    5. Making the ball
      1. Testing the ball
      2. Improving ball collisions
    6. Adding UI
      1. Aiming the arrow
      2. UI display
    7. Scripting the game
      1. UI code
      2. Main script
      3. Ball script
      4. Testing it out
      5. Option 1 for improving aiming
      6. Option 2 for improving aiming
      7. Camera improvements
      8. Designing a full course
    8. Visual effects
      1. Adding materials
    9. Lighting and Environment
    10. Summary
  12. Chapter 6: Infinite Flyer
    1. Technical requirements
    2. Project setup
      1. Inputs
    3. Airplane scene
      1. Collision shapes
      2. Scripting the plane
    4. Building the world
      1. World objects
      2. Chunks
    5. Main scene
      1. Spawning new chunks
      2. Increasing difficulty
      3. Collisions
      4. Fuel and score
    6. Title screen
    7. Audio
    8. Saving a high score
      1. About file locations
      2. Accessing files
    9. Suggestions for additional features
    10. Summary
  13. Chapter 7: Next Steps and Additional Resources
    1. Using Godot’s documentation
      1. Reading the API documentation
    2. Version control – using Git with Godot
    3. Using Blender with Godot
      1. Import hints
      2. Using blend files
    4. Exporting projects
      1. Getting the export templates
      2. Export presets
      3. Exporting
      4. Exporting for specific platforms
    5. Introduction to shaders
      1. Creating a 2D shader
      2. 3D shaders
      3. Learning more
    6. Using other programming languages in Godot
      1. C#
      2. Other languages – GDExtension
    7. Getting help – community resources
      1. Godot Recipes
    8. Contributing to Godot
      1. Contributing to the engine
      2. Writing documentation
      3. Donations
    9. Summary
    10. Final words
  14. Index
    1. Why subscribe?
  15. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Download a free PDF copy of this book

Product information

  • Title: Godot 4 Game Development Projects - Second Edition
  • Author(s): Chris Bradfield
  • Release date: August 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781804610404