Reader small image

You're reading from  Godot 4 Game Development Projects - Second Edition

Product typeBook
Published inAug 2023
Reading LevelN/a
PublisherPackt
ISBN-139781804610404
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Chris Bradfield
Chris Bradfield
author image
Chris Bradfield

Chris Bradfield has worked in the Internet technology space for over 25 years. He has worked in the online gaming space for a number of MMO and social gaming publishers in South Korea and the United States. In his game industry career, he has served as a game designer, developer, product manager, and team leader. In 2012, he discovered a love for teaching and founded KidsCanCode to provide programming instruction and curriculum to young students. He is a member of the Godot Engine documentation team and works to provide learning resources for game development students around the world.
Read more about Chris Bradfield

Right arrow

Introduction to Godot 4.0

Whether it’s a career goal or a recreational hobby, game development is a fun and rewarding endeavor. There’s never been a better time to get started in game development. Modern programming languages and tools have made it easier than ever to build high-quality games and distribute them to the world. If you’re reading this book, then you’ve set your feet on the path to making the game(s) of your dreams.

This book is an introduction to the Godot Game Engine and its new 4.0 version, which was released in 2023. Godot 4.0 has a large number of new features and capabilities that make it a strong alternative to expensive commercial game engines. For beginners, it offers a friendly way to learn game development fundamentals. For more experienced developers, Godot is a powerful, customizable, and open toolkit for bringing your visions to life.

This book takes a project-based approach that will introduce you to the fundamentals of...

General advice

This section contains some general advice to readers, based on the author’s experience as a teacher and lecturer. Keep these tips in mind as you work through the book, especially if you’re very new to programming.

Try to follow the projects in the book in order. Later chapters may build on topics that were introduced in earlier chapters, where they are explained in more detail. When you encounter something that you don’t remember, go back and review that topic in the earlier chapter. No one is timing you, and there’s no prize for finishing the book quickly.

There is a lot of material to absorb here. Don’t feel discouraged if you don’t get it at first. The goal is not to become an expert in game development overnight – that’s just not possible. Just like with any other skill – carpentry or a musical instrument, for example – it takes years of practice and study to develop proficiency. Repetition...

What is a game engine?

Game development is complex and involves a wide variety of knowledge and skills. To build a modern game, you need a great deal of underlying technology before you can make the actual game itself. Imagine that you had to build your computer and write your own operating system before you could even start programming. Game development would be a lot like that if you truly had to start from scratch and make everything that you need.

There are also a number of common needs that every game has. For example, no matter what the game is, it’s going to need to draw things on the screen. If the code to do that has already been written, it makes more sense to reuse it than to create it all over again for every game. That’s where game frameworks and engines come in.

A game framework is a set of libraries with helper code that assists in building the foundational parts of a game. It doesn’t necessarily provide all the pieces, and you may still have...

What is Godot?

Godot is a fully featured modern game engine, providing all of the features described in the previous section and more. It is also completely free and open source, released under the very permissive MIT license. This means there are no fees, no hidden costs, and no royalties to pay on your game’s revenue. Everything you make with Godot 100% belongs to you, which is not the case with many commercial game engines that require an ongoing contractual relationship. For many developers, this is very appealing.

If you’re not familiar with the concept of open source, community-driven development, this may seem strange to you. However, much like the Linux kernel, Firefox browser, and many other very well-known pieces of software, Godot is not developed by a company as a commercial product. Instead, a dedicated community of passionate developers donates their time and expertise to building the engine, testing and fixing bugs, producing documentation, and more...

Downloading Godot

You can download the latest version of Godot by visiting https://godotengine.org/ and clicking Download Latest. This book is written for version 4.0. If the version you download has another number at the end (such as 4.0.3), that’s fine – this just means that it includes updates to version 4.0 that fix bugs or other issues.

