Godot-StartUP

创建于:2018-07-28

创建人: Justus

44 信息 140 成员
讨论基于Godot以及Unity引擎的游戏开发经验,理论和最佳实践。共享一些通用思路以启发另一种生产工具中的实践。独立开发群QQ: 122017359

Godot实践 Q&A

Justus 2018-09-28

Godot Q&A

Godot 3.0.6

1. _enter_tree() vs _ready()

[reddit] enter_tree() vs. ready(), etc. Are there rules of thumb regarding which initialization function to do my housekeeping?

2. 如何用脚本connect signals?

[reddit] explain to me how to use the signals in Godot, please.

3. collision layer 和 collision mask有什么区别

[GodotQ&A] What's the difference between Collision layers and Collision masks?
[GodotQ&A] Collision masks and its propper uses

4. 如何在pc上打开触屏模式?

Project Settings->Display->Emulate Touchscreen
[GodotQ&A] How can i show touch screenbuttons only on android devices?

5. 为什么tilemap会闪烁

Open issue, 把quadrant size 设为1就不闪了
[GithubIssue] Tilemap/draw_rect random flickering with Nvidia drivers

6. windows平台的导出exe图标设置没有效果

godot已知bug,自己用resource hack改

Resource Hacker 简介

A freeware resource compiler & decompiler for Windows® applications
Resource Hacker HomePage

7. NavigationPolygonInstance 为什么无法多个同时起效?

注意拼接要严丝合缝,即相邻边拥有共同顶点。
[Blog] [godot]navigation2d的一些坑

8. 如何用print格式化输出?

print("%s" % value)  
print("%s...%s" % [value1,value2,...])

9. 两个引用所指的碰撞对象是不是同一个,有什么办法判断吗?

Resource Id.

CollisionObject.get_rid().get_id()
CollisionObject2D.get_rid().get_id()

10. 有什么方式记录下collisionLayer的用途约定么?

有。给每个layer命名。
Project Settings->General->Layer Names

11. free() vs queue_free()

12. 为什么RayCast/RayCast2D 只有 Collision Mask而没有Collision Layer? 这意味着什么?

这意味着其他人不能决定自己是否和raycast碰撞,只有RayCast可以决定自己打算和处于哪些Layer的对象碰撞。

13. 为什么Godot没有现成的FSM?这会影响它的易用性么?

J: 我不知道。不会影响易用性。
因为动画系统通常包含着一个天然的FSM,除了transition。Godot 在之后的版本中会加入一个与动画系统协作的状态机。但这并不是很有必要。
因为对于简易的状态机而言,几乎总是能用enum加一个状态转移方法来完成。对于复杂的状态机而言,动画系统的状态和实际的逻辑状态机通常会不一样,并且FSM在并发和层次用途同时出现的情况下并不是最好的选择。 个人推荐仅在简单和并发状态下考虑状态机。通常层次状态机的场景你可以通过一些设计来改变成并发状态。
如果你真的寻求复杂的决策实现并且被层次状态机的可扩展性弄得精疲力尽,那么推荐使用行为树(behavior tree)

14. 什么是行为树?Godot 3有现成的实现么?

一种AI算法。
一种梳理逻辑决策的解决方案。
它解决的问题与复杂的状态机类似。通常由一个树结构+黑板来实现。
Godot中没有内置的实现。有其他开发者提供的插件实现(Godot 3可用)。
开发者务必阅读链接文章。如果你毫无编程经验,那么请向你家的软件设计师寻求符合你需要的简单解释。在一些游戏引擎中会内置BT功能,他们的文档也许是不错的选择。

行为树参考:
[Wikipedia] Behavior tree (artificial intelligence, robotics and control)
Behavior trees for AI: How they work
[SO] Behavior Tree Implementations

15. 默认函数_xxxx在子类中如何被调用?

总是在子类的覆写实现之前自动被调用。

Remember that default functions like _init, and most notifications such as _enter_tree_exit_tree_process_physics_process, etc. are called in all base classes automatically. So there is only a need to call the function explicitly when overloading them in some way.

[GodotDocs] GDScript

16. 如何设置新的随机种子?

randomize()

17. 如何设置断言?

assert a==b

18. 如何获取run time type?

is
get_class()

19. 如何脚本创建timer?

get_tree().create_timer(1.5)

20. 某个节点如何获取编辑他的场景的根节点?

Node.owner

21. 如何使用AutoTile?

[GodotQ&A] How do I use the AutoTile in Godot 3.0?

22. 使用其他线程创建实例为什么感觉这么慢?

对,是个已知问题。
[GithubIssue] Multithreaded instancing performance (RID caching needs to be completed) #10970 
[blog] 关于godot中多线程生成场景加入主场景问题

23. Tiled可以和godot 3一起工作么?

