Core vs Module
Asked Answered
I

4

0

I am looking through the engine code, and I'm trying to get a grasp of the functional reasons and the philosophy behind the distinction between Core components and Module components. I'm having a very hard time finding any writing about this on the internet. What makes something belong in core/, and what makes something belong in modules/? Does the engine functionally handle inhabitants of modules/ different than those of core/?

My impression is that Core components are things which are absolutely essential to the engine's functioning, whereas Modules are things which can be done without or replaced. In practice though it seems to be murkier. I'll give two examples.

The Input system lives inside core/. This makes sense. Every program will need some input, and even the Godot Editor uses Input to handle the user interacting with the editor. However, perhaps I want to replace Input with a different input system. Perhaps I want to simply extend its functionality. I came across this proposal which has been stuck in limbo for a while. The proposer would like to add support for two or more mice and for that to correctly propagate via InputEvents. This is not something which is easily solved without modifying Input and other classes which live in core/. For reasons such as these, it seems like it would make sense for Input and related to be a Module.

GDScript is inside modules/. This makes sense. You could strip out GDScript and make a game entirely with C++ if you want to. However, the GDScript module and the script-editing-related classes under editor/ are interdependent. The editor overall won't function quite right without either of them.

So I feel like I could use some help understanding the decision-making and the dichotomy. Any thoughts are appreciated, and I have some specific questions regarding Input. Would it make sense for Input to exist as a module? Would it actually make a functional difference for it to be a module? Does that have any affect on performance or compilation? Is it any easier to maintain a git branch with a modified module than a branch with a modified core component? Would it make any sense to create a proposal for extracting Input into a module?

Hoping this post catches the eyes of someone wiser in the ways of the engine than I!

Illdisposed answered 29/8, 2023 at 5:19 Comment(0)
M
0

Hi,

one good reason for that is export size optimization as export templates are in fact an headless engine "editor" to act as an interpreter for the code.

Didn't tried it yet but removing features that are not needed for a game can be interesting.

Moureaux answered 29/8, 2023 at 6:36 Comment(0)
I
0

Well, that isn't quite what I was asking. I know that modules can be stripped out for export size optimization. I am asking to discuss the rationale behind what important engine features can be modules and what that means. Ultimately I'm looking for reasoning behind why Input could or cannot be a module.

Illdisposed answered 29/8, 2023 at 19:5 Comment(0)
J
0

In my experience, the people who can answer this kind of question rarely participate here. You might get an answer in the Godot Contributors Chat or the Godot Discord.

If you get an answer, please post it here. I'm interested in it.

Jinni answered 29/8, 2023 at 19:25 Comment(0)
D
0

core and modules are just folders that logically organize source files. There is no special difference in functionality between the two. It's all just a bunch of c++ class files. I'd guess that stuff in core folder is fundamental to engine architecture i.e. it's the skeleton of the engine, while stuff that builds upon that is placed in other folders, including modules

Devland answered 29/8, 2023 at 21:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.