-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Particles with "one shot" enabled gets "emitting" turned off #17903
Comments
Ah, that makes sense, if the getter for "Emitting" only returned for a field in the Particles(2D) in the scene layer, it would not be possible to get the correct value once emission was over, since "Emitting" is only disabled in the "driver" with "One Shot". Can "TOOLS_ENABLED" be used to check whether one is in the editor, or should something else be used? Also, I believe it would be better if it still stopped emitting in the editor, since if I understand you correctly, that would make "One Shot"=true have emission continue while in the editor, which I believe is not desirable. Instead, I think a solution might be while in the editor to keep and use a field for "Emitting" in the scene layer, and when not in the editor ignore that field in the scene layer like how it currently works. |
I think I understand better now. But does that then mean that for "option 1", if "Emitting" is off, whether "One Shot" is on or off, and whether "Emitting" was turned off by the game developer or by "One Shot" running, it should still emit when running the game? Making "Emitting" in effect more of an editor-only property, at least from the game developer's POV? Edit: Sorry, I am wrong, it would be from the game developer's POV while in the editor, not while using scripting. |
@mateusak I have thought about it some more and looked into it, and I think your second proposal regarding an option like "Emit on Instantiation" would be best. That approach would also enable having the same overall behaviour as The only issue I can see at the moment is backwards compatibility regarding "Emitting", since if "Emitting" is on (and "One Shot" is off), the generated game has particles emitting for that node, while if "Emitting" is false, the generated game does not have particles emitting for that node. With this change, that would instead be controlled by "Emit on Instantiation"/"Autoemit". How important is backwards compatibility in this case? Also, assuming that the desired functionality is determined, would it be OK if I tried to implement it, test it and make a pull request? |
@mateusak Maybe a way to have backwards compatibility would be to let the proposed property "Autoemit" be disabled by default, and if it is disabled, let it default to the current behaviour. Or maybe let "Autoemit" have 3 states, "Enabled", "Disabled" and "Unset", and let it default to the current behaviour if in "Unset". |
@mateusak I think one of the really neat things about Godot, at least from what I have seen so far, is that it is really easy and intuitive to both modify and see the results of modifications just in the editor. For instance, you can have multiple particle effects running and see the results directly in the editor without having to run the game. Or play an animation, complete with sound and particle effects running. How well it works I do not know, but it seems to work at least OK, the basic "Platformer 2D" example project does showcase some of these features. As far as I can tell, there are two main needs and goals related to the Inspector and UI elements like the bottom tabs named "Audio" and "Animation":
From looking at the code, it seems that the implementation that deals with these two needs are somewhat intermingled. In particular, I believe that the editor state for nodes overlaps or is shared with the node and property definitions used for generating games to be run. I fear that such a mingling can make the code more complicated and bug-prone than it has to be, though I do not at the moment see a good alternative. That said, I might well be wrong about that, and this is after all just games and game tools, so the quality requirements are not that high (higher for game tools than for games of course), and other concerns such as performance, flexibility, maintainability and functionality matter as well. Assuming it might be that I am not off or way off regarding this superficial analysis with overlapping or shared state between the editor and the node/property definitions, do you happen to have any good intuition regarding whether there are few or many bugs that might stem directly or indirectly from this? If you do not at the moment have any good intuition regarding this, I could try to look into it. Of course, it may just be that I am still very new to Godot, and that this is a non-issue or has been discussed and planned for, etc. There is also the aspect of supporting live editing, which I do not have experience with or considered regarding this. |
I think this is actually a bug. I've been running into this a lot lately (with 3.1.1) and have been able to get around it by being in the script editor when I checked "Emitting" which kept it turned on. Now I have a scene with no script and two |
@austinried It sounds like you just should be using an AnimationPlayer. |
I didn't need to animate anything really, I just wanted both particle emitters in one scene to be set to one shot and emitting. |
@austinried It's not about animating anything. You use the AnimationPlayer to set both particle systems to "emitting" at the same time. It is incredibly useful way to sync your particle systems in editor. In game, if you want both to start upon entering the scene tree (i.e. when starting you game) in
It doesn't make sense to add an entire new property to the editor just to avoid those two lines of code |
Right... I mean I get that what you're proposing is a viable workaround, and I eventually just added a script very similar to what you have there, but I don't see why I should need either the script or the AnimationPlayer just to have both particle emitters start emitting when they enter the scene tree and also for them both to be set to one shot. I'm not proposing a new property in the editor, I'm saying from a user perspective, if I check those two boxes, I want them to stay checked. |
@clayjohn I am uncertain, but does Godot differentiate between:
in this case reg. |
The only thing @MelvinWM In theory you could check with Think about what is being proposed. You are asking for I think the only clean solution is the one described above by mateusak #17903 (comment). At some point we should have editor controls to pause and play particle systems, this way you could set |
@clayjohn That is a lot of derivations reg. proposals and requests from my most recent comment you come with 😃 . That most recent comment I came with was just questions after all. I think a clear, conceptual distinction between "editor game definition state" and "inside-editor game simulation state" might be useful:
If one was to design and implement explicitly according to this distinction, for a particle system, the "game definition" might sensibly contain the following "variables"/"properties"/other:
For the inside-editor game simulation state (and game state when running the game, I think), it could for instance have the following additional "variables"/"properties"/other as the implementation for enabling the desired behaviour (other implementations are possible of course):
Of course, this separation means that there would be more "variables"/"properties" than there currently is. And which of these should be exposed to the user, and in which ways? The "game definition" parts should definitely be exposed to the user in the editor, and likely also through scripting including while the game is running. And keeping the number of "variables"/"properties" low might be more desirable according to the chosen approaches than any possible benefits from separating the "game definition" and the "inside-editor game simulation state". My impression is that Godot tends to have the "game definition" be handled by the same "property", implementation, etc. as the "inside-editor game simulation state", and that it for most cases does not cause any issues. However, in certain cases, such as when a property might be modified by simulating/playing a part of a game for instance when simulating a particle system with Most "variables"/"properties" for |
@MelvinWM You have provided a very clear breakdown of the issue. Thank you.
This is a fantastic idea and a very useful framework. However, the Godot editor is just a game made using Godot. While there is some limited ability to check if code is being run in editor, the core devs prefer not to do so and to keep the engine distinct from the editor. The implication of that decision is that we can't keep reference to certain "editor only" variables that don't affect game state while in editor and then discard them when the game is run. While I love the idea you have proposed here, I think it would require a restructuring of the entire Godot architecture to implement 😨
This type of issue has arisen in a few places that I know of 1) when using a For this particular issue we should find something that makes sense. In my opinion, it isn't too much to ask users to set All that is to say, we need to find a solution that is elegant, and avoids too much complexity. If that can't be done, then your gonna have to live with that extra line in your I think you have addressed an important topic, and that is separating editor simulation from game simulation. which brings us back to mateusak's comment. What the editor needs (long term) is a way of pausing simulation in editor. Maybe this can be a property of Node (which would then extend to all it's children). Thus allowing you to freeze the simulation of the particles and not have them update in editor. Until then though, I don't think any other solution is worthwhile. As a consolation, last week a made a PR that updates the |
@clayjohn Reading your reply, I am not convinced at all that you and/or I understand the other.
I did not at any point discuss or propose editor-only "variables"/"properties". The "game definition "variables"/"properties" I gave examples of above would very much ALSO be runtime.
That sounds strange and less nice. is that special-cased hard-coding?
Apart from the complexity of introducing new "variables"/"properties" and changing the implementation as you typically would, without any non-standard changes, I am not convinced that any special implementation or refactoring of the engine, editor or other would necessarily be needed. Though, I have not investigated this part either, and my insight into the engine is still very limited. But still: If you add 2 "variables"/"properties" and refactor the code, such that two of the "variables"/"properties" in practice describes the "game definition", without any special requirements or handling required by the engine, editor or other; and then add 2 "variables"/"properties" in practice for the non-"game definition" (or maybe one of them just an internal variable, depending on what you want to be exposed and the like), that would satisfy the above distinction (though it would be somewhat direct) and would not require anything special for the editor, engine or other. Of course, here I assume that the "game definition" "variables"/"properties" would also be useful and meaningful to have while running the game, and that it might make sense to change them through scripts while running the game. You might well have a point reg. "variables"/"properties" that it would not be meaningful to change or include runtime, though I do not as such believe that is the case here, though I could be mistaken.
But... my main address was reg. distinction between "game definition" and "inside-editor game simulation" 😕 . Wouldn't that distinction be much more important than between "inside-editor game simulation" and "game playing"? Besides, cannot "inside-editor game simulation" and "game playing" be handled the vast majority/all of the time by the same concepts and implementation, and isn't that the goal already, and a good goal?
When I encountered this issue reg.
I might be wrong, but while pausing the simulation sounds like an interesting feature, it seems... off as a way of dealing with this issue.
Well, it is no skin off my nose 😃 , to be honest, for some time now I have decided not to advance with Godot (I did publish a minimal game at Google Play that I used to learn Godot with). I am participating here mostly just to be responsible and seek to be helpful reg. the issues and pull requests I started or participated in. |
@mateusak Well, there are many nice or very nice things about Godot, and seemingly nice or seemingly very nice things about Godot, and a lot of interesting concepts, but there are honestly also a lot of bugs and quirks and the like. It is of course still fairly early days for Godot, and it is improving considerably. For instance, reg. the very basic minimal game I made to learn Godot with, I very stupidly and irresponsibly did not test it early on for the different platforms I wanted to deploy it on, namely Android and web, and that meant that I found out very late that Particles2D was not supported fully for the graphics system I was using reg. the web as a target platform. I then looked into using CPUParticles2D, but I recall that I gave up on that, maybe due to there not being feature parity (which is fully meaningful, HTML5/Javascript games are still fairly early days and continuously changing, and the nature of the platform seems to inherently impose considerable constraints, no matter which tools, engines and libraries you use, at least that is my impression so far). Of course, Godot has improved since then, and when starting a new project, it asks you to select the graphics system and informs you of the constraints and features each have, which is very nice, so that is no longer an issue. But I have also encountered a number of other quirks and bugs and the like, and it can end up being frustrating. For instance, I encountered #27106 very shortly after starting a new project, and I ended up spending 5-30 minutes (I don't recall how long) debugging and seeking to figure out why things were not working before I realized or began suspecting that it was an issue with the editor itself, not my own actions. In and of itself, that issue is a very minor thing and easily worked around, but such minor things can accumulate, and if there are many of them, it can become frustrating to a considerable degree. Then one could fix them, but there might be regressions, and new bugs, and the like. Decreasing the overall number of bugs and keeping up the quality for a software project, especially a large or very large project, is generally a highly challenging aspect, especially if you also want to have other aspects and properties as well as other goals, technical and non-technical (though in the case of quality, sometimes quality can help aspects such as productivity, though again, it very much depends on the case, approaches taken, etc.). For example, one attribute that I get the impression Godot seeks or claims to seek to have is adaptability, including in regards to the different technologies, approaches and methods used, and that is a very meaningful and good goal to seek. I did make this comment as intended to help assist reg. this issue: #2641 (comment) , though I do not know how those approaches fit into Godot, its developers, its community, its business model (primarly Patreon AFAIK and recall), etc. Then there are other stuff that are not technical, but I will not comment on those. |
@clayjohn OK, I can understand how what I'm saying might sound unreasonable from your perspective, considering what At this point I think it would actually be best to introduce that new IMO, it's about more than saving a few lines of code or an extra |
Because the changes proposed by mateusak could be done without integrating editor features into core engine code. The change you suggest, while also useful from a UX perspective would require integrating the editor into core code in a way that the core devs have said they won't allow. In my personal opinion I have no problem setting You have a lot of great ideas! Just because I (a random contributor) disagree with you about what is the best implementation you can still prove me wrong 😛 |
You have claimed this before, but I do not understand how it "would require integrating the editor into core code". Why would it, namely adding and changing a few properties similar to how it is done now, require anything special like you claim? Of course, we may be talking past each other.
It is true that the issue is indeed very minor. That said, minor issues can add up, and when each user encountering the issue has to spend time figuring out there is an issue and that it needs to be circumvented, that time can add up across users. But yeah, it is still a very minor issue. I also find it valuable to be able to identify problems and find good solutions for them, and learn and improve reg. this - software development is after all typically entirely non-trivial, so it is natural to always be learning and improving. And discussion, if constructive and benign, can be very valuable reg. learning and improving. |
I did not read the full backlog, but reacting on the issue title and some keywords I parsed from the various answers:
That being said, I don't know how frequently I would need one shot particle effects to autostart. I've been working on https://github.com/KOBUGE-Games/jetpaca a bit, porting it to Godot 3.2, and all the one shot particle effects seem to be triggered manually when their parent scene enters the player's camera, which seems to make the most sense for one shot effects (you want them to be visible, not run off screen). |
@akien-mga Regarding the use cases I had, I used it for various explosions as well as a minor amount of debris flung from the cannon muzzle when a shot is created/fired. |
That's pretty much my exact use case as well, little effects here and there that play once and then are gone. |
This is needed every time you need one of instance. For example when creating explosion of a ship I would like it to autoplay, explosion of chunk of ship and then to playing it, when player dies I would like to one of play blood splatter from dead body and then stop etc. |
Alright, so it seems there's two different approaches used by different devs:
IMO adding an |
|
|
I found this thread because I'm also trying (failing) to instantiate a dedicated particles scene, have it play immediately, just once. Very confusing (and to me, unexpected) that when I have One Shot checked, the Emitting checkbox becomes unchecked if i click on a different tab, and then back on the one containing the particle node. |
I stumbled upon this thread because this was confusing to me as well. I found a pretty decent work-around in the editor for people using particles in their own separate scenes and instantiating them from other scenes.
This should set emitting to true while preserving the Oneshot property in the Particle2D node without any extra code. Having a dedicated |
I tried to implement the new The test project is this: particles-autostart.zip |
This confused me a bit as a new user, it took me a while to identify that the emitting had been turned off. For my experience a toast type message that just let me know that it was being disabled by selecting one shot would have really helped me be aware of what was going on. |
Years later, some clarification on use cases (I just hit this issue as well):
Not only for the transform. Decoupling the particle effect from whatever triggered it is also necessary for "destroyed" explosions - the triggering object is about to be The proposed |
Godot version:
098c7ba4f9c49b472b9417819144378081996874
(current master)
Issue description:
When using the node Particles2D or Particles, and having both properties "Emitting" and "One Shot" enabled, if saving the configuration somehow (for instance by moving the focus away from the node), "Emitting" becomes false in the editor, and does not play when the game is run either. See also the GIF below:
Proposed fix
I think the regression happened in 1f609b7. I do not know what the purpose of that commit was; it seems a pure regression AFAICT. That said, I do not know Godot or its particle system very well, so this might be wrong. I have tested a simple reversion, and that seemed to work: In the editor, "emitting" was kept and not discarded, and "one shot" worked when running the game.
The text was updated successfully, but these errors were encountered: