ClassiCube icon indicating copy to clipboard operation
ClassiCube copied to clipboard

Seed value in CW file should be a string.

Open rdebath opened this issue 2 years ago • 2 comments

While a 32bit int is sufficient for rand() it is not enough for any actually good PRNG. A modern PRNG is likely to use a 64 or 128 bit seed (Perhaps in several integers). In addition, the seed isn't much use without the Software and MagGeneratorName fields. (Eg "Classicube 1.3.3" and "Vanilla")

https://github.com/UnknownShadow200/ClassiCube/blob/e287e8db2620cbd39bc387320c01ef6836b3f9f7/src/Formats.c#L628

rdebath avatar Sep 06 '22 07:09 rdebath

I just went with just a 32 bit integer because:

  • That's all the game uses, and converting to/from string was just a bit more work
  • ClassiCube normally discards all metadata it doesn't use when loading a .CW world

UnknownShadow200 avatar Sep 06 '22 22:09 UnknownShadow200

Except that you do "use" it (or you should) as you load it into memory so you can preserve it when the user re-saves it. Therefor you will crash (because of your NBT parsing) if some converter tries to put their Seed in the file rather than skipping it quietly because you don't understand it.

rdebath avatar Sep 07 '22 08:09 rdebath