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

Weighted probabilities #11

Open
usevalue opened this issue Nov 11, 2015 · 3 comments
Open

Weighted probabilities #11

usevalue opened this issue Nov 11, 2015 · 3 comments

Comments

@usevalue
Copy link

I would like it if each island-generator had a double which determined its probability of being generated, relative to other generators' probabilities. An example, assuming the weight is given before biome lists:

island-generators:
  - ...IslandGeneratorAlpha 1.0 rockybiomes ~ ~ ~ ~ ~ ~ ~
  - ...IslandGeneratorAlpha 1.2 forestedbiomes ~ ~ ~ ~ ~ ~ ~
  - ...EmptyIslandGenerator 4.0

As you can see, I've been experimenting with adding large numbers of empty islands. Combined with narrow border oceans, this leads to nice-looking archipelagos and island chains separated by large bodies of water. As far as I'm aware, the only way to accomplish this currently is to add multiple entries.

@hoqhuuep
Copy link
Owner

Great suggestion! I agree this would be a very good addition!

@usevalue
Copy link
Author

Easiest way I can think of:

  • Add the probabilty at the end, rather than the beginning, so that you don't need to adjust code for reading biomes; just check the length of the arguments to see if it's X or X+1. If X, prob = 1; if X+1, prob = args[X].
  • Only allow integer values. Then you can simply while(x=0; x<prob; x++) { add item to list}.

It's not terribly elegant. If one were working with extremely large probabilities, there would be costs to memory and search time. But given the nature of the program, I can't imagine these demands would be terribly taxing to the server.

@usevalue
Copy link
Author

There may be more straightforward ways of doing this, but this way requires changes to only one class, and doesn't require changing the classes of any of your objects. You're more versed in your own code than I am; I assume a more streamlined solution is available, but I spent about 2 hours the other night reading through the code to wrap my head around it.

@hoqhuuep hoqhuuep changed the title Feature request: weighted probabilities Weighted probabilities Mar 17, 2016
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

2 participants