Skip to content
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

Make node and packed scenes less redundant #681

Closed
Shadowblitz16 opened this issue Apr 8, 2020 · 9 comments
Closed

Make node and packed scenes less redundant #681

Shadowblitz16 opened this issue Apr 8, 2020 · 9 comments

Comments

@Shadowblitz16
Copy link

Shadowblitz16 commented Apr 8, 2020

Describe the project you are working on:
Space ship game

Describe the problem or limitation you are having in your project:
Object inheritance and node inheritance

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
ok so I was wondering if scenes a scripts could be somewhat combined
basically script would stay the same.
the only difference is that nodes and scenes would treated as scripts

these are my reasoning behind it.

  • remove confusion between scenes, nodes and scripts
  • scenes and nodes already only support 1 script at a time
  • switching out scripts is unnecessary since scene and node inheritance can be used
  • doesn't clutter up your project with a 1:1 ratio of scripts and nodes/pack scenes

things to note..

  • a converter would have to be made for old projects
  • script editor would basically stay the same it just wouldn't open up a new file for nodes and packed scenes

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
image

image

If this enhancement will not be used often, can it be worked around with a few lines of script?:
this would be used just as much as the current system. it just makes a node or a packed scene take up 1 resource other then 2 and enforces strong typing when inheriting

Is there a reason why this should be core and not an add-on in the asset library?:
it makes godot less confusing

@Shadowblitz16 Shadowblitz16 changed the title combine scripts and scenes into script/scene resource Make node and packed scenes less redundant Apr 8, 2020
@KoBeWi
Copy link
Member

KoBeWi commented Apr 8, 2020

doesn't clutter up your project with a 1:1 ratio of scripts and nodes/pack scenes

You can avoid this with built-in scripts too.

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Apr 8, 2020

@KoBeWi I'm not sure what you mean

@KoBeWi
Copy link
Member

KoBeWi commented Apr 8, 2020

image

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Apr 8, 2020

it still doesn't change the node type when your inherit from something else though.
also the script name is blank with a gear icon.

also I still think that treating the node or scene ad a script would be better.

  • again it gets rid of confusion on the relation ships of nodes/scenes and script
  • it really wouldn't break anything if a converter was made
  • it forces strong inheritance between nodes, scenes and logic which in turn is safer and less error prone
  • I don't see a reason to switch out scripts its bad practice

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Apr 9, 2020

I realized godot would also need a way to choose which script type you used since scripts would no longer be assignable.

I was thinking of a couple of different ways

  • godot could have a script type option for nodes in project settings
  • nodes and scenes could just be scripts storing the node hierarchy internally
  • when creating a node it gives you a choice of what script type to use
  • when creating a scene it gives you a choice of what script type you want

also I forgot to mention while this is a big change it also could allow people to actually make their own node types easier.
here are some thing that might go well with this suggestion

  • the nodes browser would no longer need to display script name next to them since they would be one in the same
  • class_name could be gotten rid of in favor of NodeName extends Type much cleaner
  • if the attribute suggestion was added icon could be used using @Icon "path_to_file"
  • there would no longer be a need to set a new script for each inherited node
  • if the NodeName extends Type idea is implemented node names could be synced the id prior to extends Type

@h0lley
Copy link

h0lley commented Apr 10, 2020

realistically, I think what we really should be pushing for, is to improve the system for "built-in" scripts mentioned above. this existing system is meant to solve the issues you've mentioned, but imho, it is in dire need of improvement.

it doesn't work with live coding
it doesn't work with external editors
it doesn't support class_name
...
and yes, it doesn't automatically update the type of the node attached to it. I agree that this would be helpful.

@Shadowblitz16
Copy link
Author

what I do find confusing is the idea that packed scenes have a node hierarchy and scripts don't.
but scripts have class_name which creates a node template in the node browser.

the idea of this suggestion was to merge the idea of a script and scene/node so that scripts while having the ability to not be nodes, scenes and nodes would be scripts and in turn removing this confusion.

I also kinda like the idea of not having the script name next to the node in the node browser.
it feels like the its actually a custom node and not a packed scene.

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented May 8, 2020

this seems to be a very similar issue. godotengine/godot#17418

I think right now we are stuck in sort of a bad limbo with the way godot scripts work.
what would be ideal is doing something like this and also having the ability to attach behaviors to nodes to emulate a sort of object oriented / ecs hybrid

note godot next already tries to do the behaviors thing

although the behavior part is out of scope of the issue the idea would be that...

  • you can create new types by simple script inheritance
  • you would be able to attach multiple scripts (behaviors) to nodes while keeping the OOP workflow
  • workflow would be a little simpler to understand

I realized godot would also need a way to choose which script type you used since scripts would no longer be assignable.

also I think if nodes were in fact just scripts this issue wouldn't be the case since you could just create the script like normal and inherit the type you want to extend.

this also comes to the issue that we need a id for our nodes so gdscript would need to be modified to require a class name in front of extends like I said earlier
NodeName extends Type this is also just how oop works normally

@Shadowblitz16
Copy link
Author

so thinking more about this I think godot should get rid of the node/script workflow and adopt a class based inheritance workflow.
not only is it more in line with the way godot actually works, but its cleaner and gets rid of the nasty am I a script or a node?

I will be creating a issue about it however this one is obsolete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants