So, I have tried to learn c++ multiple times over the years with limited success, but each time I get a little better at it. Currently I am at the beggining of the development of a roguelike type thing and am working on world generation right now. I am having trouble figuring out how to do this.
First, I'll just discuss my main problem, then I'll get into the rest. I have a class called Tile, which will basically be used to store the information on each of the world tiles, and my idea for storing the main world map was to just make a multidimensional array and store many Tile class objects in it. The declaration for it went like this:
Tile WorldTileArray[123][123];
But, if I have this in my code, my program crashes. If I comment it out, it does not crash. So, am I allowed to just create an array like this and fill it with all of those empty Tile objects, or should I do something like this instead?
std::map <int, Tile*> WorldTileMap(15376);
I could make the 2nd example work, but would rather use the multidimensional array since it would be easier to determine which tiles are adjacent to each other.
The above problem is more important, but I also have another question. For my first version of the world generation, I am just going to apply simplex noise to each world tile to determine the height, by looping through the array of all the tiles and applying the noise to each. Then, based on the height, determine if it is a mountain, flatland, or ocean. Would this approach actually create coherent terrain and landmasses, or would it just be some huge mess? Would I need to somehow apply the noise to the entire map at once?
Anyways, thank you ahead of time for any help, and let me know if you need more information, or if I need to explain what I am saying more.