Godot Study Notes

Godot Study Notes

Foreword: The reason why I came into contact with Godot was that I wanted to try to make games by myself, and common game engines include Unity and Unreal (Unreal). Why did I choose Godot? I will introduce it next, and this note will record my process of learning Godot.

This article will be updated from time to time, last update time: 2023.1.29

Why choose Godot?

I believe the biggest reason to choose Godot is that it is 开源! And it is almost the most permissive MIT license.

About Godot

Godot Engine is a feature-rich cross-platform game engine that can create 2D and 3D games through a unified interface. It provides a comprehensive set of common tools, so users can focus on making games without reinventing the wheel. Games can be exported to multiple platforms with one click, including mainstream desktop platforms (Linux, macOS, Windows) as well as mobile platforms (Android, iOS) and web-based (HTML5) platforms.

Godot is completely free and open source under the permissive MIT license, no strings attached, no commission, nothing. Every line of code in the user's game and even the engine belongs to him. Godot's development is completely independent and community-driven, allowing users to help shape their engine to meet their expectations. It is supported by the Software Freedom Conservancy and is not for profit.

Advantages of Godot

  1. As a game engine, it is very lightweight and convenient.
  2. Friendly to Chinese support
  3. Native support for 2D games

article description

This article does not learn the basic part of Godot. The GDscript language itself is highly similar to python. I have learned several strongly typed languages ​​or python is very fast. This article only records some small things that I personally think are commonly used or very useful For skills, settings or pitfalls, refer to the official Godot documentation for the content, and the article is suitable for people with a little foundation to read.

Godot configuration

Although this part of the content is not necessary in the game production process, sharpening the knife is not a mistake in chopping firewood. Understanding the early configuration can greatly improve the later development experience.

Self-contained mode

You can download multiple Godot versions on one machine. This is a common occurrence, such as using the stable version to develop and the latest version to try out new features. In order to better isolate Godot settings and projects between versions, you can use Godot Create ._sc_or file in the same directory as the executable file _sc_, which will enable Godot's self-contained modeeditor_data (self-contained mode), so that you will automatically create a folder in the same directory when you start Godot , which can make you in different Godot There is good isolation between versions.

Tips: The Steam version of Godot uses self-contained mode by default.

Godot editor theme

I personally like the theme of the editor Arc, the color matching is very comfortable, you can set it according to the following steps:

编辑器->编辑器设置->主题->预设->Arc

Ignore specific folders

.gdignoreWe hope that the project folder contains as many things about the project as possible, but some content is not part of the game production and does not need to be imported into the resource directory. We can create a file in the folder that needs to be ignored to ignore this folder.

Once a folder is ignored, resources within it can no longer be loaded using load()the and preload()methods. Ignored folders are hidden from the file system pane, reducing clutter.

Note that .gdignorethe contents of the file are ignored, so the file should be empty. It does not .gitignoresupport pattern matching like a file.

style guide

For consistency between projects, the following guidelines are recommended:

  • Use snake_case style for folders and files (except for c# scripts). This avoids case-sensitivity issues that may arise when exporting projects on Windows. C# scripts are an exception to this rule, since by convention class names are used to They are named, and class names should be in PascalCase style.
  • Nodes are named using PascalCase style, which is consistent with the built-in node case style.
  • In general, put third-party assets addons/in the top-level folder, even if they are not editor plugins. This makes it easier to keep track of which files are third-party. There are some exceptions to this rule: if you are creating a character using third-party game assets, It would be better to put these resources in the same folder as character scenes and scripts.

code completion delay

The default completion delay of Godot editor is 0.3 seconds. The code completion experience always feels a bit slow. You can set it as follows, and the 0.1秒experience will be much better:

编辑器->编辑器设置->文本编辑器->补全->代码补全延迟->0.1

Guess you like

Origin blog.csdn.net/qq_51173321/article/details/128790176