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

Terrain probability is broken in 1.1.0+ #1949

Closed
ecustic opened this issue May 11, 2018 · 6 comments
Closed

Terrain probability is broken in 1.1.0+ #1949

ecustic opened this issue May 11, 2018 · 6 comments
Labels
bug Broken behavior.

Comments

@ecustic
Copy link

ecustic commented May 11, 2018

Probability seems to be broken in every release since 1.1.0.
I've tested both creating the tileset/terrain and using the terrain brush in every version from 1.0.3 and up.
It seems to just pick one of the full tiles and only uses that regardless of what the probability is.

Steps to reproduce:

  1. Create simple terrain from tileset (4 full tiles - probability shown on each tile)
    image
    Tiled version in this step doesn't seem to matter, it behaves the same regardless.

  2. Use terrain brush with the created terrain:
    Version 1.1.5
    image
    Version 1.0.3
    image

@bjorn bjorn added the bug Broken behavior. label May 11, 2018
@bjorn
Copy link
Member

bjorn commented May 11, 2018

Thanks for opening an issue about this! Indeed I've seen a few people who have pointed out problems using the probability.

What is your operating system and which version of Tiled are you using exactly?

I'm afraid it probably has to do with change b9655a3. For some reason this new C++11 API for choosing random numbers is not working for everyone. Maybe it's not supported by a compiler, or maybe I'm using it in the wrong way (though it worked for me). In any case we should find a solution.

@ecustic
Copy link
Author

ecustic commented May 11, 2018

I'm using Windows 10 Home, and the 32-bit versions of Tiled.

As I've said I've tested on version 1.0.3 (where probability works) and all version including and above version 1.1.0 (where probability doesn't work).

@bjorn
Copy link
Member

bjorn commented May 13, 2018

Just wondering, but is it broken on the 64-bit version of Tiled as well? Just asking because it's compiled using a different compiler (MSVC 2013 rather than MinGW, which is used for the 32-bit builds).

@ecustic
Copy link
Author

ecustic commented May 13, 2018

Just tested and 64-bit version seems to work fine.

@bjorn
Copy link
Member

bjorn commented May 13, 2018

Thanks! That somewhat explains why reports of this issue have been a bit rare. Still, I'll look into fixing this also for the 32-bit Windows version.

@bjorn bjorn closed this as completed in 2065b13 Sep 12, 2018
@bjorn
Copy link
Member

bjorn commented Sep 12, 2018

Sorry for the bug everybody, it was a case of not reading the documentation carefully enough:

std::random_device may be implemented in terms of an implementation-defined pseudo-random number engine if a non-deterministic source (e.g. a hardware device) is not available to the implementation. In this case each std::random_device object may generate the same number sequence.

That explains why it only affected some platforms (I think only the 32-bit Windows version). And the fix was to avoid creating a new std::random_device instance each time in this case.

Not sure if I'll still make a 1.1.7, but I'll release the fix today in a new development snapshot.

@bjorn bjorn moved this to Completed in Roadmap Feb 3, 2023
@bjorn bjorn added this to Roadmap Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior.
Projects
Archived in project
Development

No branches or pull requests

2 participants