View Issue Details

IDProjectCategoryLast Update
0019087AI War 2Gameplay IssueMay 30, 2017 10:31 am
ReporterBadgerBadger Assigned ToChris_McElligottPark  
Severityminor 
Status resolvedResolutionfixed 
Product Version0.122 Ship Batch 3 of 7: 14 Ships! 
Fixed in Version0.300 - Welcome Early Access Kickstarter Backers! 
Summary0019087: Poor performance during 5K ship fight
DescriptionI'm not sure whether this is expected, but I'll say what I did. I modded my ark to make it extra strong (and bonus metal/power/fuel), then added all the ships we currently have models for to the "testing starting techs".

I then gave myself a ton of science and build a full cap of Mark 1-3 of all those ships, which was about 4K ships, all on my starting planet. I then sent my fleet to an adjoining mark 1 world. The resulting battle of about 4K of my ships and 1K of the enemy ships was very laggy. At full zoomout, I used a stopwatch and saw that 1 second of in game time was mapping to about 5 seconds of wall clock.

I'm not sure where the limiting factors are. I'm running a new AMD ryzen 1700 (16 cores) with 16GB memory. Could be my GPU I suppose, but it's not that ancient. Or are there additional optimizations that can be done in the code?
TagsNo tags attached.

Relationships

related to 0019105 resolvedkeith.lamothe Performance issues during battle in sim code. 

Activities

BadgerBadger

May 3, 2017 6:37 pm

manager   ~0046097

In a later fight with 800 enemy ships and about 5K of mine (including mark 1 starships, I timed 10 seconds of in game time at 80 seconds of wallclock)

Chris_McElligottPark

May 3, 2017 7:14 pm

administrator   ~0046099

A lot of optimizations are yet to come, mainly in the particle effects department. Savegames for that sort of thing would be very helpful, though.

Also helpful: if you tab out to the galaxy map while the battle happens, is it still that slow? If you zoom all the way in and stare out at nothing out to the side, is it still that slow?

That would help pinpoint where the issues are.

Thanks!
Chris

BadgerBadger

May 3, 2017 7:28 pm

manager   ~0046100

Last edited: May 3, 2017 11:17 pm

Here is a saved game. My fleet is on Hillis, and if I sent it immediately to "Motwani" then you can observe the game running like mud for me.

On my machine, once I sent my fleet in I saw 5 seconds wallclock to 1 second in game. I timed it looking at the fight zoomed out, tabbed to the galaxy screen and also zoomed in at nothing and the speed was still about the same (give or take a bit).

Also note there will be a few ships scattered around Hillis that you can't move. (All the ships in the middle of the map, not next to the warp to Motwani). I opened 0019093 to track that issue in particular, and there's another save game for it.

BadgerBadger

May 3, 2017 7:29 pm

manager  

NewSave_1.save (1,006,248 bytes)

Chris_McElligottPark

May 4, 2017 9:55 am

administrator   ~0046107

Got it, that sounds like a simulation thing then -- booting that over to Keith.

Do your logs have anything in them? I'm wondering if perhaps you're getting a steady stream of errors, which would account for the slowness.

BadgerBadger

May 4, 2017 10:01 am

manager   ~0046108

Nothing in the ArcenDebugLog. I don't think I checked any of the other logs; I can check that tonight

Chris_McElligottPark

May 4, 2017 11:19 am

administrator   ~0046110

Thanks! That's probably a good indicator there is nothing, then. But good to be sure either way.

BadgerBadger

May 4, 2017 8:47 pm

manager   ~0046112

No errors in ErrorsReportedByEngine nor the unity log either.

Chris_McElligottPark

May 5, 2017 12:35 pm

administrator   ~0046113

Got it -- thanks for the update!

BadgerBadger

May 10, 2017 12:19 pm

manager   ~0046137

It's still slow on .123.

Chris_McElligottPark

May 10, 2017 1:35 pm

administrator   ~0046152

Keith, this is completely based around the GUI updates, most notably the sidebar. Well -- when talking about why this is still slow on the galaxy map, anyhow. Even when paused, it chugs like crazy. There's just an insane amount of stuff being rendered via the sidebar right now.

The other thing that is causing such a slowdown is all the ship graphics doing dynamic batching. That punches this down quite a bit in terms of framerate, but it's still not desperately bad. And has no effect when you're staring off into nothing, or when you're on the galaxy map.

I need to look more into GPU instancing for these ships, clearly; it may be that we simply have to require that. The vast majority of GPUs players would be using will support that without issue, and it turns a CPU-side thing into something GPU-side that most anything can handle.

I will investigate that side of things.

Chris_McElligottPark

May 10, 2017 5:04 pm

administrator   ~0046155

Some improvements related to this, which are coming in 0.124:

* Support for DirectX9 on windows, and Metal on OSX, have both been removed.
** Neither of these platforms support GPU instancing, and if we want to have lots of ships doing lots of things at once we need those instancing capabilities.
** This will also raise the minimum system requirements to OpenGL 4.1 (or DirectX11) for all platforms.
*** This is something that really lets us make VASTLY more efficient use of the hardware you almost certainly already have. There are a few cases where someone might now be unable to run the game, and we can do refunds if needed in those cases.
**** However, based on hardware surveys that's probably a vanishingly small number of people that actually play our games. The Steam hardware survey in general reports 87% of all steam users have DX11 capable hardware, which is automatically also capable of OpenGL 4.1 (their feature sets are equivalent).
**** Yes, potentially more people have played our games historically because of very low system requirements, but we're actually a bit more forgiving (in terms of age of valid hardware) with the launch of AI War 2 in 2017 compared to the launch of AI War Classic in 2009.
*** Basically hardware support for this means: Nvidia GeForce 400 series and newer, AMD Radeon HD 5000 Series and newer, Intel HD Graphics in Intel Ivy Bridge processors and newer.
*** That in turn means that your system needs to date from roughly 2010 or 2011 at the oldest. There's a solid chance that stuff that old or older would not handle the AI well anyway, so the people we're excluding are probably dropping even further.
**** For more info: https://en.wikipedia.org/wiki/OpenGL#OpenGL_4.1
*** Finally it's worth noting that while we are targeting systems that are 6-7 years old at most as of 2017, this will let us do a much better job of future-proofing the game. Larger battles, better performance during them, and so on.
**** Changing the system requirements NOW, pre-launch, is vastly preferable to changing them after people buy the game on a storefront, to put it another way. Hopefully Kickstarter backers have a certain amount of understanding on this (and most of them, if not all, likely posses plenty-capable machines anyhow), but once it's on the open market we'd be saddled with the last-mile customers on DX9 or OpenGL 3.x or 4.0 for as many years as the game is getting updates. We would have really regretted that in a few years, even if we didn't need the performance boost from GPU instancing now.

* Created a new shader for our ships to use via Amplify Shader Editor instead of Shader Forge. This new one is more efficient, uses a few more modern features, and looks waaay better. Just getting started with this one.

* Using GPU instancing now instead of dynamic batching in most cases. This leads to substantially better performance when viewing giant ship battles.

Chris_McElligottPark

May 16, 2017 9:44 pm

administrator   ~0046160

* Sprites now use GPU Instancing, taking them from hundreds of draw calls and lots of CPU-side expensive dynamic batching to just a couple of draw calls (depending on circumstances), and most of that work offloaded to the GPU, which laughs at it.
** In a performance-intensive scene, this increased framerate from the 80s into the low 90s, or thereabouts.

* Introduced some throttling on ship and squad LOD and gimbal updates, to prevent slowdowns related to that in large battles.
** In a savegame where Chris was getting 90fps with something like 5k ships, this managed to squeak him up to 95 to 100fps, bouncing around in that realm.

BadgerBadger

May 16, 2017 9:47 pm

manager   ~0046161

Just for comparison, what was the framerate before any of your changes?

Chris_McElligottPark

May 17, 2017 9:19 am

administrator   ~0046162

In the 30s.

Chris_McElligottPark

May 17, 2017 4:43 pm

administrator   ~0046165

* Fixed the sidebar performance problems, but the sidebar still doesn't show up correctly. It's all default-colored and on linux likely doesn't draw at all. And missing the flair, etc.
** More on this needs to be done, but we didn't want to hold up this build.
** It's also possible that this will introduce some index out of exception errors based on race conditions, but we'll need reports of those (just stack traces is fine) in order to finish with those pieces.

BadgerBadger

May 17, 2017 8:23 pm

manager   ~0046169

I can report that there seems to be perhaps a bit of improvement, but a big fight still brings the simulation to its knees. Let me know if you want a new saved game, though it seems like the one you have is still doing good work for you.

Also, you are right, the sidebar doesn't draw on linux much, but it didn't work before so no change ;-)

Chris_McElligottPark

May 30, 2017 10:31 am

administrator   ~0046213

Marking this one as resolved now, as I can get 50-60fps in this scenario now. :)

There are more performance improvements to come, but they are no longer in the realm of fixing bugs.

Issue History

Date Modified Username Field Change
May 3, 2017 6:32 pm BadgerBadger New Issue
May 3, 2017 6:33 pm BadgerBadger Category Gameplay Idea => Gameplay Issue
May 3, 2017 6:37 pm BadgerBadger Note Added: 0046097
May 3, 2017 7:14 pm Chris_McElligottPark Note Added: 0046099
May 3, 2017 7:14 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
May 3, 2017 7:14 pm Chris_McElligottPark Status new => assigned
May 3, 2017 7:28 pm BadgerBadger Note Added: 0046100
May 3, 2017 7:29 pm BadgerBadger File Added: NewSave_1.save
May 3, 2017 11:16 pm BadgerBadger Description Updated
May 3, 2017 11:17 pm BadgerBadger Note Edited: 0046100
May 4, 2017 9:54 am Chris_McElligottPark Assigned To Chris_McElligottPark => keith.lamothe
May 4, 2017 9:55 am Chris_McElligottPark Note Added: 0046107
May 4, 2017 10:01 am BadgerBadger Note Added: 0046108
May 4, 2017 11:19 am Chris_McElligottPark Note Added: 0046110
May 4, 2017 8:47 pm BadgerBadger Note Added: 0046112
May 5, 2017 12:35 pm Chris_McElligottPark Note Added: 0046113
May 10, 2017 12:19 pm BadgerBadger Note Added: 0046137
May 10, 2017 1:35 pm Chris_McElligottPark Note Added: 0046152
May 10, 2017 5:04 pm Chris_McElligottPark Note Added: 0046155
May 16, 2017 9:44 pm Chris_McElligottPark Note Added: 0046160
May 16, 2017 9:47 pm BadgerBadger Note Added: 0046161
May 17, 2017 9:19 am Chris_McElligottPark Note Added: 0046162
May 17, 2017 4:43 pm Chris_McElligottPark Note Added: 0046165
May 17, 2017 4:43 pm Chris_McElligottPark Assigned To keith.lamothe => Chris_McElligottPark
May 17, 2017 5:47 pm Chris_McElligottPark Relationship added related to 0019105
May 17, 2017 8:23 pm BadgerBadger Note Added: 0046169
May 30, 2017 10:31 am Chris_McElligottPark Note Added: 0046213
May 30, 2017 10:31 am Chris_McElligottPark Status assigned => resolved
May 30, 2017 10:31 am Chris_McElligottPark Fixed in Version => 0.300 - Welcome Early Access Kickstarter Backers!
May 30, 2017 10:31 am Chris_McElligottPark Resolution open => fixed