Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: FPS drops with text  (Read 9843 times)

0 Members and 1 Guest are viewing this topic.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
FPS drops with text
« on: July 10, 2011, 10:36:08 AM »

Hello.

I have the following problem. I have lots of scenes where I use the dialogue logic (getting responses and such). The best illustration will be the two following images:



This is the desired window and it runs at 87 fps. You will probably agree it's not much of a text in here. Also the poly count is 262.



This is the window where I erased the top text. There's absolutely nothing else different. Everything is identical, just the upper part of the window has no text. There are no script transformation functions which would be handling the upper text, it's plainly setting the static control's text to a string.

Like this it runs at 652 frames.

This is constant behavior of WME for the whole JULIA, however for certain more complex scenes the drop is too painful. Also the fps is stable. Which means in this scene it always runs at 87 or 652 respectively (given 3 frames delta).

Any clue what should be done? Or do you need more info about it?

Thanks a lot!!!
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: FPS drops with text
« Reply #1 on: July 10, 2011, 11:22:44 AM »

Also in case you are wondering about the font used, this is the definition file:


TTFONT
{

  SIZE = 12 
  FACE = "Tahoma"


  BOLD = TRUE
  ITALIC = FALSE
  UNDERLINE = FALSE
  STRIKE = FALSE

  CHARSET = 1

  COLOR { 255, 255, 255 }
  ALPHA = 255
 
 
  LAYER
  {
    OFFSET_X = 0
    OFFSET_Y = 0
    COLOR { 0, 0, 0 }
    ALPHA = 100
  }

  LAYER
  {
    OFFSET_X = 1
    OFFSET_Y = 1
    COLOR { 255, 255, 255 }
    ALPHA = 255
  }

}
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: FPS drops with text
« Reply #2 on: July 10, 2011, 11:52:43 AM »

Rendering the text to texture is relatively slow. That's why WME keeps cache of several previously rendered texts for each truetype font. The cache size is set to 30. So if there are more than 30 text elements simultaneously on screen (static controls, buttons etc.) using the same font, it will cause cache thrashing and reduced performance. Same thing will happen if some text is changing frequently (frequently, as in each frame, such as the timer display).

Other than that, no idea. Neither of these appear to be your case, but maybe there are some more static controls we can't see on the screenshots?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: FPS drops with text
« Reply #3 on: July 10, 2011, 12:36:08 PM »

There are cca. 5 statics on the screen. There are some windows in the memory, but not 30. I tried to run the game without debug mode. Game runs in 3000 fps (windowed). As soon as the text appears, it drops to 80.

On slower machines it sometimes drops to 7. :(

Just out of the curiosity, how difficult would be to raise the cache to let's say 150 items? This could prove the point.

Is it just the matter of setting  #define NUM_CACHED_TEXTS 30 in BFontTT.h?
« Last Edit: July 10, 2011, 01:59:56 PM by metamorphium »
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: FPS drops with text
« Reply #4 on: July 10, 2011, 02:40:49 PM »

Is it just the matter of setting  #define NUM_CACHED_TEXTS 30 in BFontTT.h?
Yes.
Well, you gotta finish the beta so that I can get my hands on it :) I can't think of any other reason why text should kill performance.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: FPS drops with text
« Reply #5 on: July 20, 2011, 08:05:40 PM »

Hi!

Problem with decreacing of fps is really annoing, but no so critical I think. Texts can be changed to images with texts - and "localized" images, if the game needs to be localized to other languages.
Do you got performance increasing after changing of NUM_CACHED_TEXTS?

There are cca. 5 statics on the screen. There are some windows in the memory, but not 30. I tried to run the game without debug mode. Game runs in 3000 fps (windowed). As soon as the text appears, it drops to 80.

On slower machines it sometimes drops to 7. :(

Just out of the curiosity, how difficult would be to raise the cache to let's say 150 items? This could prove the point.

Is it just the matter of setting  #define NUM_CACHED_TEXTS 30 in BFontTT.h?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: FPS drops with text
« Reply #6 on: July 21, 2011, 08:27:38 AM »

We tracked down the problem. It was indeed a font cache problem, because WME doesn't behave as it should. However, it was a rather specific case so it shouldn't affect most games.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.019 seconds with 23 queries.