Handling Huge Multidimensional Arrays in C++

前端 未结 8 1999
别那么骄傲
别那么骄傲 2021-01-24 19:15

I\'m designing a game in C++ similar to Minecraft that holds an enormous amount of terrain data in memory. In general, I want to store an array in memory that is [5][4][5][50][

8条回答
  •  一整个雨季
    2021-01-24 20:09

    I did this by putting all the data in a binary file. I calculated the offset of the data and used seek() and read() to get the data when needed. The open() call is very slow so you should leave the file open during the lifetime of the program.

提交回复
热议问题