hoqhuuep / IslandCraft

IslandCraft is a Bukkit plugin which modifies the terrain generation to create an ocean with many islands.
http://dev.bukkit.org/bukkit-plugins/islandcraft/
MIT License
27 stars 14 forks source link

Weighted probabilities #11

Open usevalue opened 8 years ago

usevalue commented 8 years ago

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 commented 8 years ago

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

usevalue commented 8 years ago

Easiest way I can think of:

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 commented 8 years ago

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.