View Issue Details

IDProjectCategoryView StatusLast Update
0002549Spring engineGeneralpublic2011-07-18 20:50
Reporterrubrick Assigned Tozerver  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.82.7.1 
Fixed in Version0.82.7+git 
Summary0002549: Choppy / stuttering gameplay (Draw Call-Ins + Unsynced heightmap eats CPU)
DescriptionWhenever I play Zero-K, the game gets choppy very quickly. The first few minutes the game runs ok, then a recurring stutter becomes noticable about every second. At some point the CPU has huge spikes and goes all the way up to 100% (and beyond).

I do not think this is caused by my hardware, which is fine (see attached infolog.txt). Also, it doesn't matter if I reduce the graphics settings; the choppiness remains the same whether I choose very high or very low resolution / settings.

When I use Alt+B to check the CPU load, it seems these spikes are mostly caused by "Sim Time" and "Unit Slow Update".
Additional InformationI have tracked the issue down to massive amounts of CPU time spent in UpdateHeightmapUnsynced and UpdateHeightmapSynced

It seems that there are some events in Zero K that generate enormous amounts of heightmap updates. For example, a "give all" generates 0004904:0015000 updates.
TagsNo tags attached.
Attached Files
infolog.txt (Attachment missing)
20110710_105143_XacomBeach_0.82.7.sdf (Attachment missing)
output.svg (Attachment missing)
profile.png (Attachment missing)
Checked infolog.txt for Errors

Activities

Kloot

2011-07-10 23:22

developer   ~0006991

Lua code issuing 15000 updates does not seem like it should be our problem to fix.

Google_Frog

2011-07-11 07:30

reporter   ~0006992

No lua heightmap manipulation is done on give all. Whatever it is it is your problem to fix.

abma

2011-07-11 09:45

administrator   ~0006993

afaik buildings update heightmap (they "flatten" terrain)

zerver

2011-07-11 11:24

reporter   ~0006994

I'm not sure how many units this applies to, but the commanders in zerok also flatten the ground as they walk around, generating hundreds of updates per second. The problem appears much less severe in 0.82 than in master so imma look into it.

Google_Frog

2011-07-11 13:13

reporter   ~0006996

Nothing has been added modside to cause any units to flatten ground by moving around. If they do that it is an engine bug.

zerver

2011-07-11 18:20

reporter   ~0006997

We are probably talking two different bugs here, the HeightMap thing is a new bug in master, kloot appears to be working on it, while your bug in 82.7 seems to be caused by zero-k itself. Some LUA code spends too much time in draw call-ins, Update() in particular.

Easiest way to test it is to try with latest master build and use spring-multithreaded with setting EnableDrawCallIns=0. I'm pretty sure you will find that ZK runs ultra smooth with this setting... :)

If you still see some jerks I'm guessing it is the unsynced heightmap that needs more tweaking. My testing is based on ZK 0.8.7.2.

jK

2011-07-11 23:26

developer   ~0006998

Last edited: 2011-07-11 23:29

svg: http://springrts.com/mantis/file_download.php?file_id=1631&type=bug (seems mantis sends wrong MIME for svgs o_O)
png: http://springrts.com/mantis/file_download.php?file_id=1632&type=bug

Note: the profile was created with max speedup & a powerful pc, that's why `synced` code takes 99% (we are only interested in that atm).

rubrick

2011-07-13 20:07

reporter   ~0007015

Last edited: 2011-07-14 07:24

@zerver: I tried setting EnableDrawCallIns=0. This does help to smoothen ZK a lot (unit slow update is almost completely gone and sim time is a lot less), but the stutters do not disappear. When the game progresses the stutters become worse and the frame rate drops again.

Unfortunately running spring-multithreaded doesn't seem to work. ZK 0.8.7.2 says MT is not supported, and LUA widgets generate lots of exceptions. The game becomes essentially unplayable.

rubrick

2011-07-17 14:10

reporter   ~0007050

Hmmm. It seems my computer has fallen victim to https://bugs.launchpad.net/ubuntu/+source/jockey/+bug/771788. Although it seemed from the infolog.txt that Spring was properly using my NVidia driver, I think it actually didn't. When I downgraded my Ubuntu install back to 10.10, and made sure the NVidia driver was properly activated, the stutters all but disappeared. Yes, I'm still seeing lots of (smaller) spikes in sim time and unit slow update, but they're not nearly as disruptive as they were before. The game keeps running smoothly now.

So feel free to close the bug, unless you want to keep it around for the issues Zerver mentioned in comment 6997.

(BTW Thanks for a great bug reporting experience :) I really appreciate the extreme speed with which you picked up on the report and tracked down possible performance problems. Keep it up!)

zerver

2011-07-18 20:49

reporter   ~0007054

Okay!

Actually I see some stutters in the Sim Time as well, and some more pronounced stutters if I have a larger group of units selected. It is very likely that the problem lies in ZK itself.

The heightmap problem is also solved, so I'm closing.

Issue History

Date Modified Username Field Change
2011-07-10 12:17 rubrick New Issue
2011-07-10 12:17 rubrick File Added: infolog.txt
2011-07-10 12:17 rubrick Graphics Card => nvidia
2011-07-10 12:17 rubrick File Added: 20110710_105143_XacomBeach_0.82.7.sdf
2011-07-10 23:01 zerver Priority normal => high
2011-07-10 23:01 zerver Status new => confirmed
2011-07-10 23:01 zerver Category Linux => General
2011-07-10 23:01 zerver Summary Choppy / stuttering gameplay => Choppy / stuttering gameplay (Synced / Unsynced heightmap eats CPU)
2011-07-10 23:01 zerver Additional Information Updated
2011-07-10 23:22 Kloot Note Added: 0006991
2011-07-11 07:30 Google_Frog Note Added: 0006992
2011-07-11 09:45 abma Note Added: 0006993
2011-07-11 11:24 zerver Note Added: 0006994
2011-07-11 11:24 zerver Status confirmed => assigned
2011-07-11 11:24 zerver Assigned To => zerver
2011-07-11 13:13 Google_Frog Note Added: 0006996
2011-07-11 18:20 zerver Note Added: 0006997
2011-07-11 18:21 zerver Status assigned => feedback
2011-07-11 18:25 zerver Summary Choppy / stuttering gameplay (Synced / Unsynced heightmap eats CPU) => Choppy / stuttering gameplay (Draw Call-Ins + Unsynced heightmap eats CPU)
2011-07-11 23:25 jK File Added: output.svg
2011-07-11 23:26 jK Note Added: 0006998
2011-07-11 23:28 jK File Added: profile.png
2011-07-11 23:29 jK Note Edited: 0006998
2011-07-13 20:07 rubrick Note Added: 0007015
2011-07-14 07:24 rubrick Note Edited: 0007015
2011-07-17 14:10 rubrick Note Added: 0007050
2011-07-18 20:49 zerver Note Added: 0007054
2011-07-18 20:50 zerver Status feedback => closed
2011-07-18 20:50 zerver Resolution open => fixed
2011-07-18 20:50 zerver Fixed in Version => 0.82.7+git