Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Asynchronous Chunk Loading and Calculating?  (Read 3931 times)
0 Members and 1 Guest are viewing this topic.
Offline LaakeS-G

Junior Newbie

Exp: 5 years

« Posted 2014-06-09 23:16:41 »

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...
Offline Jacob Pickens
« Reply #1 - Posted 2014-06-10 00:00:27 »

Do not 'or nahh' in this part of the internet... ( Tongue )

Pages: [1]
  ignore  |  Print  

mercenarius (14 views)
2020-06-04 19:26:01

mercenarius (22 views)
2020-06-04 19:13:43

Riven (866 views)
2019-09-04 15:33:17

hadezbladez (5848 views)
2018-11-16 13:46:03

hadezbladez (2657 views)
2018-11-16 13:41:33

hadezbladez (6273 views)
2018-11-16 13:35:35

hadezbladez (1518 views)
2018-11-16 13:32:03

EgonOlsen (4749 views)
2018-06-10 19:43:48

EgonOlsen (5804 views)
2018-06-10 19:43:44

EgonOlsen (3298 views)
2018-06-10 19:43:20
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!