On the download page, you will also see a standard version and a .NET version. The .NET version is specially built to be used with the C# programming language. Don’t download this one unless you plan to use C# with Godot. The projects in this book do not use C#.

Figure 1.1: The Godot download page

Figure 1.1: The Godot download page

Unzip the downloaded file, and you’ll have the Godot application. Optionally, you can drag it to your Programs or Applications folder, if you have one. Double-click the application to launch it and you’ll see Godot’s Project Manager window, which you’ll learn about in the...

Overview of the Godot UI

Like most game engines, Godot has a unified development environment. This means that you use the same interface to work on all of the aspects of your game – code, visuals, audio, and so on. This section is an introduction to the interface and its parts. Take note of the terminology used here; it will be used throughout this book when referring to actions you’ll take in the editor window.

Project Manager

The Project Manager window is the first window you’ll see when you open Godot:

Figure 1.3: Project Manager

Figure 1.3: Project Manager

Opening Godot for the first time

The first time you open Godot, you won’t have any projects yet. You’ll see a pop-up window asking if you want to explore official example projects in the Asset Library. Select Cancel, and you’ll see the Project Manager as it appears in the preceding screenshot.

In this window, you can see a list of your existing Godot projects. You can choose...

Learning about nodes and scenes

Nodes are the basic building blocks for creating games in Godot. A node is an object that can give you a variety of specialized game functions. A given type of node might display an image, play an animation, or represent a 3D model. The node contains a collection of properties, allowing you to customize its behavior. Which nodes you add to your project depends on what functionality you need. It’s a modular system designed to give you flexibility in building your game objects.

The nodes you add are organized into a tree structure. In a tree, nodes are added as children of other nodes. A particular node can have any number of children, but only one parent node. When a group of nodes is collected into a tree, it is called a scene:

Figure 1.10: Nodes arranged in a tree

Figure 1.10: Nodes arranged in a tree

Scenes in Godot are typically used to create and organize the various game objects in your project. You might have a player scene that contains all...

Scripting in Godot

Godot provides two official languages for scripting nodes: GDScript and C#. GDScript is the dedicated built-in language, providing the tightest integration with the engine, and is the most straightforward to use. For those that are already familiar or proficient with C#, you can download a version that supports that language.

In addition to the two supported languages, Godot itself is written in C++, and you can get even more performance and control by extending the engine’s functionality directly. See Additional topics in Chapter 7 for information on using other languages and extending the engine.

All the games in this book will use GDScript. For the majority of projects, GDScript is the best choice of language. It is tightly integrated with Godot’s Application Programming Interface (API) and is designed for rapid development.

About GDScript

GDScript’s syntax is very closely modeled on the Python language. If you are familiar with...

Summary

In this chapter, you were introduced to the concept of a game engine in general and to Godot in particular. Most importantly, you downloaded Godot and launched it!

You learned some important vocabulary that will be used throughout this book when referring to various parts of the Godot editor window. You also learned about the concepts of nodes and scenes, which are the fundamental building blocks of Godot.

You also received some advice on how to approach the projects in this book and game development in general. If you ever find yourself getting frustrated as you are working through this book, go back and reread the General advice section. There’s a lot to learn, and it’s OK if it doesn’t all make sense the first time. You’ll make five different games throughout this book, and each one will help you understand things a little bit more.

You’re ready to move on to the next chapter, where you’ll start building your first game...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Godot 4 Game Development Projects - Second Edition
Published in: Aug 2023Publisher: PacktISBN-13: 9781804610404
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Chris Bradfield

Chris Bradfield has worked in the Internet technology space for over 25 years. He has worked in the online gaming space for a number of MMO and social gaming publishers in South Korea and the United States. In his game industry career, he has served as a game designer, developer, product manager, and team leader. In 2012, he discovered a love for teaching and founded KidsCanCode to provide programming instruction and curriculum to young students. He is a member of the Godot Engine documentation team and works to provide learning resources for game development students around the world.
Read more about Chris Bradfield