Fractal Softworks Forum

Starsector => Bug Reports & Support => Topic started by: Gothars on November 26, 2015, 12:26:27 PM

Title: Micro stutters in campaign
Post by: Gothars on November 26, 2015, 12:26:27 PM
Uh, this is gonna be a pretty fuzzy report, but I though I'd make in case something similar comes up.

After having the game run for some time in background and tabbing out repeatedly, there are more and more stutters during flight. They happen about every 1.5 to 4 seconds (variable) and might be related to sensor contacts happening, i.e. I've seen them happening synchronous with a "sensor ring edge" appearing. But not always. The frame rate stayed at a constant 60 during this. Restarting the game fixed it.
Title: Re: Micro stutters in campaign
Post by: Alex on November 26, 2015, 12:38:11 PM
Thanks - I'll keep an eye out. Might be one of those things that going back to Java 7 will fix, too. 8 has been nothing but trouble, and since it's only required for OS X, I'll most likely leave it there and revert back for Windows/Linux.
Title: Re: Micro stutters in campaign
Post by: Cyan Leader on November 26, 2015, 03:45:00 PM
I've been getting these too, I feel it is related to when I'm flying with time compression on and going through obstacles.
Title: Re: Micro stutters in campaign
Post by: Alex on November 26, 2015, 08:09:31 PM
Another possibility here is that tabbing out for a long time moved the game from RAM to swap space, which might cause this type of behavior. It could also be caused by editing vmparams to allocate too much memory for the game.

(I've seen similar things with other games, too, especially after a long tab-out. Not sure it's something that anything can be done about in that case, it being an OS thing.)
Title: Re: Micro stutters in campaign
Post by: Baqar79 on November 26, 2015, 08:53:09 PM
I have had a similar issue, but I don't know if it is the same problem as Gothar.

It does have similar symptoms, a stutter about every 3 seconds.  I have two computers (one running older hardware), that this is more pronounced on, but it does happen on my main PC as well.  It may have something to do with how busy the system is, or how far through the campaign is, since it seems to be better on starting a new game.

It also might be because of the alt-tabbing that i'm seeing this on my main PC, but the stutter is there on the older machine regardless. 

Just to clarify..the framerate on the older machine is 60FPS, but every 3 secs it seems to pause for a fraction of a second and the FPS counter drops then returns to normal.
Title: Re: Micro stutters in campaign
Post by: Alex on November 26, 2015, 09:03:56 PM
Just to clarify..the framerate on the older machine is 60FPS, but every 3 secs it seems to pause for a fraction of a second and the FPS counter drops then returns to normal.

Does it get better after an application restart, or is it persistent for that save? If it's the latter, it might be that some calculation it does later on in the campaign, periodically, is causing this. If so: I'd love to borrow the save to take a look.
Title: Re: Micro stutters in campaign
Post by: Baqar79 on November 26, 2015, 10:06:05 PM
Hmm, no it doesn't get better with an application restart.  To be honest this is happening quite a bit on my main PC, an unfortunate consequence of releasing an extremely enjoyable alpha is that you ignore these things, because you are too busy playing. :)

Transferring the save to the older machine and it also has the same problem.  The stutter isn't happening exactly every 3 seconds, it does vary a bit (sometimes every second, sometimes a bit longer); I certainly notice it more when I'm accelerating time, but it still happens if I don't do this.

I started a new game and now that i'm looking for it, I noticed it there as well, but it is a lot less frequent (basically unnoticeable if you don't accelerate time). 

If you think you might need the save, is it ok to email it (I don't have a dropbox or similar)?
Title: Re: Micro stutters in campaign
Post by: Alex on November 26, 2015, 10:11:42 PM
Yeah, if you can email me the save, that'd be great.

fractalsoftworks [at] gmail [dot] com

Thank you!
Title: Re: Micro stutters in campaign
Post by: Kzanu on November 27, 2015, 04:00:50 AM
I'm also having this issue after about 30 hours of gameplay, though I can 100% confirm that at the start of the game, it was frame capped at 60 all the time, no stutter. I can confirm I alt+tabb-ed a lot during these 30 or so hours.  Also I'm having huge space battles with no drop in framerate (old PC but works fine).

@Alex If you need another set of saves just mention and I will send them.
Title: Re: Micro stutters in campaign
Post by: Alex on November 27, 2015, 01:56:32 PM
@Kzanu: thank you for offering - much appreciated, but looks like it won't be necessary.

Managed to reproduce this and eventually narrowed it down to market procurement mission creation, of all things.

Turns out it was creating new people, and if a mission wasn't accepted, it was still keeping them around forever, so the list of people grew and grew. Then when creating new missions, it'd look through the list (which, in Baqar's save, had grown to 2400+ people) trying to find a matching person to use. Which wouldn't be that bad by itself (2400 isn't too long of a list to iterate over), but it was also running in quadratic time for... reasons. It'd try to create new missions/prune existing ones every couple of seconds, which is where the stutter would happen.

So, anyway, long story short: this is all fixed. Thank you all for your help! Took a while to track down, but would've been way more time-consuming without a save.
Title: Re: Micro stutters in campaign
Post by: Gothars on November 27, 2015, 02:43:22 PM
Well, that report was worth it, after all :)  ... now I have to resist the impulse to put this post in parenthesis...
Title: Re: Micro stutters in campaign
Post by: Alex on November 27, 2015, 02:45:57 PM
(Oh no!) ((OH NO!!!))

... ok I'll stop.
Title: Re: Micro stutters in campaign
Post by: SCC on November 27, 2015, 02:56:36 PM
I don't get why wouldn't you have the right to get sneaky beaky like sometimes. That's nothing wrong, after all, and I bet everybody want cool admin/game-developer! Just don't go overboard with it ;)
Title: Re: Micro stutters in campaign
Post by: Baqar79 on November 27, 2015, 05:05:49 PM
Woohoo..Ahem.

I actually expected you to turn around and say 'Sorry no, I don't see the problem'.  It's great to have been a little bit helpful, though many here would of been more than happy to do the same.  Also glad it wasn't just my machines.  I swear every time I purchase new PC parts (I build all my own), it doesn't quite work as well as other peoples, despite my endless tweaking and configuring.

Hmm..I tried to figure out where those people are.  Is that the MPM_mission_contact entries I see in campaign.xml? I see 2410 entries in the save I sent you, but it has now grown to 2611 entries now  ;D

What happens if I delete them..lets see...

(http://i.imgur.com/yPDF3VF.png)

Pretty much what was to be expected - when you have no clue what you are doing (which is another reason I should be catching up on my compsci homework!)  :D
Title: Re: Micro stutters in campaign
Post by: Alex on November 27, 2015, 05:19:03 PM
Hmm..I tried to figure out where those people are.  Is that the MPM_mission_contact entries I see in campaign.xml? I see 2410 entries in the save I sent you, but it has now grown to 2611 entries now  ;D

Yep, that's them. Removing them might not be possible (well, not without an unreasonable effort) since they're likely referenced from several places. So if you remove them from the spot they're in, references to them elsewhere in the savefile may still exist.

Pretty much what was to be expected - when you have no clue what you are doing (which is another reason I should be catching up on my compsci homework!)  :D

Have fun with that :)
Title: Re: Micro stutters in campaign
Post by: Beobachter on November 27, 2015, 07:12:34 PM
I think I may be suffering the same problem.
At first I thought it was fleet related. However with further information I now know that this is unlikely.

I notice I get a slowdown every time the time ticks over to a new day in addition to other more random moments.
Title: Re: Micro stutters in campaign
Post by: Alex on November 27, 2015, 07:39:09 PM
It's probably just entirely random, fairly certain there's nothing in the entire game that cares when time ticks over to a new day. But yeah, sounds like it's the same problem.
Title: Re: Micro stutters in campaign
Post by: Abradolf Lincler on November 28, 2015, 09:08:29 PM
Looks like I'm gettin em nown too. :-\
Title: Re: Micro stutters in campaign
Post by: Abradolf Lincler on November 29, 2015, 07:33:51 PM
I am now getting it pretty bad now, no matter what.
Title: Re: Micro stutters in campaign
Post by: Alex on November 29, 2015, 07:49:57 PM
Locking because this is resolved for 0.7.1a and there's no workaround for 0.7a.