How I've just fooled myself
-
I've got a teaching story here, so you can all laugh with me (or at me) and not repeat my mistake.
So.. I've got myself thinking "I wonder how many objects can FUZE's 3D-engine handle before it starts dropping FPS?" So I've made a simple program which spawned random 3D-primitives at random spots and started rotating them (also randomly).. And I was pretty dissapointed since when it was even only about 20 objects on-screen the FPS already dropped down to a miserable 5 and when I added even more objects - it slowed down to the point it was hard to make it stop the program and return to code editor. But I thought "Well, it's a basic interpreter after all, what did you expect?" But then I thought "Wait a minute! That 3D-shooter game sometimes has even much more objects on a screen and still runs smoothly! How come?!"
Well... as it turned-out I've placed the drawObjects() function inside the for-loop in which the rotateObject() function was called for every object at a time. So it was called EACH iteration of that cicle. When I realised that and moved it out of the for-loop - it immediately became a stable 60FPS :)
And BTW, if you also wonder, it drops only to the 25FPS when there's a whopping 3500 objects rotating on a screen at once. Oh, and also I think this number of 3500 is hard-coded because when I try to make it even 3501 - the FUZE says it's "out of memory" while the info when there's 3500 objects clearly says it had 1600+Mb free :) -
Easily done! Glad to hear you figured it out though - 5fps with only 20 objects would have been rather embarassing.. 😅
-
@dave Yeah, that's exactly what made me look further :)