I am trying to make a load, unload system to make my game lag less. My world is Procedurally generated. And when I walk a direction. I want the chunks to load in as in minecraft. I have made a script that makes a chunk. A random t 10x10 chunk. Now I just need to the chunk to load in around the player and unload. If you have any kind of idea to do this. THen PLEASE TELL ME. I've been trying to implement this for 2 weeks. But I am stuck on this problem. I would be so happy if anyone could help me.
this is a very complex concept, but fortunately its not impossible..
here are a few things you should think about when brainstorming ideas of how you could approach this:
1): how to represent the objects of the map in your code.. -in order to generate something, there should be some sort of abstraction in you code that spells how to make it..
**for instance: **: you must have some abstraction of how to generate a hill, and how to differentiate between a hill and other landscapes..
example: you might indicate in your code that an asterisk(*) represents a rock, and this(idk what its called) (^) represents a tree
2): how to represent the map as text in your code:
for instance: code is just text, which means we need to get creative with how to represent non-textual fodder as text... for instance: you can represent your map as an array, or a string
now I'll attempt to make code that generates a simple map, however, this code doesn't do exactly what your looking for (generate map as player moves to places), since the code might be very long, I am going to update my answer once I am done doing so...
I don't have any code that could possibly help but I do in fact have an idea on how to make a chunk system.
Client/Server: If you didn't know, things stored in serverStorage doesn't actually effect the Client player, except when servers are being slow.
The Idea: The idea is to do a simple/complex algorithm to see the distance of the player and it's surrounding. Depending on how you want to do a chunk system, you may need some geometry to trigonometry skills to accomplish more complex things like loading chunks in a circular fashion. Next thing up is to store any unloaded chunks to the serverStorage and load in chunks that is close to the player.
Hopefully this gives some idea to help in your situation.