Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Godot - filozofia projektowania

Now that you've gotten your feet wet, let's talk about Godot's design.

Wszystkie silniki do gier różnią się i nadają się do różnych projektów. Oferują one nie tylko szereg funkcji, ale również unikalną konstrukcję każdego silnika. Prowadzi to do różnych sposobów formowania struktur gier. Wszystko to wynika z filozofii ich projektowania.

Ta strona ma pomóc Ci zrozumieć, jak działa Godot, zaczynając od niektórych jego głównych filarów. Nie jest to lista dostępnych funkcji, ani porównanie silnika. Aby wiedzieć, czy którykolwiek z silników może być odpowiedni do twojego projektu, musisz wypróbować go na własną rękę i zrozumieć jego konstrukcję oraz ograniczenia.

Please watch Godot explained in 5 minutes if you're looking for an overview of the engine's features.

Obiektowo zorientowane projektowanie i kompozycja

Godot, dzięki elastycznemu systemowi scen i hierarchii węzłów, opiera się na projektowaniu zorientowanym obiektowo. Próbuje trzymać się z dala od ścisłych wzorców programowania, aby zaoferować intuicyjny sposób tworzenia struktur gier.

For one, Godot lets you compose or aggregate scenes. It's like nested prefabs: you can create a BlinkingLight scene and a BrokenLantern scene that uses the BlinkingLight. Then, create a city filled with BrokenLanterns. Change the BlinkingLight's color, save, and all the BrokenLanterns in the city will update instantly.

Ponadto można dziedziczyć z każdej sceny.

Scena Godota może być bronią, postacią, przedmiotem, drzwiami, poziomem, częścią poziomu... wszystkim, czym chcesz. Działa jak klasa w czystym kodzie, z wyjątkiem tego, że możesz ją zaprojektować za pomocą edytora, używając tylko kodu lub łącząc obydwa rozwiązania.

Różni się on od prefabów, które można znaleźć w wielu silnikach 3D, ponieważ możesz dziedziczyć i rozszerzać te sceny. Możesz utworzyć Magika, która rozszerzy twoją postać. Zmodyfikuj postać w edytorze, a Magik również się zaktualizuje. Pomaga to w budowaniu projektów tak, aby ich struktura odpowiadała projektowi gry.

image0

Also note that Godot offers many different types of objects called nodes, each with a specific purpose. Nodes are part of a tree and always inherit from their parents up to the Node class. Although the engine does feature some nodes like collision shapes that a parent physics body will use, most nodes work independently from one another.

In other words, Godot's nodes do not work like components in some other game engines.

image1

Sprite2D is a Node2D, a CanvasItem and a Node. It has all the properties and features of its three parent classes, like transforms or the ability to draw custom shapes and render with a custom shader.

Pakiet all-inclusive

Godot stara się dostarczać własne narzędzia na podstawowe zadania. Posiada dedykowany obszar roboczy do skryptów, edytor animacji, edytor tilemap, edytor shaderów, debugger, profiler, możliwość ładowania gry lokalnie i na zdalnych urządzeniach itp.

image2

The goal is to offer a full package to create games and a continuous user experience. You can still work with external programs as long as there is an import plugin available in Godot for it. Or you can create one, like the Tiled Map Importer.

That is also partly why Godot offers its own programming language GDScript along with C#. GDScript is designed for the needs of game developers and game designers, and is tightly integrated in the engine and the editor.

GDScript lets you write code using an indentation-based syntax, yet it detects types and offers a static language's quality of auto-completion. It is also optimized for gameplay code with built-in types like Vectors and Colors.

Note that with GDExtension, you can write high-performance code using compiled languages like C, C++, Rust, D, Haxe, or Swift without recompiling the engine.

Zauważ, że obszar roboczy 3D nie zawiera tak wielu narzędzi, jak obszar roboczy 2D. Będziesz potrzebował zewnętrznych programów lub dodatków do edycji terenów, złożonych animacji postaci itd. Godot dostarcza kompletne API rozszerzające funkcjonalność edytora za pomocą kodu gry. Zobacz Edytor Godot jest również grą Godot poniżej.

image4

Dodatek do Godot'a 2 stworzony przez kubecz3k. Umożliwia wizualne zarządzanie stanami i przejściami

Otwarto-źródłowy

Godot oferuje w pełni otwartą bazę kodu źródłowego na licencji MIT. Oznacza to, że wszystkie technologie, które są z nią dostarczane muszą być również otwarte. W większości są one stworzone od podstaw przez deweloperów.

Każdy może podłączyć prawnie zastrzeżone narzędzia na potrzeby swoich projektów - po prostu nie będzie ich dystrybuował wraz z silnikiem. Może to być Google AdMob albo FMOD. Każde z nich może być dostarczane jako wtyczki innych producentów.

Z drugiej strony, otwarta baza kodowa oznacza, że możesz uczyć się i rozszerzać możliwości silnika do własnych potrzeb. Możesz również łatwo debugować gry, ponieważ Godot będzie wypisywał błędy na stosie (stack trace), nawet jeśli pochodzą one z samego silnika.

Informacja

This does not affect the work you do with Godot in any way: there's no strings attached to the engine or anything you make with it.

Tworzony przez społeczność

Godot jest tworzony przez społeczność, dla społeczności i dla wszystkich twórców gier. To potrzeby użytkowników i otwarte dyskusje są inspiracją dla twórców silnika. Nowe funkcje wprowadzane przez głównych deweloperów zazwyczaj koncentrują się na tym, co wspomoże prace większości użytkowników.

Mimo to, choć kilku głównych programistów pracuje nad projektem w pełnym wymiarze godzin, projekt ten w chwili jego tworzenia ma ponad 600 osób. Te osoby często pracują nad funkcjami, których mogą potrzebować sami, więc z każdym wydaniem silnika zauważysz poprawę we wszystkich aspektach silnika.

Edytor Godot jest również grą Godot

Edytor Godot działa na silniku gry. Wykorzystuje on własny system UI, może ładować na bieżąco kod i sceny podczas testowania projektów lub uruchamiać kod gry w edytorze. Oznacza to, że możesz używać tego samego kodu i scen dla swoich gier, lub budować wtyczki i rozszerzać możliwości edytora.

This leads to a reliable and flexible UI system, as it powers the editor itself. With the @tool annotation, you can run any game code in the editor.

image5

RPG in a Box is a voxel RPG editor made with Godot 2. It uses Godot's UI tools for its node-based programming system and for the rest of the interface.

Put the @tool annotation at the top of any GDScript file and it will run in the editor. This lets you import and export plugins, create plugins like custom level editors, or create scripts with the same nodes and API you use in your projects.

Informacja

The editor is fully written in C++ and is statically compiled into the binary. This means you can't import it as a typical project that would have a project.godot file.

Osobny silnik 2D i 3D

Godot offers dedicated 2D and 3D rendering engines. As a result, the base unit for 2D scenes is pixels. Even though the engines are separate, you can render 2D in 3D, 3D in 2D, and overlay 2D sprites and interfaces over your 3D world.