PolyhedralDev / Terra

Voxel world generation modding platform
MIT License
644 stars 87 forks source link

Remove randomInt TerraScript function & remove Random instance from structure API #345

Closed dfsek closed 2 years ago

dfsek commented 2 years ago

Currently, TerraScript contains a randomInt function which fetches the next random integer within a range from a mutable Random object. This Random is supplied by the Structure#generate method. The randomInt function should be removed, as well as the Random parameter from the generate method, in favor of using stateless random sources, specifically noise functions.

(additionally, check elsewhere for any other uses of Random that we may have forgotten about)

duplexsystem commented 2 years ago

If this is removed I think we need some sort of time since world gen data source, so that world gen can be completely stateless while features like #111 and #322 can appear "random"

dfsek commented 2 years ago

These features can just salt the world seed with some value, probably just a number from the server random.

dfsek commented 2 years ago

I believe ores also use the random parameter, they should be modified to accept a noise sampler which is used instead