Sunday 30 August 2009

Optimized text rendering READY!

Till recently I always were a bit uncertain how the previous 2D text rendering might work out on the long run. On screens with dense windows the FPS counter dropped down a bit too much for my taste. There are two different text rendering ways used in the game - one was used for the bottom log, the other for all the UI. The true type font renderer was used for all the UI elements - that renderer was creating a separate quad for each letters in a text. The monospace (bitmap based) text renderer was much nicer and more performant -- but it's working with its own font bitmap format only!

I looked at it and found that if I was able to create my own bitmap out of the current UI ttf font (Vinque), I could replace the slower method and use the low poly version instead. So two things followed by a big refactoring of the UI elements changed the whole UI into a faster performing sweetness. :D

First, I overrode the jME Text class (shape responsible for 2D texts) and thus overrode the default font bitmap path too. Second, I used FontForge to tweak the ttf font into a monospace font set exported into a new ttf set and using 'convert' of ImageMagick converted it into a bitmap. A little tweak with GIMP and voila, there goes the Vinque font and TextureState based font rendering of jME tuned for jClassicRPG. :) After that, a tideous process of reviewing all the UI element and window codes came. But it was worthy! On my Intel gfx card it can even double the FPS on the character creation screens! Saving a lot of polys and also scene graph elements, that's quite understandable. :)

5 comments:

qubodup said...

testing..

first bug: when I'm in the "load game" menu and click the "backarrow" button, the cursor will be above "new game" but it will not highlight (it will react on click though) :)

qubodup said...

second bug: when the drag-down-select-hero thing contains only two heroes, the "go up" or "go down" cursor will appear when hovering char names (the last one shouldn't appear at all since we're on the last page) but clicking the names will still select them (not always though it seems).

qubodup said...

about the second bug: I'm not sure about it any more, it seems rather confusing - it seems the area where the cursor becomes an arrow is wider than the indicator (on the right)

Also, there are only black arrows down, but not up if it's possible to go up.

pzi said...

Thanks Qubodup. I'll try to make it easier to understand how dropdown list works based on your comments. :)

pzi said...

fixes are in SVN. :)

Twitter