Just wondering what everyone stance is on this? Ive been working for a few hours on trying to find the best way around it. See what other people have done and so forth, im using my mac as its a great low level computer to test speeds on, its a 2012 mac pro running intel hd graphics and has 4gb DDR3 on an 2.8GHz i7. I use it mainly for all of my college papers and lab writeups.
What ive found out so far:
- Pre-Calculating VBO chunk meshes = slow but worthy of option(takes around 49ms on my mac)
- Using byte based system to predetermine faces to render before creating a display list in display thread = fastest(takes around 21ms on my mac)
And with trying to just calculate and load the chunks in the main display thread causes about 63 ms or so lag on my mac. Which is quite noticeable when you cant move or look at anything for a few normal frames.So basically whats everyone elses ideas on asynchrounous chunk loading and how to accomplish it with minimal stress.
NOTE: I am using the JavaExecutor Service as a backbone for all async systems in my game atm. if you dont know what it is i highly suggest you read up on it. Its a great system.
Well i found the best way, had to rewrite my basic chunk creation and rendering system, but this is what i did.
Used VAO's inside DisplayLists.
Used QUEUE for chunk management of ready to render and ready to dispose chunks.
When chunk is created through async thread start the build.
Once build is complete call the static instance of the world and addthe chunk to the ready queue.
During render call go through ready queue and poll() the chunks and add to the loaded array
Then go through and draw (a.k.a. create pointers and call drawarrays in the display list) all the loaded chunks in the array. (Only draws and recompiles the display list if the chunk has been changed in any way.)
After drawing call the chunk render, which just calls the display list.
Running at a constant 160fps (running through space letting chunks load) on my mac, only noticed a frame drop when 63 chunks were loaded and even then only took around 9ms or so to load a chunk onto the gpu.
This is how i used the queues.
private Queue<Chunkv2> ready = new ConcurrentLinkedQueue<Chunkv2>();
private List<Chunkv2> loaded = new ArrayList<>();
private Queue<Chunkv2> delete = new ConcurrentLinkedQueue<Chunkv2>();
My chunks are 175 X 16 X 16, they contain intricate cave systems. i use multiple simplex noise algorithms to determine things such as cave height cave density cave population etc...