blixt / starbounded

A Chrome app that lets you open your Starbound directory and view the worlds etc. within.
http://blixt.github.io/starbounded/
MIT License
53 stars 6 forks source link

Figure out variants #8

Open blixt opened 10 years ago

blixt commented 10 years ago

Variants are not stored in the .world file, they're calculated. They seem to follow a noise algorithm, but the algorithm is deterministic (so the same X, Y coordinates always get the same variant).

blixt commented 10 years ago

It seems that the variant number is decided by a Fowler/Noll/Vo hash function.

Here's a question by OmnipotentEntity showing some code of the variant generator: http://stackoverflow.com/questions/10468064/static-pseudorandom-field-generator

The variables used in the actual Starbound code are allegedly world seed, followed by either 455934271 (for background tiles) or 786571541 (for foreground tiles), followed by the X and Y coordinates.

Experimentation will be needed to come up with the actual working implementation of this.