Scene Draw Text Performance

noxtudios

  • Posts: 293
I was having some performance issues running on android, and after testing 10's of different scenarios I have found out what is causing my FPS drops.

All Scenes 1-10 No Draw text I get 60 FPS on every scene - Perfect performance on Android

Draw text enabled (Scene), (all it does it draw a scene number etc top left, and scene score top right. It doesn't do any calculations on positioning, all X and Y values are preset)

I get 40-60 with draw text.

Moving scene 40-45, not moving 56-60

It seems to me that I would be better off changing this text to Anchored actors for a massive performance gain.. which makes no sense.. Its only text..

I'm guessing the performance drop is caused by the text being kept in position relative to the screen / scene.. Constantly calculating the X Y values relative to the camera position in the scene

Anchored actors seem to behave far better performance wise than Scene text drawing for a HUD

I have a bunch of anchored actors already on the screen  (7 of them, and they run fine at 60FPS with fast moving scenes) as soon as a bit of text is added, bam, 40 fps on a moving scene

Has anyone else encountered this before?
I think i'll go with Anchored Actors, and update the text in the actor, this should in theory work better as the text is positioned on screen in the actor, and not relative to the screen / scene.


noxtudios

  • Posts: 293
This is on scenes using 16x16 tiles and 80-140 tiles wide. So not massive.

I have just created actors in place of the previous scene text and can confirm that the performance is back to 55-60 fps on a moving scene

Full Scene text display certainly slows down the frame rates, and I advise using individual Actors in place of full scene HUD text and update the actor Text as needed.

Not sure if this is a bug, or just the way Full scene text is rendered, but this is here for anyone that has a similar issue with performance.

rob1221

  • *
  • Posts: 9424
Drawing is just slower on mobile since it's based on less optimal Flash rendering methods.

noxtudios

  • Posts: 293
Thanks, but it seems to me that i'm drawing the same amount of text, its just that scene text performance is such a high percentage slower than actor text. That maybe due to the rendering methods as you say.

Its just so noticable, 20-30% slower with just a few characters of text that i wonder if its the way stencyl draws the text on a scene compared to an actor.
As in scene text seems to me to draw a completely new layer of text, across the whole screen (even though just a few characters), thus slowing down when the scene moves, trying to re position it to the screen coordinates.

An actor draw text only has a small area to render (actor size) compared to the scene size of the screen width and height.

Anyway, im just glad i have resolved the issue, and hopefully this post will help others if they stumble on a similar issue..

Ta

rob1221

  • *
  • Posts: 9424
Scene drawing is done on the HUD layer, which is above all the layers you add to your scene.  Actor drawing is done on the same layer of the actor.

noxtudios

  • Posts: 293
Thanks, then that explains the difference in performance thanks!! as it adds an extra layer to the scene..