-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Built-In scripts should be removed for v4 (or the limitations better advertised) #31758
Comments
Also, such built-in scripts are going to be exposed as plain text once exported, which in most cases not desired imo, and they cannot be encrypted (same goes for built-in shaders unfortunately). |
It's also strange how I manage to make existing scripts to become built-in on accident, and then realize I've edited the wrong script. If this is a bug, I'm not even willing to report it because of mentioned issues already present with built-in scripts. 😛 |
I think the feature is great and should not be removed. But indeed it might be good to add a warning in the documentation to avoid problem. |
I like the built-in script also. |
I agree with @jaykyburz
It's very disappointing to find out bug by ourselves while we use Godot, if the limitations are correctly advertised, they don't even "look like bugs" anymore (they're just limitations, right?) and the frustration is gone. 4 of the issues listed are still open. |
I also think we should remove built-in scripts in 4.0 due to the various limitations and their worse VCS-ability. This would mean it's no longer possible to distribute single "component" files that include everything (scene and scripts), but that doesn't seem to be a goal for most people anyway. |
I love in-built scripts simply because I don't need to care where to save the script file. Additionally, the scene file is self-contained and safe to pass around. However, I can see the problems in-built scripts cause, and I agree on the VCS issue as well. If we remove built-in scripts, I would suggest (maybe as an option) that godot takes full control on where to store these scripts in a standardized way. So the user doesn't have take care as of where to store all the scripts belonging to one scene. Even more useful when renaming nodes (the attached script file should rename itself too), or "saving branch as Scene", in which case the scripts of the extracted scene need to be moved to an appropriate folder to comply with the to be defined standard. In my mind, this is a way to keep most of the comfort and modularity built-in scripts provide. |
This partially addresses godotengine#31758.
This partially addresses godotengine#31758. (cherry picked from commit ac210e1)
Please don't remove built-in scripts. |
Are there any such projects out there in the wild, though? The only usecase for a built-in is when it's a one-liner or so... |
Mine sure does. Specially for UI elements that don't require much more than initializing some icon or text label or changing a color based on it being used for an enemy or a player character, or just very simple effects to show stuff like damage numbers progressively writing themselves, or something like a generic lightweight life bar with its own simple _draw() routine. |
To be honest there's just too many changes already which justify a complete rewrite of a project from scratch (if you're still at the development stage), and we may expect even more compatibility breakage in 3.2 → 4.0 compared to 2.1 → 3.0... My previous claim:
may be outdated because of: #38308 So I'm for better documentation regarding this. Not to mention I had some ideas of creating test scenes with built-in scripts, but I wouldn't want to use built-in scripts "in production" as they say anyways. Also that's kinda how the engine works as reduz would say, so removing support might not be trivial anyways. |
I mean, I'm trying to provide a counterpoint, since it's assumed no one cares/wants this. My project is a RPG, meaning it's very heavy on menus and small interface nodes that provide info that need to be reused frequently (the node itself, not the script controlling different nodes). If it ends up being a final decision, some tool that can decouple and link the builtins to separate script files should be ideal. |
I don't think game developers should expect to be able to port their complex projects painlessly to a new version of the engine every time a major version comes out. Even commercial engine projects break compat in non-trivial ways. To be able to ship anything, you have to stick to a version and yeah, unfortunately, it sometimes means not being to take advantage of the freshest updates. This is all to say 'it will be a pain to port built-in scripts' is not a good reason to not get rid of them. |
I agree with @TicklesTheBrain. We should not carry a bad feature across major features "just because". The only plus off this feature is that you can have one less file in the filesystem. There are many downsides. |
My 2 cents on this: If you're making a big enough project, you're going to end up with a lot of scripts (and other files) in your project folder anyway. Stuffing one-liners into built-ins could spare you a couple of files in the project directory but in the end it wouldn't be much difference. Removing built-ins could also theoretically promote better project dir organization as the place where you could put a script in a fire-and-forget manner would be gone, which would make you actually think of where to put it. |
I would just like to point out another possible way to deal with built-in scripts: Make them work. |
@mrimvo Making them work seamlessly with external editors is arguably a difficult task. Let's not forget about external tools such as godot-gdscript-toolkit as well.
If your scene only has a single script, it's recommended to place the script in the same folder with the same name (only the file extension will differ). See Project organization in the documentation for details. |
#37565 is already merged, the warning is very informative, it won't prevent users from using built-in scripts, but instead advise them that there are known bugs (this way, they don't need to confusedly search for help online, or on the Issues page on GitHub, where we are). I think that warnings for known bugs should be welcome, the worst part of facing bugs, IMO, is not knowing what is happening and spend hours investigating it. When you know the existence of a bug, you just get around it and enjoy the engine. |
The limitations are already warned, but some people will continue using it because it is a useful feature, and they don't want it to be removed. Instead, maybe it should be reworked. I had an idea. Instead of
This practically solves ALL the current issues built-in scripts while preserving the feature, while also making it really easy to integrate with external editors (which I really, really appreciate :D, see #29863). |
I suggest to go back to the roots and ask what people really want from built-in scripts. In my understanding, it is to get rid of those Built-in scripts have the distinct advantage that they can drastically reduce the amount of files one has to browse in the FileSystem panel, and that they bundle logic together with the one scene or node it is every going to be used with. I think that this functionality definitely has its place and should not be forsaken, but I agree that it should be approached differently: no longer as built-in scripts, but rather as "discrete" scripts that are their own Here - at the bottom of the comment - you can find a proposition to solve this that I find is a little bit less convoluted than marcospb19's and mrimvo's concept. Basically, most of the functionality already exists by utilizing the fact that Godot hides files prefixed with |
@Serenitor One problem with your argument is that this situation isn't always the case, there isn't always a pair. It's perfectly possible to have scenes without scripts, or multiple scripts to a scene, or one script in many scenes. The proposal you linked is useful for more than just pairs as it handles the multiple scripts to a scene case, but your solution only handles one script per scene. This isn't a dismissal of your argument, handling one use case is fine if you can argue that it's a strong usability improvement and it's a common enough use case, but just keep in mind that it's often good to build general-purpose tools. For me, the general-purpose solution would be to just use external scripts with no special behavior. Copy/pasting part of my reply from godotengine/godot-proposals#1274 here, which I still agree with: I'm 100% in favor of removing built-in scripts entirely. What some users cite as benefits of built-in scripts (mostly seems to be the ability to have simple scripts without their own file), to me are 1) really minor things and 2) things that annoy me (when I'm reviewing diffs on Git, I absolutely do not want GDScript files mixed in with tscn files). |
@aaronfranke at this point, I'm entirely with you in thinking that embedding GDScript into scene files has no future. Though I, like others, still see value in what built-in scripts provide.
True. This is still improvable. Here's what comes to mind:
The Godot would pick up the rename/move of the Godot would take care of initially naming a I agree that a major undertaking to keep built-in scripts alive is not appropriate, but I think what I am proposing should be well within scope. |
@Serenitor The solution you are proposing has few downsides and I think it's a good idea if the community wants it. I think this feature should be called "bundled scripts", since it makes a script tied to a scene such that they come bundled together. Broadly speaking, I see two possible ways this could be implemented, so I'm curious which you think is better and which you were thinking of. The first thing I thought of when reading your comment is that the above files you listed would attach to nodes like this:
And if Or alternatively, another implementation I thought of is that any files starting with I think this is ready for a proposal if you want to write one (EDIT: and/or a PR). |
[This proposal] is totally open for debate and suggestions, I think that the discussion should continue there, as @Serenitor mentioned it in his comment. Also, what's the difference from his suggestion to Let's continue the discussion (instead of discarding it). |
@aaronfranke @marcospb19 |
This comment has been minimized.
This comment has been minimized.
Could I also suggest that shader scripts be removed from scene files. I believe a scene file should be just that - describes a scene - not be used to embed random code snippets. It might be a slight pain forcing people to save shader files as scripts, but at least then it promotes reuse and less chance of unnecessary duplication of shaders. |
I think the limitations should be removed and it should be kept. |
while the issues related to built-in scripts are annoying, they are just that: annoyances. it's not like the feature is inherently broken. it still provides value & usability, so it would be rather disappointing to see it go. in my experience, the vast majority of scripts that are not meant to be inherited from - that is to say they do not contain the class_name keyword - are specific to a certain node of a certain scene - and for all of those scripts, the built-in feature makes sense and is helpful. it enables us to encapsulate the script with the one scene it is relevant to. this does not just help a lot with preventing clutter in the FileSystem panel, but is also the underlying idea of how scenes and their sub-resources should be used as units of abstraction, is it not? |
@Serenitor
We discussed about the inherently broken parts of Built-in Scripts design in godotengine/godot-proposals#1274, here is a summary:
IMHO, that isn't just a annoyance, the first one looks like a major flaw. If BIscripts cannot be removed, cause it's useful, then it should be fixed/reworked. I even like your rework idea, anything that fixes the design and we would have nothing to complain here.
I agree, and it sounds simple to uncouple the resources and have them in a folder at the root of the project. Do we really need to be able to copy |
Closing, as there is no clear consensus for removing support for built-in scripts as per #54553. The limitations are documented in the script creation dialog now (and using |
Judging by #54553 (comment), the limitations aren't advertised clearly enough. Suggestion in that thread:
|
Godot version:
Version 3.1.1 Stable Official
OS/device including version:
Windows 10. (1803)
Issue description:
New to Godot and I've been working on a prototype for about a week. I opted for a style where every scene had just one script that was built in. (rather than a separate .gd file). I thought this might reduce clutter and as my res:// directory have less stuff in it.
I discovered this style is not well supported and I had problems with class_name (not supported), find in files(broken), and others (navigation etc). Some of these issue are listed below.
#29863
#26178
#5535
#28285
#25579
#31364
From the look of things, built in scripts seem to be a problem area and although I like the idea, seem to be more trouble than they are worth.
Anyhow, just letting you know I lost a few hours to these issues, and now have to pull all my scripts out and save them as gd files.
The text was updated successfully, but these errors were encountered: