1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GPU Generation Woes. A setback.

Discussion in 'News and Development' started by Benjamin, Jun 30, 2015.

  1. Benjamin

    Benjamin Lead Developer

    • Dev Leader
    Today I got voxel generation back in for the heightmap terrain. Originally, my intent was to use 64 bit doubles on the CPU to generate the voxels, and 32 bit floats on the GPU for the far terrain. The far terrain wasn't that precise, so I thought that the loss of precision would just cause minor inconsistencies that weren't noticeable at all. Unfortunately, due to the way gradient noise works, the two implementations produce vastly different results. The 64 bit CPU version didn't line up with the far terrain at all in some places, and it only got worse the more octaves you added. We simply can't use a 64 bit GPU implementation, so it seems that we are going to have to switch to CPU only, which will be nullifying a lot of the work I put into GPU gen. (I'm used to throwing away work now)

    The implications of switching to full CPU generation are as follows:

    • Easier for modders to change generation.
    • Can use much more complicated and realistic generation techniques (can't use branching well on GPU)
    • Easier to manage code wise, since we don't need to make sure the two implementations are the same.
    • Far terrain generation may be noticeably slower.
    • May not be able to generate normal maps anymore (requires 16x as many noise samples) Or we may only generate them close to you. However, there are other ways to make it look good even without generating normal maps.
    It won't be as slow or poor quality as the 0.1.6 terrain generation, since that one didn't even use multithreading. I am confident that we can get good results with this, it's just a shame.

    This is entirely my fault for not doing enough preliminary testing and making assumptions about precision implications, and I am sorry.

    Over the next few days I'll work on outlining a new generation system that uses the CPU, that will allow lots of flexibility in generation, and I will do my utmost to make sure the generation stays fast and remains of high quality.
    Snipecoolbunny, Dysche and Con No 1 like this.
  2. Arctic

    Arctic Giant Robot Advocate

    • Tester
    It's OK, Ben. We can wait.
    Benjamin likes this.
  3. Thomas988

    Thomas988 Back Into Space

    • Member
    Oooo, ouch. Hoping things will turn out better. :(
    Benjamin likes this.
  4. JClavaud

    JClavaud Crash Landed

    • Member
    That's not a fail. Everyone has to make his learning. You're doing right and I can't wait for your next version.
    Benjamin and Thomas988 like this.
  5. Dysche

    Dysche Intern Programmer

    • Dev Member
    It's not a problem, everyone makes mistakes. Be happy that you discovered it now instead of, for example, when the kickstarter is up.
  6. joppiesaus

    joppiesaus Infamous Space-Octopus

    • Member
    Why not make a 32 bit gradient noise function that generates the same numbers as the 64 one?
    Or switch to another variant that does?

    ADG go fix it!
    joppiesaus, Jul 1, 2015
    Last edited by joppiesaus; at Jul 1, 2015
    Dysche likes this.
  7. Dysche

    Dysche Intern Programmer

    • Dev Member
    I think I'll make the tool first :p
    Dysche, Jul 1, 2015
    Last edited by Dysche; at Jul 1, 2015
  8. Sevio

    Sevio Back Into Space

    • Member
    You've discovered something new and unexpected, which rarely happens in the most optimal way, so I'd still consider this time well spent. :)

    A question about the procedural generation in the scenario where the game has matured a lot more, how often will this get run? Is it on creation of a savegame/world, every time the game loads, or every time (a part of) the world gets loaded for viewing?

    In the first case, I think most people would be willing to sacrifice a little bit of generation time to get all the pros you've mentioned.

    The second case would be a little bit worse as this would affect the time from game startup to actually playing.

    In the third case, the performance would be most critical for how moving through the world is experienced.

    If the performance impact is large enough, I think the second and third cases could benefit from a caching mechanic to spare the CPU repeated work, it might not help much when first moving into a completely new area but it would definitely improve gameplay in areas already viewed at least once.

    To save development time you could delay writing this caching mechanic right now but keep it in mind when designing the code so you can easily plug it in later, ideally this would also work transparently for mods that affect terrain gen. :)
  9. Benjamin

    Benjamin Lead Developer

    • Dev Leader
    The CPU gen will be able to keep up with regular gameplay needs with no issues whatsoever. And I was definitely planning on looking into some kind of cacheing.
  10. Benjamin

    Benjamin Lead Developer

    • Dev Leader
    Well, I switched to full CPU gen and by the gods it is SO slow compared to GPU. Faster than 0.1.6, but man the difference is astounding. Before I settle on CPU I am going to try different noise implementations with GPU as @joppiesaus suggested and I'm also going to see if I can do something clever to maximize precision even at small levels.
  11. Arpak

    Arpak Moderator - Former CM

    • Moderator
    Just sprinkle some of your voodoo magic on it @Benjamin, that always works.... right?
    FruitGish likes this.
  12. tetryds

    tetryds cus tet, that's it

    • Member
    Ok if it's not as fast but is it slow for the speeds you would be travelling at ingame? Not accounting for noclip mode.
    Because it just has to be "fast enough".
    tetryds, Jul 2, 2015
    Last edited by tetryds; at Jul 2, 2015
  13. Arctic

    Arctic Giant Robot Advocate

    • Tester
    What about if you're in a supersonic jet, "Running around at the speed of sound"?
  14. Sevio

    Sevio Back Into Space

    • Member
    I think for the case of flying supersonic jets, or even sideways-flying rockets or re-entering spaceships, you pretty much shouldn't be allowed to get close enough to the ground to see voxels because even if the game itself could keep up, there's no way any server connection would keep up with loading chunks that fast.

    Edit: Or just turn off voxel loading entirely when going above a certain surface-relative speed.

    I'm not sure how this would handle landing a plane at realistic speeds though, because they can still be going 80 m/s, which translates to loading 160 voxels per second in the direction of travel while landing.
    Last edited: Jul 2, 2015
    Sevio, Jul 2, 2015
    Last edited by Sevio; at Jul 2, 2015
  15. Benjamin

    Benjamin Lead Developer

    • Dev Leader
    I switched to a faster noise implementation that uses lookup tables and its 20x faster than it was yesterday. Still slower than GPU and poorer quality, but its very playable now, it keeps up with the camera pretty well.
    Thomas988 likes this.
  16. Thomas988

    Thomas988 Back Into Space

    • Member
    Good to hear! :)
  17. Shashwah

    Shashwah Tester

    • Tester
    WOOOOOOOOOOOOOOOOOOO It's been ages since we got ourselves an update
    ColdFuseon likes this.
  18. ColdFuseon

    ColdFuseon Lost in Space

    • Contributor
  19. PsychoticLeprechaun

    PsychoticLeprechaun Designer & Web Developer

    • Dev Member
    It has, unfortunately there really isn't anything to tell. No meaningful progress has been made since the last update; some small things like Georg fine-tuning the Trinity star system and some further work on the web back-end but nothing on the game itself. I'm about to undertake my master's year at university, which is going to be the most demanding year yet, so I probably won't be able to do much during that time. The others are in similar situations to where they were as of the last update too. It's not what we want - for progress to be at a stand still - but for now it's our reality. :(
    joppiesaus and ColdFuseon like this.
  20. Agarthan

    Agarthan Reinvented The Wheel

    • Member
    I'm seeing games with voxel based models that are destructible and voxel games on steam that look like your world generation. Hope you guys still plan to do something with all this.
Similar Threads: Generation Woes
Forum Title Date
News and Development Procedural Heightmap Terrain Generation Jun 27, 2015
News and Development GPU Terrain Generation Update Apr 20, 2014

Share This Page