These questions are for anyone who has made a minecraft style game
I have been using the Jmonkey Cookbook 3.0 book to create a chunck 16x16x16.
And the book helps me with not adding vertices if the cube sides have neighbors and also using BatchNode
I am expanding on it to have multiple chunks.
I am triggering a new chunk add every 0.5 sec
but am running into slow downs when the chunk is added to the rootnode
I have tried doing all the logic to build the chunk in a separate thread and only doing the rootNode.attachChild in the main update but it seems to hang dropping to 5 fps
Once all the chunks have been added the game jumps back to 60 fps.
First question: In the normal Jmonkey stat window. How many Triangles and Vertices are you guys showing at once.
I am wondering if I am just expecting to much. Like I said before once the chunks are added the game goes back to 60 fps .Its just the act of attaching them that drops the frames.
Second Question: Is there wiki page or post that explains how to optimize adding nodes to the root so as not to slow down the game.
A single chunk shouldn’t slow things down that much unless it’s HUGE.
In Mythruna when I had this problem it was because I was adding them all at once… I instead spread them out over several frames and terrain pages in and out with no slow down.
Edit: note that the exact same technique is also used in the IsoSurface demo and that terrain generation is quite a bit more intense I guess.
I am doing 16x16x16 cube chunks . Do you remeber what size yours where?
32x32x32… but those numbers don’t mean anything if your optimization isn’t really doing what you want.
Step 1 for a voxel world: make your own mesh. Don’t use BatchNode, etc… it’s the super inefficient way to do it. Why create 16^3 * faces geometries just to batch them all down to one mesh?
Basically: if you are unable to figure out how to create a custom mesh then a block world isn’t a great place to start.
Sorry are you saying you built a giant mesh of the whole chunk? Or are you talking about not adding sides to each individual cube if they are covered by another block?
Thank you for taking the time to answer
Both… I only add visible sides and I add them to a custom mesh.
It’s kind of performance-ridiculous to create several thousand Geometry + mesh + Node data structures just to collapse them into one mesh again.
I mean, I get it. Creating meshes is hard. But so is creating a voxel world… and if a developer can’t create their own mesh then that’s where to start… because you will never get very far with a block world without building your own mesh.
In conclusion: ignore BatchNode and GeometryBatchFactory.