3D Slow terrain loading. (How to optimize?)

Discussion in 'Programming' started by Misty, Jun 29, 2016.

Thread Status:
Not open for further replies.
  1. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    No, it isn't, but this new guy, slayer 64 seems to stand out of the crowd.
    I'd like to hear his advice. It doesn't seem negative and overbearing, but genuinely helpful advice such as how to smooth normals via ds grids.
     
  2. hippyman

    hippyman Member

    Joined:
    Jun 20, 2016
    Posts:
    565

    There's nothing civilized about being too stubborn to except help literally right after asking for it.

    Trolling == Civilized == False
     
  3. Lotias

    Lotias Member

    Joined:
    Jun 20, 2016
    Posts:
    87
    He said it was a solution in GM:S. You know, the program you say you won't use.
     
    RichHopefulComposer and hippyman like this.
  4. hippyman

    hippyman Member

    Joined:
    Jun 20, 2016
    Posts:
    565
    GMS

    That means Studio. Which you refuse to use.


    Edit: Ninja'd
     
  5. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    Quick to jump to conclusions are we?

    The word he said was gms. He probably meant it as gm's...a simple typo.


    The "help" I was suggested was vertex buffers, seeming to ignore the fact I repetitively stated that my lag wasn't from d3d_models, and a bunch of posts along the lines of posting suggestions about how to calculate timers that seemed to ignore my post right above them.
     
  6. Lotias

    Lotias Member

    Joined:
    Jun 20, 2016
    Posts:
    87
    Well unfortunately, nobody knows a thing about what your code even does, specifically. We'd have to see the actual code. Which you won't show us. That's why most of these suggestions won't help you.
     
  7. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    At least some pseudo-code would give a bit of insight into your problem.
     
  8. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    I gave you much of the needed information to extrapolate reasonable solutions with. And then you bully me to show you my code, and when I don't obey, I get threats from you that you will close my topic down.

    For instance, slayer64 doesn't know my code, and yet, it seems, he is already on the right track.

    I did earlier.
     
  9. Lotias

    Lotias Member

    Joined:
    Jun 20, 2016
    Posts:
    87
    No you didn't. I can't tailor suggestions to what barely constitutes as a summary of your scripts.
    Slayer64 probably just had to make a guess. Most of us don't have time to play 20 questions with you.
     
  10. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    Slayer64 seems to be man about town who knows the whole terrain game.

    What exactly kind of psuedo code do you want if my original wasn't what you were looking for?
     
  11. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    Slayer64 to the rescue! Im quite interested in this simple trick!

    The thing about vertex buffers is not only the lower overhead, but they also allow you to use more efficient algorithms as you can manipulate are buffer then cast it to a vertex buffer.
    You also said method calling caused lag. Thats because of interpretation overhead.

    We also suggested using a single loop (rejected too).

    To give more substancial advice, code is needed. or at least, some outlibe of your algorithm. (What you gave us is far from helpfull)
     
    hippyman likes this.
  12. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    lmao, No, dont miss understand me. I'm saying to move up to GM studio. That I originally had a hard time making the change



    Dude, you're not using a c level engine to make graphics though. Also throwing polygons and textures at any machine is nothing. I can run source maxed out on intelHD4000k. I can run unreal 2004 on max. There are no shaders. Saying you run quake 3 is not impressive.


    Also, you're 25, you can't afford 250 bucks at a one time price to make your life better?
    Comfort leads to laziness. It means you settle for things and wont change. If you aren't willing to improve the experience to get things done, then no one here can help you and the topic is pointless. No one even has any code yet.

    Also, porting to GMS vs making something in gm8 isnt even comparable, even after the port. The options available and optimization techs used are completely different so its irrelevant what you do in GM8. I spent 5 long years of my life optmizaing 3d in GM6, and all that has been forgotten because it is completely worthless now. You can't apply those things today.
     
  13. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    As in explaining which specific built in functions are in use, some of the structure (more than just an oversimplified abstraction, detail is important when finding bottlenecks)
     
  14. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    That's not what I'm saying. I'm saying, I had no trouble moving up to studio, but I prefer the aesthetics of the GM8 IDE.




    Never said it was impressive, was simply saying Quake 3 is all the graphics gamers (and game makers) really need.


    And yet it seems, Slayer64 already has a solution that will help me.



    Not all of us are middle class citizens.

    Seems you guys didn't read all of what I said.
    I said it would be impractical to use a single loop. Further more, I also stated that the issue is is irrelevant, because the extra loop only takes up 0.3 seconds of computation time.


    Already said the functions, ds_grids and d3d_model calls, those are the only functions.
     
  15. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    As if quality of life depended on having decent specs.
    It would make life as a dev easier, but you can't assume everyone has at least 250 to dish out every generation of pc hardware. {Note: I have a decent spec machine so I'm not just hating}
     
    GMWolf and Misty like this.
  16. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    per step? this ist clear. again, code would help.

    Not helpful.

    Code:
    g <- heigtmap grid
    m <- model
    
    for all points in grid (x, y) {
        g[x,y] = get_height(x, y); //some methods that get the height
    }
    
    for all points in grid (x, y) {
        p1 = g[x, y];
        p2 = g[x + 1, y];
        p3 = g[x, y + 1];
        p4 = g[x + 1, y + 1];
        add triangle p1, p2, p3 to m
        add triangle p3, p2, p4 to m
    }
    
    helpful.

    THis is the kind of stuff we need to help you. it allows to see how your code flows, and where we can optimize.
    The actual code would be even better...
     
  17. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    Slayer64 hasn't said anything lol. He just said you could smooth them. I could believe he would have a trick up his sleeve, but again, optimizations don't transfer well. Also, 250 bucks for something that last years is chump change, even for someone with nothing but a part time min wage job. The value a good PC adds is far worth it. You can afford internet and stuff clearly, so you're not in the bucket list.

    There are other skins for GMS, I don't know what to tell you if you don't want the upgrade. You're probably better off spending your time coming up with ideas than posting here. I already said most members would prefer to leave legacy behind. If you're willing to sacrifice an all around better system for something as fickle as one or two cosmetic changes, then we can't help.
     
  18. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    I agree. Not everyone has cash on hand.
    but someone with trade secrets must do...
     
  19. Matthew

    Matthew Guest

    I can fix this without looking at your code. Your problem is right here; You're using two loops. Smart people only use one.
     
    AlphaChannel likes this.
  20. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    What I said earlier about erroneous correlations...

    It was clear when I said it at first, this is me repeating myself, during those times things become less clear.
    Smart people read the posts above, which said that it only takes 0.3 seconds...and if you read closely earlier, meaning not per step, 0.3 seconds period.
     
  21. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    He already said he wont change it. We've already suggested this. He writes the data in, then reads it back out.
     
  22. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    Anyways, I see Misty's point of view with GM8. I loved Gm8, a lot, but thinking about it seriously and objectively, a FREE upgrade that comes with hugely increased CPU/GPU efficiency and performance + the possibility of multiple export platforms, rejected solely based on confort and "aesthetics", I find quite difficult to understand.
     
  23. Matthew

    Matthew Guest

    Why are you the arbiter of intelligence? I can think of fifteen better candidates that can't even tie their own shoes.
     
  24. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    Let's say you read it wrong. Let's say that I meant 0.3 seconds per step not per generation.
    Earlier I mentioned each chunk is generated 1 chunk per frame, then I said there are 4 chunks. I also said the problem is it takes 11 seconds to load. 0.3*4 = 1.2 seconds...
    So even if you thought I meant per step, still no excuse, that's only 10 percent of computation time, out of 11 seconds, mostly insignificant since you also factor in the fact that such a low amount would be able to be shaved off. And that's an "even if" since in actuality it's .3 seconds out of 11 seconds, not 1.2 seconds....
    Please hammer about vertex buffers again, so I can shave off 0.3 seconds of computation time.

    Why give the code if you won't bother to do the calculations?
     
  25. PlayLight

    PlayLight Guest

    For F*&k sake, can we all just ignore this topic and stop posting on it! I'm so sick of seeing it in the list.
    You have All helped way more than necessary. Just ignore it and move to helping members who deserve your time.

    To the OP: if you only want advice from Slayer64, then use your head and contact him directly!
     
  26. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    So the code gets executed every step.

    The d3d_model definitions take 0.3 seconds. (so far, in total when the game finished loading? or per frame? not clear)

    apparently the d3d_model definitions are in the second loop. ok.

    so its 0.3 seconds in total? now we need to know how over how many frames this test was done. the 0.3 second metric is far from useful.

    granted, it would still be a small portion of the 11 seconds. However 0.3 seconds per frame would have explained the awefull 1fps.

    Actually, vertex buffers are not just a faster version of d3d_models
    they allow you to do tricks when using normal buffers, greatly reducing the overhead when defining the heightmap.
    If using a image heightmap, for example, you can convert the image straight into a buffer with all the height information you may need. (see
    ).

    You can save and load buffers quickly (usefull if working with infinite terrain. see
    )
    You can even save and load asynchronously. making loading assets at load time far easier on your fps.

    however, as with anything, buffers will only get you so far. Optimizing your algorithm is far more important. (unless you have image based heightmaps. check the first youtube link).

    With procedural generation, most of the performance is probably lost there. however, you havent supplied us with much with regards to that.
    Maybe if you could supply us with more information we can point you to the right direction.
     
    Last edited: Jul 1, 2016
  27. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    I heard of a 160 IQ guy who can't tie his shoes nor socialize so your statement is meaningless.

    So hostile and demanding. Noone forced you to post in this topic I certainly didnt.
     
    Lonewolff likes this.
  28. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    Whether or not he completely understood based off of your "easy to extrapolate" (yet ambiguous explanation of YOUR problem) is irrelevant to why you should or should not help YOURSELF by making it easier to help you acheive a solution.
     
  29. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    4 chunks, 1 chunk per frame...remember? So that's 4 frames.

    There is no heightmap...
     
  30. Matthew

    Matthew Guest

    I'm sure the crippled super genius who can't tie his shoes is the rule, not the exception. You're the first to bring the ability to socialize into this, though, so I sense a bit of projection.
    The fact that you're calling someone else hostile and demanding is funny, though. Here's a gun. I am fairly sure you can extrapolate exactly what needs to be done given the information you have been given.
     
  31. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    Yeah....
    This is getting stupid.


    here is the skinny. You have 4-5 people all saying the same things, things you are not willing to compromise on, things you turn your nose up at on a whim. We are at page 2 and so far, nothing is good enough for you. This is gone on long enough and is getting derailed. Either post all the code or I'm clocking out. These people are genuinely trying to help you.
     
  32. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    Going from interpreted to a compiled code indeed brings performance gains, no BS. You are just arguing against logic here
     
  33. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    What? if there is no heightmap, then you must be using voxels or something...
    (a ds_grid of height values is a heightmap. it maps a height value to a vector).
     
  34. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    Yes, I can extrapolate what needs to be done.:cool:

    Here's a thought. Why don't YOU, post the code , YOURSELF. How exactly would memory buffers help me in this instance Show me the code.
     
  35. Matthew

    Matthew Guest

    He asks for help, refuses to post his code, and then demands the people he's begging for help to post their code.

    Even I'm amazed.
     
  36. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    We should of EXTRAPOLATED this guys! WE are such idiots. How could we NOT know exactly what the problem is?


    You don't seem to get, noone can code anything that will be magically compatible with your mysteriously secret code.

    Like for example, I have used both GM8 and GMS. Frame rates HAVE measurably improved. Real world enough?
     
  37. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    That depends on your method of generating height values.
    Please tell us.
     
  38. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    I misunderstood. However I invite you to show me the code and how it would help, I stated earlier that ds_grid only causes 0.6 seconds of lag en total.
    Trade secret, as I said before.

    I'll make it compatible.
     
  39. Roa

    Roa Member

    Joined:
    Jun 20, 2016
    Posts:
    560
    lol, that's not how this works. I'm not going to write a bunch of code in hope it appeases someone. You have the code, and we are solving problems with it. I'm not writing anyone anything. You can pay me for that if you want. And I'm not going to even touch buffers when you wont even touch GM studio. How much of my time do you expect me to waste? You've already done enough of that and the only reason I stay is that I'm completely baffled. I don't want vague ideas. I want code. All of it, or I'm gone.
     
    Last edited: Jul 1, 2016
  40. Matthew

    Matthew Guest

    I'm beginning to think there is no code and OP is having a giggle.
     
  41. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,442
    I no longer have GM8, so i cant give you a categoric proof.
    granted, most games will not see that much of an improvement, but more intesive tasks such as procedural generation tends to use a lot of recursion and loops. Interpreters are very bad at that, and i have found that the GMS runner would sometimes decimate gm8 performance. The yyc would in turn decimate the GMS runner. Again, with computationally intensive tasks.

    so most of your performance is being eaten right here, and we dont even know what technique you are using?

    ok: guessing time you are using one of the following:
    • Fractal Noise
    • white noise
    • pink noise
    • perlin noise (woops, you said no there)
    • hydraulic erosion
    • heat erosion
    • wind erosion
    • hydrothermal plume data
    • simplex noise
    • voronoise
    • voronoi cells for biomes
    • voronoi (where the height is the distance to the edge)
    and just like that i gave out "trade secrets".
    Back to useful stuff (because im nice like that):
    http://www.redblobgames.com/maps/terrain-from-noise/
    some nice code in there. the whole website is good in general.
     
    Last edited: Jul 1, 2016
  42. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    Perlin or simplex?
     
  43. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    I'm beginning to think that you are having a giggle at the thought of me having a giggle.
     
  44. Lotias

    Lotias Member

    Joined:
    Jun 20, 2016
    Posts:
    87
    It speeds up math heavy code. For some people, they won't be seeing much of a speed increase.

    [​IMG]
     
    Lonewolff likes this.
  45. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    Definitely not perlin, but I'm not familiar with the simplex system so I can't give a definite answer on what that is.
     
  46. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    If you have the ability of somehow taking someones time to write code with unknown context, and you can apparently "make it compatible", then I can surely extrapolate the fact that you could come up with the buffer code yourself, as you know the way its going to be used best (your the only one here who knows the code), and have the skill based on your ability to "make it compatible"...
     
  47. Lotias

    Lotias Member

    Joined:
    Jun 20, 2016
    Posts:
    87
    You said it might only speed up sloppy code.
     
  48. Misty

    Misty Member

    Joined:
    Jun 22, 2016
    Posts:
    1,024
    Incorrect, none of those.
     
  49. AlphaChannel

    AlphaChannel Member

    Joined:
    Jun 30, 2016
    Posts:
    20
    Like word processors... On the other hand, games have always tended to be intensive.

    MS Paint then? I knew it :p
     
  50. Lotias

    Lotias Member

    Joined:
    Jun 20, 2016
    Posts:
    87
    Alright, here's what I can guess about how your code works.
    • Fill a medium sized pot with cold water. Place it on the stove on high heat. Bring to a boil.
    • Carefully place the spaghetti into the boiling water, making sure the spaghetti is completely covered with water. You may need to break the spaghetti in half. Bring water back to the boil, stirring the pasta lightly to keep it from sticking and reduce the heat so it doesn't boil over.
    • Cook for 7-15 minutes, depending on your preference, the type of pasta and package directions.
    • Remove pot from heat. Drain the pasta in the sink using a colander or large strainer, then transfer pasta to a plate. Serve immediately.
     
    Yal, Paolo Mazzon, Misty and 3 others like this.
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice