Hey,
I just encountered unusual frame drops in a game I'm currently developing.
I thought I messed up with the particles, but it turned out it were the texts I created.
There are 35 levels in the game, and each level contains a pretty long text ( between 500 and 3000 characters ).
All texts are hidden @ -999, -999.
The FPS dropped sometimes from 60 to 30 on a Galaxy S4. Both with Studio and Classic.
First thing I did was change the text visibility to 0, which boosted the FPS back to around 60.
So I wrote a little code to check the impact of texts, which really surprised me: ( Tested on Win10 64bit GTX 970 )
SetErrorMode ( 0 )
SetWindowSize ( 1024, 768, 0 )
SetVirtualResolution ( 1024, 768 )
SetSyncRate ( 0, 1 )
dim text[500] as integer
for i=1 to 500
text[i] = CreateText ( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" )
SetTextPosition ( text[i], -999, -999 )
SetTextVisible ( text[i], 0 )
next i
do
if GetRawKeyReleased ( 32 )
visible = 1 - visible
for i=1 to 500
SetTextVisible ( text[i], visible )
next i
endif
Print ( ScreenFPS() )
print ( "SPACE to toggle text visibility: " + str ( visible ) )
Sync()
loop
This code creates 500 texts with 200 characters each, and puts them @-999, -999
I get around 125 FPS with visibility 1, and around 290 FPS with visibility 0
I get around 240 FPS with visibility 1, and around 410 FPS with visibility 0 when I use 100 "A"s instead of 200.
Isn't that pretty slow for texts? I mean, they are not even on the screen.
I can display 2000 space ships ON the screen, flying from bottom to top at different speeds, and still have 410FPS.
With just 500 texts, which are pretty small because of their tiny text size, and which are not EVEN on the screen, AND hidden with visibility set to 0, I get only 290?
Sure, I can do a workaround by just loading the texts on demand, but I still find it pretty strange that texts are so slow. Anyone have an explanation for this?
Thanks,
PSY