Graphics Update: Making things go faster by doing less

Discussion in 'Planetary Annihilation General Discussion' started by varrak, September 17, 2014.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    On that topic: I wish they would do that.
    tatsujb likes this.
  2. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    Saaaaaaaaaaaaaaaaaaame.
  3. doud

    doud Well-Known Member

    Messages:
    922
    Likes Received:
    568
    Thanks for this varrak ! I'm still so much impressed when i watch a massive battle with tons of missiles, explosions and so on, all this running at 60FPS.
    Just for my information, as with bengolus you're in charge of optimizing the client side, who is in charge of optimizing the server side ? I'm now pretty sure pathing (called "navigation" in debug window) is the most intensive cpu task that would require a bunch ff this black magic you put on the client side ;)
  4. zgrssd

    zgrssd Active Member

    Messages:
    658
    Likes Received:
    185
    Different areas, different expertise.
    Graphics is all about figuring out what not to draw (at full detail) and when.
    In pathing you have no choice to not do a calculation just because the unit is off-screen. Until the unit is dead it needs to be considered for pathing and targetting alike. In pathing it is about not doing the same step more then once (if avoidable).

    While he could also be a crack in pathing, I think the graphics can use his expertise more right now :)
  5. crizmess

    crizmess Well-Known Member

    Messages:
    434
    Likes Received:
    317
    The GPU is smart, or at least it's smart in the sense of doing things really really fast, but on a very low level. For a graphics card it is all triangles and meshes, it doesn't know the higher meaning of those triangles. And that's where you need to help it out.

    Say you want to render a planet in PA, that is roughly 60K - 200K triangles. If you don't mind if the planet is visible or not you stream all those triangles to the graphics card. The graphics card will do the visibility test for you (frustum clipping, face culling, depth test, ...) and it will only draw those triangles that are visible, but since the card doesn't know that those 60K -200K triangles belong to "one" object (e.g. are spatially clustered <- well, I'm missing the correct term, so I made this one up ;) ), it tests every triangle for its own. This means 60K -200K triangles are streamed to the GPU (if you are lucky they reside in VRAM on the card, otherwise it will take up bandwidth from the PCIe bus), 60K -200K triangles are transformed and tested for visibility. If - at the end - the planet is not visible that is a lot of work for nothing.

    If you test the visibility in your program, the program knows that if it does one test for the entire planet it can skip those 60K - 200K triangles all together. Because you know that this is "one" object.

    Cheers,
    criz.
  6. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Thanks varak :)

    For being so awesome I shall give you a really cute puppy
    [​IMG]
  7. Baleur

    Baleur Member

    Messages:
    122
    Likes Received:
    22
    Reminds me of the theory that if something is not being observed by a sentient being, it simply does not exist (in any tangible meaningful way, with the whole quantum uncertainty principle, things must be observed to find a resting point).

    Its funny how philosophy, theoretical physics and something as seemingly trivial as graphics engine optimization are crossing paths. Oh, and Haruhi Suzumiya, naturally.
    masterevar likes this.
  8. websterx01

    websterx01 Post Master General

    Messages:
    1,682
    Likes Received:
    1,063
    How dare you change your profile picture!?

    I'd like to play with icons always on because I have a hard time seeing some of the units, or telling the difference at a quick glance (also, the T2 symbol on the icon needs to be more obvious. I get infernos and vanguards confused regularly). But I also don't want the ground icons showing up in the orbital layer, so I'm kind of stuck with range dependant.

    Edit: formatting. Also @varrak if you could make it so I can turn off ground icons while in orbit, but still have the icon at all other times, I'd love you even more! :D
    Last edited: September 18, 2014
    squishypon3 likes this.
  9. aapl2

    aapl2 Active Member

    Messages:
    260
    Likes Received:
    175
    thanks for the reply! I agree there is more important stuff too.
  10. varrak

    varrak Official PA

    Messages:
    169
    Likes Received:
    1,237
    BGolus does effects - he's the technical artist, so he makes things look pretty. I do code, optimization, stuff like that.
    We're doing another round of optimizations over the coming months, primarily focused on memory use and server performance. I'll be working on all that stuff (so less focus on the client for a while). There's four of us who'll be focused on server performance primarily, so I'm optimistic we'll make some solid progress.
  11. varrak

    varrak Official PA

    Messages:
    169
    Likes Received:
    1,237
    I like puppies. Here's me with mine: ;)

    10385490_10203376652189365_267677588593938168_n.jpg
  12. doud

    doud Well-Known Member

    Messages:
    922
    Likes Received:
    568
    by "bunch of this black magic you put on the client side" i meant "strong expertise in optimizing code". but i perfectly got that it's absolutly not the same
    Thanks !
  13. reptarking

    reptarking Post Master General

    Messages:
    1,321
    Likes Received:
    1,577
    Varrak, what do you think will be the bottleneck for us when we start purchasing servers to use for massive games?
  14. devoh

    devoh Well-Known Member

    Messages:
    445
    Likes Received:
    404

    I LOVE Nerd talk!
    varrak likes this.
  15. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    [​IMG]
    Last edited: September 18, 2014
    varrak and Remy561 like this.
  16. drz1

    drz1 Post Master General

    Messages:
    1,257
    Likes Received:
    860
    This sentence in particular made me happy. Post launch support FTMFW. Keep up the sterling work.
    thelordofthenoobs, varrak and Remy561 like this.
  17. websterx01

    websterx01 Post Master General

    Messages:
    1,682
    Likes Received:
    1,063
    @varrak You and the other optimization guys really should just start typing up a book for us forumers to melt our brains in. That'd be amazing!
    Remy561, varrak and drz1 like this.
  18. zgrssd

    zgrssd Active Member

    Messages:
    658
    Likes Received:
    185
    All hail to the guy working on the Server side, so we may soon(ish) have offline mode.
    May his coding the swift, may the bugs shun him and may his choosen datatypes always be on spot.
    someonewhoisnobody and drz1 like this.
  19. portable

    portable Active Member

    Messages:
    113
    Likes Received:
    50
    All of them. My build power usually grows exponentially. (That said, the game runs smoothly until the jig'd gas giant enters the view frustrum).

    As for specs, MBP late 2014, Intel Core i7, Intel Iris Pro, SSD, 16GB RAM, OSX 10.9.4
  20. Pawz

    Pawz Active Member

    Messages:
    951
    Likes Received:
    161
    @varrak

    I was wondering - how difficult would it be to make a projection of a planet that is one of the 'standard' full-earth projections?

    Not even in-game or whatever, I was just looking for a way to get this kind of image of a PA planet:
    [​IMG]

Share This Page