Terra icon indicating copy to clipboard operation
Terra copied to clipboard

Remove randomInt TerraScript function & remove Random instance from structure API

Open dfsek opened this issue 3 years ago • 3 comments

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)

dfsek avatar Jul 12 '22 23:07 dfsek

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"

duplexsystem avatar Jul 14 '22 08:07 duplexsystem

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

dfsek avatar Jul 14 '22 09:07 dfsek

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

dfsek avatar Jul 15 '22 01:07 dfsek