Hello everyone, I was always fascinated by programming and always liked games, my favorite has always been the Minecraft. I am creating a small clone of Minecraft with jME and Cubes framework http://wiki.jmonkeyengine.org/doku.php/jme3:contributions:cubes which is great. The problem is when generating random worlds, Cubes has a “Noise” that generates random chunks, so I put him generate 100 chunks (insignificant next Minecraft) and get a memory loss mistake! Why does it happen?
Code for generating 100 chunks random:
BlockTerrainControl blockTerrain = new BlockTerrainControl(new Vector3Int(100, 1, 100)); //100 CHUNKS HERE
blockTerrain.setBlocksFromNoise(new Vector3Int(0, 0, 0), new Vector3Int(64, 50, 64), 0.3f, CubesTestAssets.BLOCK_GRASS);
Node terrainNode = new Node();
I don’t know the Cubes framework and I haven’t tested your code, but your first line of code looks to me as if you do not generate 100 chunks, but 100 x 100 = 10000 chunks (which can be quite a lot if they are all kept in memory at the same time)
I mean, what answer do you want other than “It only reads the data in that it needs”
Do you want me to write a whole paging library for you? (I actually already have.)
But I suspect you don’t get have the skills to utilize the information I’d give you… or you wouldn’t have asked the question. Thus I encourage you to start at a shallower end of the pool until you have a sufficient base set of skills to go to the next level.
Or if your question is specifically about the cubes framework then the answer is “it doesn’t do that for you. You must implement paging yourself.”