godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Add a 2D node scattering tool #5553

Open mathias17 opened 1 year ago

mathias17 commented 1 year ago

Describe the project you are working on

A 2D exploration game with lots of environmental decoration objects spread around the environments.

Describe the problem or limitation you are having in your project

https://user-images.githubusercontent.com/3425436/194642626-a17fa1fb-099a-46bf-8830-d0236a7222e4.mp4

Placing and arranging numerous decorative objects feels slow and inconvenient. I can click on a node, hit CTRL+D to make a copy, then ALT+drag and move the copy wherever I want, rinse repeat. This works fine, up until I have a large area to decorate. Then it starts to feel pretty inadequate.

In other software when scattering lots of stuff around the canvas I might use some sort of a brush tool.


Those making 3D games have the option to use the Spatial Gardener plugin to quickly spread objects around the canvas, but there doesn't seem to be a similar solution available for those of us working on 2D games. I would love to see that change. I'm sure others would, too.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I'm imagining a new 2D editor tool that allows me to choose a scene/sprite/valid resource and then click once in the canvas to place a copy or scatter multiple copies very quickly.

Not only could this be faster and more convenient when needing to place a lot of stuff (saving time and reducing workload stress), but it also gives us an RNG element - when trying to create assorted decoration in a natural way it's easy to all into predictable patterns when you have to consciously decide where to put everything. This lets an algorithm add some natural randomness to the process, which can be quite invaluable.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This isn't a new idea by any means - many examples of this functionality are available as reference. To illustrate the idea, here are some screen recordings of Photoshop, using simple brush settings:

One click = one instance placed

(no spacing, no scatter) singleclicking

Holding down left mouse button, using spacing but no scattering:

draggingwithspacing

Holding down left mouse button again, using spacing and scattering to spread instances even faster:

draggingwithspacingandscatter


Every instance placed would of course spawn a new node in the scene tree. It would be up to the user to make sure he's spawning the nodes in the correct place in his scene tree by selecting the node in the tree that the placed nodes will appear above.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

I want all Godot users to have access to fast and easy placement tools.

Those that can benefit from this sort of thing stand to gain a lot.

TheYellowArchitect commented 1 year ago

Slightly off-topic but current Tilemap has this behaviour for tiles lol

paddy-exe commented 1 year ago

Those making 3D games have the option to use the Spatial Gardener plugin to quickly spread objects around the canvas, but there doesn't seem to be a similar solution available for those of us working on 2D games. I would love to see that change. I'm sure others would, too.

You are saying here that there's an add-on solution for 3D but want an easy placement tool for 2D in the engine. As far as I can see, this contradicts the core principle of Godot here with a small and optimized core Why does Godot aim to keep its core feature set small?. This feature can be implemented with an add-on just like in the 3D side with Spatial Gardener.

mathias17 commented 1 year ago

That is correct paddy-exe, almost anything can be implemented with an add-on. Of course that doesn't mean it's always the best choice. Primary issue with add-ons is they can break over time and support stop, while core features usually stay reliable.

I can't speak for 3D because I have yet to work with 3D in Godot. Whether or not Spatial Gardener should be core, I can't say. From the looks of it, it sure seems like it would be incredibly useful to a lot of users, but this proposal is 2D only. Spatial Gardener was referenced due to its relevance - it illustrates what a solution for 2D could look like.

If there was an equivalent add-on for 2D I'd be using it, but there's not. If you've ever been tasked with spreading tons of little decorative objects around a scene but have to do it . . . one . . . by . . . one, you'll no doubt quickly find yourself wishing for a scatter tool.

I completely agree Godot should be kept lean and mean, no argument there. In my opinion, such a fundamentally useful tool offers enough utility to likely be worth the development burden it might add if made core.

dalexeev commented 1 year ago

Scenes/nodes are not cheap, they are not designed to be scattered. A large number of nodes leads to slowdowns, so we should not encourage this.

See also:

mathias17 commented 1 year ago

