Just wondering, would making a thread for terrain generation have any benefit, if not what are the downsides, if so, what do you get out of doing it? (also, is this the wrong place to ask a question like this?)
Is your terrain going to be dynamic?
If not there is not need to create another thread to generate. Just generate it once.
It’s not going to be dynamic, no. So just keep the single thread? Would there be any benefit to using another thread?
If the state of your knowledge about threading is as such that you have to ask this question, I wouldn’t recommend it.
There would be no benefit (that I can think of) to do it in another thread.
Usually only thing that would be in another thread for a game would be the network thread.
Loading resources and having a GUI on separate threads happens often as well…
@op: if your load times become too long then maybe think about using another thread, other than that I don’t see any reason without a dynamic terrain.
If you have to generate huge maps, think about having a chunk-system.
If the map is static, store the already generated parts to a map-file.
Then only generate/load the visible and some near chunks.
That way you don’t have to generate/load a lot and there won’t be much time lost.
If the map is not that big, you could generate the complete map on start and display a loading screen while it is generating/loading.
If you’re going to stream in/out terrain then I would split it up into another thread if I were you. On the other hand, if you aren’t used to threading then you can start with doing it in the same thread (just limit the number of chunks per tick) to get the game up and running.
I would agree with the chunk system. If you do it right, loading times will be minimal but you have to find that balance between chunk sizes. Too large chunks will take too long to load but to small chunks will be too numerous and still take a long time to load. So keep that in mind.
( if you want you could put the chunking system on another thread but if you don’t know what you are doing, it could be detrimental in the long run so I would not suggest it.)
As @kingroka123 said, you need to balance it.
First find out how much you need to load, so that you cannot see, that the rest is not loaded. Then walk arround and as soon as you leave a chunk load the next chunks in the direction you are walking and unload the chunks behind you.
By doing this you can experiment with the chunk size and the number of chunks needed.