Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 246 times)
0 Members and 1 Guest are viewing this topic.
Offline LaakeS-G

Junior Newbie


Exp: 5 years



« Posted 2014-06-10 01: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.



UPDATE:

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.
1  
2  
3  
   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 02:00:27 »

Do not 'or nahh' in this part of the internet... ( Tongue )
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (39 views)
2014-07-18 06:55:21

Zero Volt (36 views)
2014-07-17 23:47:54

danieldean (29 views)
2014-07-17 23:41:23

MustardPeter (32 views)
2014-07-16 23:30:00

Cero (47 views)
2014-07-16 00:42:17

Riven (48 views)
2014-07-14 18:02:53

OpenGLShaders (38 views)
2014-07-14 16:23:47

Riven (37 views)
2014-07-14 11:51:35

quew8 (33 views)
2014-07-13 13:57:52

SHC (70 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!