You may be right, but this proposal isn't focused only on scattering. The original proposal title was "Node Brush Tool - fast node placement/scattering for 2D scenes", but it was altered, making it sound scattering centric.

A scattering setting would be a pleasant plus, but the basic request here is for a tool capable of placing scenes faster and easier, either with a single click or by clicking and dragging in the canvas - essentially a stamp/brush tool, except it places nodes. Scattering, spacing, scale jitter, rotation jitter, modulation jitter, etc, are just obvious parameters a node brush tool might have.

paddy-exe commented 1 year ago

That is correct paddy-exe, almost anything can be implemented with an add-on. Of course that doesn't mean it's always the best choice. Primary issue with add-ons is they can break over time and support stop, while core features usually stay reliable.

For features like this where there's quite a lot of different opinions on how this should be implemented, a custom solution via an add-on makes more sense. Also, add-ons should work mostly fine with updates in thei respective major version (3.x or 4.x) as long as they aren't too complicated (which is not the case here). Every addition to the core means more maintenance work for contributors.

If there was an equivalent add-on for 2D I'd be using it, but there's not. If you've ever been tasked with spreading tons of little decorative objects around a scene but have to do it . . . one . . . by . . . one, you'll no doubt quickly find yourself wishing for a scatter tool.

In that case I would probably create one myself. The functionality you are searching for doesn't require much work to get working as an add-on. For reference, you can have a look here which uses the same "scene-painting"-functionality you mean.

mathias17 commented 1 year ago

Good points, and thanks for the helpful link, paddy-exe. I want a fast, light, highly usable Godot editor, too. (This is what attracted me to Godot in the first place - it loads and generally functions blindingly fast and zippily.) Determining what's crucial enough to be core and what is just bloat, I'm not qualified to say. I'm just trying to help pitch ideas to improve Godot, which I don't do lightly.

[sorry, this overly long paragraph gets a bit off-topic but it's related] About 'different opinions' on new prospective features - Godot's development is interesting in that there doesn't seem to be a standard central Product Manager role overseeing updates to the software. Yes, there's a small core team that hold the line, but I gather these guys are all highly logical programmers at heart. As one of those designer/artist right-brain types who doesn't code, this makes me worry that the decision-makers, the lead engineers, frown on ideas like a node brush tool because it poses some threat to software efficiency despite high utility, and this is understandable when you haven't personally experienced the use cases that make you wish for new tools. Maybe my worry is unwarranted. In the future, it may be that Godot's add-on system becomes more like Blender's. No serious Blender user doesn't use at least 10 different add-ons, and it seems to work great. Reduz's recent post about the new native extension system sounds like it could be a game-changer for tossing new tools into Godot and they be even more sustainable: https://twitter.com/reduzio/status/1429969607734042625?lang=en.

Anyway, not much more to say on this one. Without appropriate technical expertise, all I can do is pitch ideas and cross my fingers.

dalexeev commented 1 year ago

I'm working on a prototype of such a plugin, will publish it when I fix a few bugs.

https://user-images.githubusercontent.com/47700418/194777599-dbbdb546-fd1c-4384-82ec-6039f6130687.mp4

mathias17 commented 1 year ago

I'm working on a prototype of such a plugin, will publish it when I fix a few bugs.

This is amazing! You have made my day.

dalexeev commented 1 year ago

dalexeev/godot-node-brush-plugin

mathias17 commented 1 year ago

Now we're talkin'.

https://user-images.githubusercontent.com/3425436/194921727-c3ac1c72-52fa-4e09-beb3-d9541f6fa3c0.mp4

Very nice job man. It's great. Thank you!

All Godot'ers that want to place a lot of instances quickly should consider using this tool.

dalexeev commented 1 year ago

Thanks for the feedback. I'm not very sure about UX and UndoRedo is not implemented perfectly, but first of all, I wanted to show that such an addon is possible and the current customization capabilities of the engine provide most of the necessary features for implementation. Although, of course, there is room to grow in Godot's customizability.