代码:
Welcome to the official documentation of Godot Engine, the free and open source community-driven 2D and 3D game engine! Behind this mouthful, you will find a powerful yet user-friendly tool that you can use to develop any kind of game, for any platform and with no usage restriction whatsoever.
欢迎使用Godot Engine的官方文档,Godot Engine是由社区驱动的免费和开源2D和3D游戏引擎!在这口功能的背后,您将找到一个功能强大且用户友好的工具,可用于开发任何类型的游戏,针对任何平台,并且没有任何使用限制。
This page gives a broad presentation of the engine and of the contents of this documentation, so that you know where to start if you are a beginner or where to look if you need info on a specific feature.
该页面对引擎和本文档的内容进行了广泛介绍,因此,如果您是初学者,则可以知道从哪里开始,或者如果需要特定功能的信息,则可以从哪里知道。
Before you start 在你开始前The Tutorials and resources page lists video tutorials contributed by the community. If you prefer video to text, those may be worth a look.
In case you have trouble with one of the tutorials or your project, you can find help on the various Community channels, especially the Godot Discord community, Q&A, and IRC.
“ 教程和资源”页面列出了社区提供的视频教程。如果您更喜欢视频而不是文本,那么可能值得一看。
如果您对教程之一或项目有任何疑问,可以在各种社区渠道(特别是Godot Discord社区,问答和IRC)上找到帮助。
A game engine is a complex tool, and it is therefore difficult to present Godot in a few words. Here's a quick synopsis, which you are free to reuse if you need a quick writeup about Godot Engine.
Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unified interface. It provides a comprehensive set of common tools, so users can focus on making games without having to reinvent the wheel. Games can be exported in one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows) as well as mobile (Android, iOS) and web-based (HTML5) platforms.
Godot is completely free and open source under the permissive MIT license. No strings attached, no royalties, nothing. Users' games are theirs, down to the last line of engine code. Godot's development is fully independent and community-driven, empowering users to help shape their engine to match their expectations. It is supported by the Software Freedom Conservancy not-for-profit.
For a more in-depth view of the engine, you are encouraged to read this documentation further, especially the Step by step tutorial.
游戏引擎是一个复杂的工具,因此很难用几句话来介绍Godot。这是一个快速的提要,如果您需要关于Godot Engine的快速撰写,可以随意重用。
Godot Engine是功能丰富的跨平台游戏引擎,可通过统一界面创建2D和3D游戏。它提供了一套全面的通用工具,因此用户可以专注于制作游戏,而无需重新发明轮子。一键即可将游戏导出到多种平台,包括主要的桌面平台(Linux,macOS,Windows)以及移动平台(Android,iOS)和基于Web的平台(HTML5)。
在许可的MIT许可下,Godot是完全免费和开源的。没有附加条件,没有特许权使用费,什么也没有。用户的游戏是他们的游戏,一直到引擎代码的最后一行。Godot的开发完全独立且由社区驱动,使用户能够帮助塑造自己的引擎以符合他们的期望。它由非营利性软件自由保护协会支持。
要更深入地了解引擎,建议您进一步阅读本文档,尤其是分步教程。
About the documentation关于Godot文档This documentation is continuously written, corrected, edited, and revamped by members of the Godot Engine community. It is edited via text files in the reStructuredText markup language and then compiled into a static website/offline document using the open source Sphinx and ReadTheDocs tools.
该文档由Godot Engine社区的成员不断编写,更正,编辑和修订。通过使用reStructuredText标记语言的文本文件对其进行编辑 ,然后使用开源Sphinx和ReadTheDocs工具将其编译为静态网站/离线文档。引用:
NoteYou can contribute to Godot's documentation by opening issue tickets or sending patches via pull requests on its GitHub source repository, or translating it into your language on Hosted Weblate.
您可以通过在GitHub 源存储库上打开发布票证或通过拉取请求发送补丁程序,或在Hosted Weblate上将其翻译成您的语言,为Godot的文档做出贡献 。
All the contents are under the permissive Creative Commons Attribution 3.0 (CC-BY 3.0) license, with attribution to "Juan Linietsky, Ariel Manzur and the Godot Engine community".
所有内容均受许可的知识共享署名3.0(CC-BY 3.0)许可,并注明“ Juan Linietsky,Ariel Manzur和Godot Engine社区”。
This documentation is organized in five sections with an impressively unbalanced distribution of contents – but the way it is split up should be relatively intuitive:
该文档分为五个部分,内容分布不平衡,但是拆分方式应该相对直观:
In addition to this documentation you may also want to take a look at the various Godot demo projects.
Have fun reading and making games with Godot Engine!
除了本文档之外,您可能还想看看各种Godot演示项目。
使用Godot Engine享受阅读和制作游戏的乐趣!
Godot is Free and Open-Source Software available under the OSI-approved MIT license. This means it is free as in "free speech" as well as in "free beer."
Godot是经OSI批准的 MIT许可证提供的免费和开源软件。这意味着它是免费的,如“言论自由”和“免费啤酒”一样。
In short:简而言之:
All the contents of this accompanying documentation are published under the permissive Creative Commons Attribution 3.0 (CC-BY 3.0) license, with attribution to "Juan Linietsky, Ariel Manzur and the Godot Engine community."
随附文档的所有内容均根据许可的知识共享署名3.0(CC-BY 3.0)许可发布,并注明“ Juan Linietsky,Ariel Manzur和Godot Engine社区”。
Logos and icons are generally under the same Creative Commons license. Note that some third-party libraries included with Godot's source code may have different licenses.
徽标和图标通常在同一知识共享许可下。请注意,Godot的源代码附带的某些第三方库可能具有不同的许可证。
For full details, look at the COPYRIGHT.txt as well as the LICENSE.txt and LOGO_LICENSE.txt files in the Godot repository.
有关完整的详细信息,请查看Godot存储库中的COPYRIGHT.txt以及LICENSE.txt和LOGO_LICENSE.txt文件。
Also, see the license page on the Godot website.
另外,请参阅Godot网站上的许可页面。
For the editor:
对于编辑者:
For exporting your games:
导出游戏:
Both 32- and 64-bit binaries are supported where it makes sense, with 64 being the default.
合理地支持32位和64位二进制文件,默认为64位。
Some users also report building and using Godot successfully on ARM-based systems with Linux, like the Raspberry Pi.
一些用户还报告说,在具有Linux的基于ARM的系统(例如Raspberry Pi)上成功构建和使用Godot。
Additionally, there is some unofficial third-party work being done on building for some consoles. However, none of this is included in the default build scripts or export templates at this time.
此外,在为某些控制台进行构建时,还进行了一些非正式的第三方工作。但是,此时,默认构建脚本或导出模板中都不包含所有这些。
For more on this, see the sections on exporting and compiling Godot yourself.
有关更多信息,请参阅有关自己导出 和编译Godot的部分。
The officially supported languages for Godot are GDScript, Visual Scripting, C#, and C++. See the subcategories for each language in the scripting section.
Godot官方支持的语言是GDScript,Visual Scripting,C#和C ++。请在脚本部分中查看每种语言的子类别 。
If you are just starting out with either Godot or game development in general, GDScript is the recommended language to learn and use since it is native to Godot. While scripting languages tend to be less performant than lower-level languages in the long run, for prototyping, developing Minimum Viable Products (MVPs), and focusing on Time-To-Market (TTM), GDScript will provide a fast, friendly, and capable way of developing your games.
如果您只是刚开始使用Godot或进行游戏开发,那么GDScript是Godot的母语,因此是推荐学习和使用的语言。从长远来看,脚本语言的性能往往不如低级语言,但对于原型设计,开发最小可行产品(MVP)以及着重于产品上市时间(TTM)而言,GDScript将提供快速,友好且实用的功能。开发游戏的有效方法。
Note that C# support is still relatively new, and as such, you may encounter some issues along the way. Our friendly and hard-working development community is always ready to tackle new problems as they arise, but since this is an open-source project, we recommend that you first do some due diligence yourself. Searching through discussions on open issues is a great way to start your troubleshooting.
请注意,C#支持仍是相对较新的,因此,在此过程中可能会遇到一些问题。我们友好而努力的开发社区随时准备解决新问题,但是由于这是一个开源项目,因此我们建议您首先自己进行尽职调查。搜索有关未解决问题的讨论是开始进行故障排除的好方法。
As for new languages, support is possible via third parties using the GDNative / NativeScript / PluginScript facilities. (See the question about plugins below.) Work is currently underway, for example, on unofficial bindings for Godot to Python and Nim.
对于新语言,可以使用GDNative / NativeScript / PluginScript工具通过第三方提供支持。(请参阅下面有关插件的问题。)例如,正在进行有关Godot与Python和Nim的非正式绑定的工作。
GDScript is Godot's integrated scripting language. It was built from the ground up to maximize Godot's potential in the least amount of code, affording both novice and expert developers alike to capitalize on Godot's strengths as fast as possible. If you've ever written anything in a language like Python before then you'll feel right at home. For examples, history, and a complete overview of the power GDScript offers you, check out the GDScript scripting guide.
GDScript是Godot的集成脚本语言。它是从头开始构建的,旨在以最少的代码最大程度地发挥Godot的潜力,使新手和专家开发人员都可以尽快利用Godot的优势。如果您曾经用Python这样的语言编写过任何东西,那么您会感到宾至如归。有关示例,历史记录以及GDScript为您提供的强大功能的完整概述,请查阅GDScript脚本指南。
There are several reasons to use GDScript--especially when you are prototyping, in alpha/beta stages of your project, or are not creating the next AAA title--but the most salient reason is the overall reduction of complexity.
使用GDScript的原因有很多-特别是在原型设计,项目的alpha / beta阶段或未创建下一个AAA标题时-但最明显的原因是总体上降低了复杂性。
The original intent of creating a tightly integrated, custom scripting language for Godot was two-fold: first, it reduces the amount of time necessary to get up and running with Godot, giving developers a rapid way of exposing themselves to the engine with a focus on productivity; second, it reduces the overall burden of maintenance, attenuates the dimensionality of issues, and allows the developers of the engine to focus on squashing bugs and improving features related to the engine core--rather than spending a lot of time trying to get a small set of incremental features working across a large set of languages.
为Godot创建紧密集成的自定义脚本语言的初衷是双重的:首先,它减少了启动和运行Godot所需的时间,从而为开发人员提供了一种快速专注于引擎的方法。关于生产力;其次,它减少了总体维护负担,减轻了问题的严重性,并使引擎的开发人员能够专注于解决错误并改善与引擎核心相关的功能,而不必花费大量时间来尝试解决问题。跨多种语言工作的一组增量功能。
Since Godot is an open-source project, it was imperative from the start to prioritize a more integrated and seamless experience over attracting additional users by supporting more familiar programming languages--especially when supporting those more familiar languages would result in a worse experience. We understand if you would rather use another language in Godot (see the list of supported options above). That being said, if you haven't given GDScript a try, try it for three days. Just like Godot, once you see how powerful it is and rapid your development becomes, we think GDScript will grow on you.
由于Godot是一个开源项目,因此从一开始就必须优先考虑更集成和无缝的体验,而不是通过支持更熟悉的编程语言来吸引更多用户-特别是在支持那些更熟悉的语言会导致更糟糕的体验时。我们了解您是否愿意在Godot中使用其他语言(请参阅上面支持的选项列表)。话虽如此,如果您没有尝试GDScript,请尝试三天。就像Godot一样,一旦您看到它强大而迅速的发展,我们就会认为GDScript将对您有所帮助。
More information about getting comfortable with GDScript or dynamically typed languages can be found in the GDScript: An introduction to dynamic languages tutorial.
有关适应GDScript或动态类型的语言的更多信息,请参见GDScript:动态语言简介教程。
In the early days, the engine used the Lua scripting language. Lua is fast, but creating bindings to an object oriented system (by using fallbacks) was complex and slow and took an enormous amount of code. After some experiments with Python, it also proved difficult to embed.
在早期,引擎使用[color=var(--link-color-visited)]Lua 脚本语言。Lua很快,但是创建到面向对象系统的绑定(通过使用后备)很复杂且很慢,并且花费了大量代码。经过使用[color=var(--link-color-visited)]Python的一些实验之后 ,它也被证明很难嵌入。
The main reasons for creating a custom scripting language for Godot were:
为Godot创建自定义脚本语言的主要原因是:
GDScript was designed to curtail the issues above, and more.
GDScript旨在减少上述问题,甚至更多。
Godot supports Collada via the OpenCollada exporter (Maya, 3DSMax). If you are using Blender, take a look at our own Better Collada Exporter.
Godot通过[color=var(--link-color-visited)]OpenCollada导出器(Maya,3DSMax)支持Collada 。如果您使用的是Blender,请查看我们自己的[color=var(--link-color-visited)]Better Collada Exporter。
As of Godot 3.0, glTF is supported.
从Godot 3.0开始,支持glTF。
FBX is supported via the Open Asset Import library. However, FBX is proprietary so we recommend using other formats listed above, if suitable for your workflow.
通过开放资产导入库支持FBX。但是,FBX是专有的,因此,如果适合您的工作流程,我们建议使用上面列出的其他格式。
The aim of Godot is to create a free and open-source MIT-licensed engine that is modular and extendable. There are no plans for the core engine development community to support any third-party, closed-source/proprietary SDKs, as integrating with these would go against Godot's ethos.
Godot的目标是创建一个模块化的可扩展的免费开放源代码的MIT许可引擎。核心引擎开发社区尚无计划支持任何第三方,封闭源/专有的SDK,因为与它们集成会违反Godot的精神。
That said, because Godot is open-source and modular, nothing prevents you or anyone else interested in adding those libraries as a module and shipping your game with them--as either open- or closed-source.
就是说,由于Godot是开放源代码和模块化的,因此您或任何有兴趣将这些库添加为模块并随其附带发行您的游戏的人,无论是开放源代码还是封闭源代码,都无法阻止。
To see how support for your SDK of choice could still be provided, look at the Plugins question below.
要查看仍如何提供对所选SDK的支持,请查看下面的插件问题。
If you know of a third-party SDK that is not supported by Godot but that offers free and open-source integration, consider starting the integration work yourself. Godot is not owned by one person; it belongs to the community, and it grows along with ambitious community contributors like you.
如果您知道Godot不支持的第三方SDK,但是它提供了免费和开源的集成,请考虑自己开始集成工作。Godot不是一个人所有;它属于社区,并且与像您一样的雄心勃勃的社区贡献者一起成长。
This question pops up often and it's probably thanks to the misunderstanding created by Apple when they originally doubled the resolution of their devices. It made people think that having the same assets in different resolutions was a good idea, so many continued towards that path. That originally worked to a point and only for Apple devices, but then several Android and Apple devices with different resolutions and aspect ratios were created, with a very wide range of sizes and DPIs.
这个问题经常出现,这可能是由于苹果最初将设备分辨率翻倍时造成的误解。人们认为在不同的决议中拥有相同的资产是一个好主意,因此许多人继续朝着这条道路前进。最初只适用于Apple设备,但是后来创建了具有不同分辨率和宽高比的几款Android和Apple设备,具有各种尺寸和DPI。
The most common and proper way to achieve this is to, instead, use a single base resolution for the game and only handle different screen aspect ratios. This is mostly needed for 2D, as in 3D it's just a matter of Camera XFov or YFov.
实现此目的的最常见,最正确的方法是,对游戏使用单一的基本分辨率,并且仅处理不同的屏幕纵横比。这对于2D来说是最需要的,因为在3D中,这只是Camera XFov或YFov的问题
And that's it! Your game should work in multiple resolutions.
就是这样!您的游戏应在多种分辨率下工作。
If there is a desire to make your game also work on ancient devices with tiny screens (fewer than 300 pixels in width), you can use the export option to shrink images, and set that build to be used for certain screen sizes in the App Store or Google Play.
如果希望您的游戏也能在具有小屏幕(宽度小于300像素)的古老设备上运行,则可以使用导出选项来缩小图像,并在应用程序中将生成的图像设置为用于某些屏幕尺寸商店或Google Play。
For extending Godot, like creating Godot Editor plugins or adding support for additional languages, take a look at EditorPlugins and tool scripts.
要扩展Godot,例如创建Godot Editor插件或添加对其他语言的支持,请查看EditorPlugins 和工具脚本。
Also, see the official blog posts on these topics:另外,请参阅有关这些主题的官方博客文章:
You can also take a look at the GDScript implementation, the Godot modules, as well as the unofficial Python support for Godot. This would be a good starting point to see how another third-party library integrates with Godot.
您还可以查看GDScript实现,Godot模块以及对Godot 的非官方Python支持。这将是了解另一个第三方库如何与Godot集成的良好起点。
Awesome! As an open-source project, Godot thrives off of the innovation and ambition of developers like you.
太棒了!作为一个开源项目,Godot摆脱了像您这样的开发人员的创新和野心
The first place to get started is in the issues. Find an issue that resonates with you, then proceed to the How to Contribute guide to learn how to fork, modify, and submit a Pull Request (PR) with your changes.
首先要解决的是问题。找到引起您共鸣的问题,然后继续阅读《如何贡献》 指南,以了解如何对您的更改进行派生,修改和提交“拉取请求”(PR)。
It might be tempting to want to bring ideas to Godot, like ones that result in massive core changes, some sort of mimicry of what another game engine does, or alternative workflows that you'd like built into the editor. These are great, and we are thankful to have such motivated people want to contribute, but Godot's focus is and always will be the core functionality as outlined in the Roadmap, squashing bugs and addressing issues, and conversations between Godot community members.
想要将想法带入Godot可能很诱人,例如那些导致大量核心更改的想法,对其他游戏引擎的模仿,或者您希望在编辑器中内置的替代工作流。这些都是伟大的,我们很感激有这样的上进心的人想参与,但戈多的重点是而且将永远是相同的核心功能在列出路线图, 挤压错误和解决问题,而戈多社区成员之间的对话。
Most developers in the Godot community will be more interested to learn about things like:
Godot社区中的大多数开发人员将对以下方面的知识更加感兴趣:
Please don't feel like your ideas for Godot are unwelcome. Instead, try to reformulate them as a problem first, so developers and the community have a functional foundation to ground your ideas on.
请不要觉得您对Godot的想法不受欢迎。相反,请尝试首先将它们重新定义为问题,以便开发人员和社区具有功能基础,可将您的想法作为基础。
A good way to approach sharing your ideas and problems with the community is as a set of user stories. Explain what you are trying to do, what behavior you expect to happen, and then what behavior actually happened. Framing problems and ideas this way will help the whole community stay focused on improving developer experiences as a whole.
与社区共享您的想法和问题的一种好方法是作为一组用户故事。说明您要做什么,您预期会发生什么行为,然后实际发生什么行为。通过这种方式解决问题和想法将有助于整个社区专注于改善整体开发人员的体验。
Bonus points for bringing screenshots, concrete numbers, test cases, or example projects (if applicable).
带来截图,具体数字,测试用例或示例项目(如果适用)的加分点。
Godot is meant to be used with its editor. We recommend you give it a try, as it will most likely save you time in the long term. There are no plans to make Godot usable as a library, as it would make the rest of the engine more convoluted and difficult to use for casual users.
Godot旨在与其编辑器一起使用。我们建议您尝试一下,因为从长远来看,它很可能会节省您的时间。目前尚无计划使Godot可用作库,因为这会使引擎的其余部分更加混乱,难以为临时用户使用。
If you want to use a rendering library, look into using an established rendering engine instead. Keep in mind rendering engines usually have smaller communities compared to Godot. This will make it more difficult to find answers to your questions.
如果要使用渲染库,请考虑使用已建立的渲染引擎。请记住,与Godot相比,渲染引擎通常具有较小的社区。这将使查找问题的答案变得更加困难。
Like many other libraries (Qt as an example), Godot does not make use of STL. We believe STL is a great general purpose library, but we had special requirements for Godot.
像许多其他库一样(以Qt为例),Godot不使用STL。我们认为STL是一个很棒的通用库,但是我们对Godot有特殊要求。
We believe games should not crash, no matter what. If an unexpected situation happens, Godot will print an error (which can be traced even to script), but then it will try to recover as gracefully as possible and keep going.
我们认为游戏无论如何都不会崩溃。如果发生意外情况,Godot将打印错误(甚至可以追溯到脚本),但是它将尝试尽可能优雅地恢复并继续运行。
Additionally, exceptions significantly increase binary size for the executable.
此外,异常会大大增加可执行文件的二进制大小。
Godot provides its own type-casting system, which can optionally use RTTI internally. Disabling RTTI in Godot means considerably smaller binary sizes can be achieved, at a little performance cost.
Godot提供了自己的类型转换系统,可以选择在内部使用RTTI。在Godot中禁用RTTI意味着可以以较小的性能成本实现更小的二进制大小。
While Godot internally for a lot of the heavy performance tasks attempts to use cache coherency as well as possible, we believe most users don't really need to be forced to use DoD practices.
虽然Godot在内部执行许多繁重的性能任务时会尽可能尝试使用缓存一致性,但我们认为实际上并不需要强迫大多数用户使用DoD做法。
DoD is mostly a cache coherency optimization that can only gain you significant performance improvements when dealing with dozens of thousands of objects (which are processed every frame with little modification). As in, if you are moving a few hundred sprites or enemies per frame, DoD won't help you, and you should consider a different approach to optimization.
DoD主要是缓存一致性优化,在处理成千上万个对象(几乎不做任何修改就可以处理每个帧)时,只能获得显着的性能改进。例如,如果您每帧移动几百个精灵或敌人,DoD将无济于事,您应该考虑使用其他优化方法。
The vast majority of games do not need this and Godot provides handy helpers to do the job for most cases when you do.
绝大多数游戏都不需要这样做,而Godot在大多数情况下都会为您提供方便的助手来完成这项工作。
If a game that really needs to process such large amount of objects is needed, our recommendation is to use C++ and GDNative for the high performance parts and GDScript (or C#) for the rest of the game.
如果确实需要处理大量对象的游戏,我们的建议是对高性能部件使用C ++和GDNative,对于其余部分使用GDScript(或C#)。
See Ways to contribute.
See the corresponding page on the Godot website.
该页面旨在列出Godot当前支持的所有功能。
引用:
注意本页列出了当前稳定版本的Godot(3.2)支持的功能。 最新开发版本(4.0)中提供了更多功能。
可以同时运行编辑器和导出项目:
运行导出的项目:
Godot的目标是尽可能地独立于平台,并且可以相对轻松地移植到新平台。
特征:
外挂程式:
提供两个渲染器:
特征:
物理机构:
碰撞检测:
提供两个渲染器:
相机:
基于物理的渲染:
实时照明:
阴影贴图:
间接照明的整体照明:
感言:
天空:
多雾路段:
粒子:
后期处理:
纹理过滤:
纹理压缩:
抗锯齿:
这些效果中的大多数都可以调整以获得更好的性能或进一步改善质量。使用Godot进行脱机渲染时,这可能会有所帮助。
物理机构:
碰撞检测:
一般:
GDNative(C,C ++,Rust,D等):
特征:
使用的API:
格式:
Godot的GUI使用与Godot中制作游戏相同的Control节点构建。使用插件可以很容易地以多种方式扩展编辑器UI。
节点:
浆纱:
主题:
Godot的发行规模较小,可以使其适合替代Electron或Qt之类的框架。