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
Request: probability setting for output layers on automapping. #3179
Comments
|
Nope, not currently possible AFAIK. I've been accomplishing varied probability by duplicating outputs that need to be more common, but that gets annoying and hard to maintain very quickly. I'd love some better way to have Tiled favour certain outputs over others. Unfortunately I don't think your proposed solution would quite work as you expect, because Tiled works by output index, not output layer. How should Tiled weigh output index 5 in the case that you have output5_grass_0.5 and output5_grassDetails_0.1? It is the indices that need to be weighed, but Automapping currently has no way to set properties for a given index, only for a given layer. Perhaps the last found specified probability for a given index would be used? Also, I think it would be better to specify the probabilities as custom properties rather than as part of the layer name. If the probability is in the layer name, then targeting specific layer names can be ambiguous. What if I want to target a layer called grass_0.5? That seems like a terribly contrived scenario, but layer names can have all sorts of funkiness in them as an aid to importing into game engines. Edit: A more far-fetched suggestion: If we ever get a dedicated rule editor that lets us specify all the candidate tiles for a given cell all together instead of or in addition to via output indices, the tiles' probability properties could be used to decide which tile to place. |
|
Ah that's a shame. Oh well, hopefully one day it will be possible in one way or another. Thanks for the reply. I'll leave the issue open for a bit in case someone else wants to chime in. |
|
It's a good issue that should be left open. Even if your specific implementation suggestion wouldn't work, the basic idea is a very good one and perhaps bjorn or someone else can think of a way to make it work. |
Rather than each output set always having equal probability, it is now possible to specify a probability for each output set, using a custom "Probability" property on any of its layers (when multiple layers in an output set have a "Probability" property, the last / top-most one wins). The probability between output sets is relative and default to 1.0. So for example, when setting it to 2.0 for some output set, it will be twice as likely to be picked relative to any others. Closes mapeditor#3179
|
@cosmicr I've implemented this feature in PR #3602. You're welcome to test it out using the builds that should become available at https://github.com/bjorn/tiled-dev/actions/runs/4345422448. |
|
I had a look at that build. It consistently crashes when I try to Undo Automapping that invoved a probability. All other Undo is fine, including the same rules without probability set. Explicitly setting probability to 1.0 on an output still crashes. It would be nice if the probability property were displayed on output layers to ease setting it, similar to how AutoEmpty is displayed on input layers. Aside from that rather serious bug and that minor invoncenice, it works :D Being able to control the probabilities this way is very nice! Edit: Here's my draft documentation for probability, in case you want to use it for the current docs:
|
I think there are some problems with displaying this Probability property...
So I'm not sure if we're really helping by showing this property. :-( On the bright side, the crash should be fixed now. |
|
Well, I've just decided to show that property for now, hopefully it helps more people than it confuses. :-) |
* AutoMapping: Added support for output set probability (#3179) * AutoMapping: Fixed crash on undo when output layers have properties
|
TIL that apparently custom properties on output layers get copied o: I had no idea. Do they get copied only when the layer is created by automapping, or do they get copied even if the layer already existed? Regarding displaying the "Probability" property, maybe it should be called "IndexProbability"? Since it doesn't need to be typed, a longer name that's clearer is better than a shorter name that's vague. I'm not sure if my suggested name is necessarily clearer, though xP Ideally it should only be displayed on layers of an index that hasn't had a probability assigned, but I imagine that's difficult to do. Thank you for implementing this! |
They get copied as part of applying a rule, so they won't get copied when no rule has matched. It doesn't matter whether the layer previously existed or not. I'm also not sure if "IndexProbability" is clearer. :S Maybe "OutputIndexProbability"... |
I see. I will make a note of this in my docs draft.
This property only appears on output layers, so I don't think specifying "Output" is necessary. I guess we can leave it as "Probability" and remove the automatic visibility if people get confused about it? |
Copying the properties was implemented in f19f97b in response to a request posted on the forum, but I reckon it is rare indeed. I guess I'll just keep the name "Probability". |
Rather than each output set always having equal probability, it is now possible to specify a probability for each output set, using a custom "Probability" property on any of its layers (when multiple layers in an output set have a "Probability" property, the last / top-most one wins). The probability between output sets is relative and default to 1.0. So for example, when setting it to 2.0 for some output set, it will be twice as likely to be picked relative to any others. Closes mapeditor#3179
If I have 5 grass tiles, but 3 of them are grass with flowers, I was wondering if it could be made so that I could set the probability of those output layers being less than the rest?
Eg:
where
output3tooutput5are the flower tiles.This way even though I have a bigger selection of flowers, I'll still see more grass.
Apologies if this is already a thing, I couldn't find it in the documentation.
The text was updated successfully, but these errors were encountered: