Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Multithread support?

Author
Message
BN2 Productions
13
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 22nd Sep 2014 09:15
I'm working on a procedural generation program that, currently, generates a galaxy and allows you to seamlessly (so far) zoom into the solar system level (ie: A sun and it's orbiting planets are shown). The next step is to enter a planet's atmosphere and land on it.

I've been looking into various procedural generation routines for the landscape heightmap, and the best I've found so far takes about a second for it to generate a chunk then apply it to a terrain object.

As you can imagine, 1 second is too long for something that would be loading regularly (every time you cross a chunk "border"). While I have only a little experience with Multithreading concepts, it seems that if I could have the generation routine run concurrently with the main program, and once completed it could terminate the thread and display the object.

Multithreading support doesn't seem to be included in older C++ versions, specifically the version VC++2008 uses.

Is there any GDK options? Or perhaps a better way to do the loading?

Thanks

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
TheComet
10
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Sep 2014 19:42 Edited at: 22nd Sep 2014 19:46
DarkGDK is inherently not thread safe. This means that any async call you make to darkGDK will yield undefined behaviour. The best you can do is re-compile DarkGDK after adding internal locks to all of the functions you'll be using to load the terrain.

For a powerful and easy to use threading library I highly recommend Boost.Thread. You can download it here:
boost

Specifically, read through the tutorial section on some of the core concepts:
thread management
scoped threads
synchronization

Building boost on Windows should be as easy as (from the command line):
+ Code Snippet

If you require assistance with building Boost.Thread or need help with C++ related code, you are very welcome to join our C++ skype group. Just add the__comet (with two underscores) and state you want to be part of the C++ chat, I'll add you asap.

I like offending people. People who get offended should be offended. -- Linux Torvalds

Login to post a reply

Server time is: 2017-11-20 13:25:17
Your offset time is: 2017-11-20 13:25:17