可以,AssetLib搜索插件Tile Map Importer。
[Youtube] How to Import Maps from Tiled in Godot
[reddit] Importing from Tiled with collisions?

24. set_process,set_physics_process,set_process_input 是默认为true的吗?

是的。不同于Godot 2, 在Godot 3中他们默认为true。

25. 什么情况下属性的setter,getter才会被调用?

外部访问时。内部用self.prop1的方式访问时。

26. gdscript 有哪些内建函数可用?

[GodotDocs] @GDScript

27. gdscript 有访问限定符么?没有的话如何控制访问权限?

没有 access modifier.
语法上不能控制。设计上依然可以通过良好的约定和命名法来表征设计约束。
Keep it simple and stupid.
[Widipedia] Access Modifiers
KISS (Keep it Simple, Stupid) - A Design Principle

28. 为什么我的派生场景无法访问父场景的成员变量?

情况之一: 如果你的父场景自带一个脚本,派生场景不带脚本,会无法访问。这种情况下,应取消父场景中脚本的绑定,在子场景中重新绑定一次父脚本或者创建一个继承于父脚本的新脚本。
[GithubIssue] GDScript: Parent variables aren't accessible in sub classes

29. 为什么godot编辑器对我的键盘输入没反应了?

切换完输入法以后请额外按一次Ctrl以解除这个状态。

30. 如何全局自定义鼠标光标? (为什么它不工作?)

TBD
[GodotDocs] Customizing mouse cursor

31. 关于svg格式的支持

[GodotQ&A] Is there .SVG file support for Godot?

32. 如何得到String中的每一个字符?

[GodotQ&A] How to split a string character by character?

33. 如何得知node是否被free?

[GodotQ&A] How to know a node is freed (or deleted)

34. 如何检查手柄是否连接?

[GodotQ&A] Check if Controller connected or not

35. 如何检查一个变量是否存在?

if "varName" in get_parent(): print("varName is defined in parent!")
[GodotQ&A] Check if script of a node has variable

36. 为什么游戏总是会对手柄输入进行响应,即使窗口已经失去焦点?有什么办法能控制是否屏蔽这种行为么?

取决于OS的处理,通常OS总是会把手柄响应发给程序,而键盘输入则不同。
如下方法可以获知焦点状况。

func _notification(what):
    if what == MainLoop.NOTIFICATION_WM_FOCUS_OUT: 
        Unfocused = true
    elif what == MainLoop.NOTIFICATION_WM_FOCUS_IN: 
        Unfocused = false

[GithubIssue] Games receive joypad input even if the game window is not focused

37. 如何导出Android apk?

导出三件套

Godot 3.1

1. 如何使用3.1新特性 typed GDScript?

LEARN TO WRITE TYPED GDSCRIPT IN GODOT 3.1

Networking

1. localhost、127.0.0.1 和 本机IP 三者的区别?

[知乎] localhost、127.0.0.1 和 本机IP 三者的区别?
[百度知道] localhost,127.0.0.1 和 本机IP 三者的区别

一般话题

1. 如何在GLSL中将RGB值转化为HSV?

[SO] From RGB to HSV in OpenGL GLSL

2. 如何描述FSM?该从哪里开始?

可以使用UML来描述。
[Wikipedia] Unified Modeling Language
[Wikipedia] UML state machine
State Machine Diagram Tutorial
[blog] 【学习小记】UML——状态机图

Git

1. fast forward 是什么?

Git fast forwards and branch management

2. rebase 是什么?

Merging vs. Rebasing
Don't Be Scared of git rebase

MarkDown

  1. 关于MarkDownDaring Fireball: Markdown Syntax Documentation

Other Tools

1. 有哪些开源免费的绘画工具?

GIMP, Krita, Aseprite
GIMP - GNU Image Manipulation Program
Krita | Digital Painting. Creative Freedom.
Aseprite - Animated sprite editor & pixel art tool

2. 有哪些tilemap 编辑器?

Tiled Map Editor | A flexible level editor
[Docs] Tiled Documentation

3. 制作系统UML图和FSM图有什么工具吗?

VP Online
Lucidchart: Online Diagram Software & Visual Solution

4. 常见游戏术语的定义

Gaming Dictionary

5. 动作设计软件

MakeHuman
[Youtube] MakeHuman 1.1 -- A Completely Free 3D Character Creator
design doll
[Youtube] [TUTORIAL] Design Doll
iclone
Daz3D
Daz3D Documentation Center

6.函数绘制

Desmos

7.界面设计原型工具

Pencil Project

(转发自:原日志地址
 

加入 indienova

  • 建立个人/工作室档案
  • 建立开发中的游戏档案
  • 关注个人/工作室动态
  • 寻找合作伙伴共同开发
  • 寻求线上发行
  • 更多服务……
登录/注册