Replies: 2 comments 2 replies
-
Looking at the existing Nodes these are the resons I can see to implement something as a Node:
Of course, this is only looking at one side of the argument, we also need to see reasons why not to implement something as a Node. It is OK to have two ways to do something. For example, one high level and one low level. In fact, when there are compeeting ways to do something it makes sense to build them on top of a common foundation (either via a low level API, or via inheritance). When the ways to do something become a maintenance burden, then it makes sense to remove the less powerful one once we know it could be built on top of the other. But that does not mean the removed implementation was wrong. I want to highligh that sometimes a Resource is another way to implement a feature. For example, instead of a NinePatchRect we could have a NinePatchStyleBox. Also, sometimes the low level API exists but is not exposed. For example the low level API for playing audio is not exposed. It should be! |
Beta Was this translation helpful? Give feedback.
-
I am new to the Godot community, so I wanted to provide insight on this topic from that perspective, and I hope it's helpful.. I want to start by saying that one of the reasons for this divide might come from the doc "Overview of Godots key concepts"
(Emphasis original) Later on in the introduction's Step by Step""Nodes and Scenes" explicitly states:
(Emphasis original) So some of the earliest exposure to learning Godot focuses on the importance of Nodes. "Overview of Godot's key concepts" was available for the first time in 3.4, which is the same release where "Scenes and Nodes" became "Nodes and Scenes" and "Nodes are fundamental building blocks for creating a game" became "the fundamental building blocks" (emphasis mine). This also coincides with a large bump in Godot's popularity. Most of the Manual is also written to accommodate using the editor/Nodes. It's confusing mixed-messaging to read the manual, and then see opposition to things being a Node. The Godot interface feels like it wants there to be a very clear and distinct difference between editing Nodes and editing scripts, and it often feels arbitrary and pointless. Almost like Godot wants Nodes to only represent visual elements - even though this isn't how the engine works. Quick examples:
I think that if this divide was better addressed, we would find it wouldn't matter as much if something was a Node or not. One way I could see addressing it specific to this discussion would be some way of exposing a general Object in the scene tree. This negates the only argument I've seen presented against classes like Tween being Nodes - that it adds extra work to the Godot Developer making or maintaining the feature, while allowing all of the benefits of having these Objects be nodes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Introduction
There seems to be a consensus that Nodes are at the core of Godot's philosophy. However, there is no clear rules or principle that let the community of developers decide easily when a feature should be implemented as a Node. This can sometimes create tension, hot debates and frustration.
I am opening this discussion so that the community of gamedev, engine dev and maintainer can reflect together on why do we have Nodes, what is their role, and so when should a feature be a Node?
First, let's state the problem, a lot of features can be implemented either:
For instance, the Tween feature is currently at the center of a hot debate, because it was implemeted as a Node in Godot 3, and then reimplemeted as a set of functions in Godot 4, and the Node was removed. Some argued that there is no need to have both, but in fact there are many features that are implemeted both as a set of functions and as a Node (e.g. Raycasts, Timers).
Furthermore, new comers can be confused as to why we can do Raycast as a node, or as a function call in script. I believe this confusion can be resolved by understanding, as a community, why/when we should use Nodes, and writte that principle in the documentation.
Nodes vs Function calls, my personal take
I personally believe that Raycast and Tween should both be implemented as a Node and as a set of functions. Nodes are about exposing functions/features in the Editor. While set of functions are about letting the programmers do they own stuffs, and not expose everything in the editor.
Here is my take on when to use a Node rather than a function call:
Add Node
menu: all users know about theAdd Node
button. New users easily discover useful features from there, and go further with scripting later on (e.g. Timer).So in short, Nodes are about exposing a feature in the editor.
Reciprocally, here is my take on when using a set of functions (i.e. script only):
Is it really more work to implemented both the Node and the Set of Functions?
@Calinou recently raised the point that they needed to chose between a Tween Node or a Tween set of functions, cause it is too much work to maintain both. But let's say we implement a Tween Node, won't we be writting a Tween set of functions to support that Node anyway? Maybe we could write Nodes so that they are based on the same set of functions we want to expose to the programmers in the API?
Suggested Principle:
Let's see where this discussion goes!
Thank you reading, please let me know what you think below!
Beta Was this translation helpful? Give feedback.
All reactions