Author Topic: Alpha v0.123 "Ship Batch 4 of 7, And A Metric Ton of Improvements" released!  (Read 5118 times)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Quote
And instead moving that down to something close to 1 draw call
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Pretty much.  :D

The analogy I like to use is this:

- You have a giant 16 wheeler truck that moves very slowly, and a huge freaking factory on the other end, and 10 loader guys at your warehouse.
- 1 draw call is kinda one trip of the truck, more or less.
- It's super duper slow to move 1 can of soup across at a time.
- It's also pretty slow to have your loader guys box up cans of soup into 500 boxes with 50 smaller boxes in each before sending it.
- It's way faster to just put the soup in the truck and send it over in as few loads as the truck can take.

The next-to-last approach is basically dynamic batching, and the last approach is GPU Instancing.  Except in the case of GPU instancing, the cans of soup can have unlimited density per can. ;)
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Soupsplosion!

I rather like the mental image of a shipping container at a 45 degree angle next to a huge vat dumping soup straight in.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
I was rather enjoying the idea of an unlimited-density can of soup. :)
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Hopefully you won't wind up covered in soup if there are any bugs in the code!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
I was rather enjoying the idea of an unlimited-density can of soup. :)
Ok, so it's a shipping container with a 3-foot-radius black hole somehow secured near the other end. What could go wrong?
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
On another note, Keith, what other ships are we still waiting for? You said there would be 7 batches, and this is going to be the 5th, but it feels like you've already got most of the normal ships. Are there more guardians and so on? Or am I forgetting things.

Edit: Now that I think about it, there are still Golems and the Dyson Sphere and things like that. Maybe even the Spire(?!), though I think I remember that was coming later.
« Last Edit: May 16, 2017, 08:38:56 pm by BadgerBadger »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
I think this is going to need to wait until tomorrow, unfortunately.  The sidebar is still a mess visually, and is causing performance spikes because I haven't optimized that yet.

The gimbal sprites are all batching like nobody's business (woohoo!), and with the GUI off my performance is something like 80 to 120 fps where it was 80ish prior to the new batching, and 30ish prior to this new build.  One thing to note is that fps is a bit of an exponential scale -- to move from 30fps to 40fps is shaving off way fewer ms compared to 80fps to 100fps.

The vast majority of the load is now on the CPU on my machine in things unrelated to rendering but instead related to things like ship orientations, etc.  I'm a little concerned about that, but vector math only gets so fast, and once we're talking the difference between 80fps and 90fps with 7000 onscreen ships, we're really splitting hairs.  There's just only so fast that will go given the scale, and this is a huge improvement over the hard-locked 20fps that AI War Classic had.

All that said, the gimbals themselves are doing some strange stuff because I've got some bad offsets in my math there (it worked with the old dimensions of geometry I was constructing by hand, but not by the instanced plane I'm using now).  I need to fix that up, and fix up the GUI rendering to work, and then get the GUI spike killed, and then this is ready to go out the door.

The billboarding of the gimbals on the CPU is also something that concerns me, although it's being throttled and is not showing up in my performance profiling as being an issue.  Still... I don't like it.  I'd like to move that onto the GPU, where operations like that are so cheap and easy... but the math for that gets kinda messy because I have to do a bunch of matrix transforms and other messy things.  It's doable, but I don't want to do it at the present time.  Turning off all the billboarding on stuff didn't seem to actually affect the performance of this at all, so that was interesting.

I think that shots are right now causing more load than they should because of orienting to their movement direction, which is a big bummer.  I think that I can solve that by doing a rotational matrix transform on the GPU if I give it a world-space coordinate in one of my custom shaders, but again that is something to wait for another release.  I think that's eating up an unfortunate number of cycles during battle, though, at any rate.

I also found a surprising performance improvement in the form of Application.isPlaying being called too many times (5000ish times per frame in a battle with 5000 ships visible), so I optimized that down to 1 call regardless of how many ships are there.  The deep profiler sometimes over-weights methods that get called a lot because of the instrumenting going on in there even if the method isn't that heavy, but in this case it was a worthwhile thing.

I'm really frustrated I couldn't get this out today, but the results are roughly what I hoped for.  I was hoping I'd have more like a solid 120fps rather than something that fluctuates up to that, but I underestimated how much load is coming from other things on the CPU unrelated to rendering.  Right now about 84% of the per-frame load on my machine comes from the CPU doing non-rendering-related things, and non-sim-related things.  More or less.  Some frames, it's closer to 40%.  All that means is I have some more things to look into, and possibly some "loops to unroll," etc.  I think there's a CPU-side square root check that I can cut out, for instance.  There's some other throttling stuff I can probably do with the LODs, too.

But I'm not going to hold up the release for those bits!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
On another note, Keith, what other ships are we still waiting for? You said there would be 7 batches, and this is going to be the 5th, but it feels like you've already got most of the normal ships. Are there more guardians and so on? Or am I forgetting things.

Edit: Now that I think about it, there are still Golems and the Dyson Sphere and things like that. Maybe even the Spire(?!), though I think I remember that was coming later.

These are just the 7 batches for pre-Early-Access.  There's a bunch of stuff coming between EA and 1.0, too.  Golems and Spire are in that.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Fair enough. Now log off and go spend time  with your family! We appreciate all the hard work y'all are putting in!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
How goes the struggle with the sprites? Are you triumphing?

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Yeah, I have most of the stuff with the actual sprites working properly now, which is a relief.  On the gimbals in the main planet view, that is.  Using cutout sprites and z testing (to avoid overdraw) I was getting a pretty wicked flicker at far distances, which was unfortunate.

So I've had to shift to a transparent shader (not a crisis, but loses a bit of performance), which puts it in a different queue that is sorted better.  It's not noticeably slower on my machine, and I'm averaging closer to 100fps in that test scene now actually (with the GUI off).  That's working very well... except I've got some sort of strange sorting issue where it's reverse-sorting them for the most part, but not entirely.  Not sure if that's related to the instancing or not, but I'm having to hunt that down now.

Keith is looking into the performance spike that happens when aggregating stuff for the sidebar in the GUI, and I've still got to get the sprites drawing in the galaxy map and the sidebar after I fix the sorting issue.  The former is very easy, the latter is an unknown but knock on wood.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Got that bit fixed.  Cost me 5ish fps because of the way the sorting then has to work in the transparcency queue, but it's visually correct at all times.  I wish I could use the zbuffer, but that's just not remotely precise enough.  I AM using the z buffer to collide with other geometry, but I'm not writing to it.

In the future if it's really a problem I might be able to use the stencil buffer for these guys instead, but I'm not sure that's really going to be any place a substantial bottleneck exists.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Lets see how all the performance improvements you guys already have in before you agonize too much over 5FPS (since we are already up 50 or 60 in large battles).

Once we get these performance boosts in I'm going to try to set up an even bigger battle for reference ;-)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
I wouldn't get too trigger-happy just yet.  There are some late-breaking issues now that are not render-related that are gumming up the works, and in those battles I'm now getting 5-20 fps in a lot of cases.  There are some draw-related things I can still improve, and a goodly bit of the remaining issues may be related to the sidebar (which is the last thing on my list for prior to this release), but it's still not as buttery-smooth as I'd prefer.  Yet.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!