-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
I Noticed that these two NoiseGenerator are actually generate EXACTLY SAME noise value.
NoiseGenerator gen1 = new NoiseGenerator(1);
NoiseGenerator gen2 = new NoiseGenerator(2097153);
Is it work as intended?
Note:this NoiseGenerator is used to generate stonelayer of GT6. (which make it easy to get the noise value and find the potenial seed.and it also makes it really valuable to find the seed candidate in server.)
Note 2: This might be the problem(or feature) of Hash3D,since we only use the low 8 bit of Hash3D.
private static int Hash3D(int seed, int x, int y, int z) {
int hash = seed;
hash ^= X_PRIME * x;
hash ^= Y_PRIME * y;
hash ^= Z_PRIME * z;
//for same x,y,z.the seed just xor with 3 Certain number
//so the hash only depends on seed
//we have already noticed that the final result depends on low 21 bit of current result
//and the low 21 bit of current result depends on low 21 bit of seed,since xor operation do not effect two bits at different positions.
hash = hash * hash * hash * 60493; // the low 21 bit of result only depends on low 21 bit of hash(before).
hash = (hash >> 13) ^ hash; //for this expression, the low 8 bit only depends on bit 0-7 and bit 13-20
return hash;//we only need low 8 bit of
}
Metadata
Metadata
Assignees
Labels
No labels