Skip to content

some question about gregtech.worldgen.NoiseGenerator #141

@mordds

Description

@mordds

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions