The Daily Click ::. Forums ::. Klik Coding Help ::. Unusual framerate-drop problem
 

Post Reply  Post Oekaki 
 

Posted By Message

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
21st August, 2012 at 21/08/2012 22:27:26 -

Hey, I've had a really weird issue crop up in my game today and I wondered if anyone had any ideas. This affects the regular MMF runtime rather than the Flash one, so it's probably not an urgent problem (it's a Flash game, and experience tells me the different runtimes are more likely to have their own unique problems rather than the same ones). It means I can't really test stuff through MMF, though.

The game grabs all the level data from a string. I use the string tokeniser object. Once a level has been populated at the start of the frame, I don't check the strings at all - nothing is grabbed from the leveldata string at runtime.

Anyway, I added signposts today. Adding them to the level editor was really business as usual. Their tokens are just something like "SXXThis is a signpost!;". The signpost messages are probably 100 characters long on average, no more than 180, often much less.

Now I've found that levels with several signposts in them are hit by a framerate drop from 30fps to around 10fps, but only while scrolling. I figured I was doing something wrong with the actual signpost objects, but I stripped them out entirely and the problem persists - the presence of the extra text in the level string is enough to cause it. Which is so strange, because these strings are destroyed after the first frame.

Now that I've written this out it really is embarrassingly weird, but unless I've missed something blindingly obvious the problem really is as above - ... No-one?

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
22nd August, 2012 at 22/08/2012 01:02:12 -

So removing the extra text is enough to bump the frame rate back up?

How are you storing the strings? In a hidden string object?

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
22nd August, 2012 at 22/08/2012 04:58:30 -

String objects will eat your framerate because the anti-aliasing has to be redrawn every time the frame moves. This even happens if your string object is off screen, which is stupid.

All you need to do is set the string to hidden, by un-checking "visible at start".

It definitely shouldn't still be happening if you have destroyed the object. Upload your mfa and I'll take a look at it.

 
n/a

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
22nd August, 2012 at 22/08/2012 12:04:45 -

There's a single hidden string object that contains the level data for the entire game. That's quite a lot of data, but MMF has dealt with it really well so far.

The framerate drop is caused purely by the extra text in the string, rather than by any events that actually deal with that data. It's confined to the levels that have signposts. There's also definitely a correspondence between the number of signposts/amount of extra text and how badly the framerate is hit.

Again, yeah, none of this stuff is dealt with after the level is generated at the beginning of the frame - and there's no noticeable effect on the time it takes to load a level. And the slowdown is only while scrolling.

Here's a snippet of leveldata with a signpost. It's significantly longer than most other tokens, but in the grand scheme of things, it's really only a small percentage of the amount of characters that make up the level as a whole:

(B0106; )(B0711;S28Welcome to the caves!/The white specks on your map are doors to other chambers./For a full area map, press "M".; )(B0107; )(B0810; )(B0106; )

Chris: source is a little too big and messy to upload at this point, but I might try replicating the problem sometime!

Thanks for your replies guys. It's not hugely important unless it starts affecting the Flash runtime too, but obviously I'd like to know what I'm doing wrong.

Edited by Duncan

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  50102

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
22nd August, 2012 at 22/08/2012 17:44:43 -

It could be something else, but it's difficult to know without giving us more information about the engine.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click