So I’m thinking of creating infinite map generation in my game.
The problem is, I cannot solve some problems
Ok first of all I’m able to generate 2d array of tiles to my liking, and I could do that infinitely, probably. What I don’t know how to do is generate objects on the map based on the seed. I can just use Random or something to randomly generate objects, but that isn’t what I want. I want generated map to always be the same when same seed is specified.
Let me explain why I want this.
Here is how I’m thinking of doing infinite terrain.
- Generate infinite terrain for the first time. Keep track of the seed used to generate the terrain.
- Player changes certain tiles/entities in the world. Keep track of what the player has done.
- When saving, only save what the player changed in the world.
- After loading, generate terrain from same seed again, and apply changes that player previously made.
So this is really a “big” question, but the first thing I need to figure out is how to generate object/entities based on specific seed. I probably should use some kind of PRNG like XorShirt or something like that.
Anybody knows how Minecraft stores/loads terrain?