Iphone slow FPS and problem with vectors

Previous topic - Next topic

kaotiklabs

Hi,

I?m just trying some little demos on landscape mode on the iphone and I?m having very bad fps.

I?m just testing some on screen touch controls ideas using rotosprite for showing one moving 32x32 png.
The frame rate is stacked at 17fps without moving the object. Why is so slow??
I?ve tried also with smoothshading on and off, without any fps changes.

Another problem, not related, I?m implementing control movements calculating a vector inside a touchable area (the big circle area), I cannot get the vector from center of the big circle to the touched region inside the circle. This is working on Windows but is not working on Iphone.
Maybe the landscape mode is not working properly?

I?m attaching the project,  in case anyone could help me will be apreciated.



[attachment deleted by admin]
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Hemlos

Try getting rid of all those GETMOUSECOUNT in your loops...

capture this as a variable instead.

nummouse%=getmousecount()
Bing ChatGpt is pretty smart :O

kaotiklabs

Great, I will change this.
But what do you believe about performance?
This change won?t give me 20 fps more and I?m just moving one sprite...

where?s the problem with the performance??
Anyone has a good frame rate in landscape mode on the iphone? any tips?
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

MrTAToad

I suspect drawing the circle is the cause - comment it out for a while and see.  If it is, I would suggest using a sprite for that.

Hemlos

Quote from: MrTAToad on 2009-Sep-08
I suspect drawing the circle is the cause - comment it out for a while and see.  If it is, I would suggest using a sprite for that.

Either an image, or reduce the angle itterations and divide it up into your sin and cos.

youre looping alot with the statement:
FOR j=1 TO 360

reduce this to 16 sides or even 12 sides might still look ok.

Printing alot of text might also reduce performance.
Polyvectors are much faster than SETPIXEL, DRAWSPRITE, ROTOSPRITE, PRINT, and DRAWLINE.


Also..you might be calling MOUSESTATE too many times, these are only needed once in the main loop.
Furthermore, SETACTIVEMOUSE should only be needed once per run, and not looped.


Bing ChatGpt is pretty smart :O

kaotiklabs

Thanks guys,
with your changes the performance has boosted  =D

Quote from: MrTAToad on 2009-Sep-08
I suspect drawing the circle is the cause - comment it out for a while and see.  If it is, I would suggest using a sprite for that.

I got now the expected frame rate (nearly 60fps) The DrawCircle function was the botleneck.


Quote from: Hemlos on 2009-Sep-08
Also..you might be calling MOUSESTATE too many times, these are only needed once in the main loop.

I undestand MOUSESTATE should only call once in the main loop (but is correct to loop trought the entire Mouse matrix) correct me if I?m wrong.

Quote from: Hemlos on 2009-Sep-08
Furthermore, SETACTIVEMOUSE should only be needed once per run, and not looped.

I?m not getting this.
If I have several on screen buttons, they could be pressed at the same time.
So, is not correct to store each iteration all the different mouses positions like this way?
How should I assign the mouses values?

Code (glbasic) Select

//=============================================================================
SUB MouseHANDLER:
//=============================================================================
FOR imouse% = 0 TO nummouse%-1
SETACTIVEMOUSE imouse%
MOUSESTATE mx%, my%, b1%, b2%
Mouse[imouse].x=mx
Mouse[imouse].y=my
Mouse[imouse].active=b1
NEXT
ENDSUB
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Hemlos

im sorry i didnt realize iphone has more than one mouse.
Bing ChatGpt is pretty smart :O

kaotiklabs

hehe don?t worry mate.
Thought I was loosing something.

Your help is always apreciated.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Sokurah

Could you post the project with the changes that solved the problem?
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

kaotiklabs


Indeed, I didn?t fixed the problem.
I was using a cpu waster circle function and I simply replaced it for some circled sprites.
I know the circle algorithm could be fixed easily using math aproximations but Im too lazy for just a demo.
With the sprites I bypassed the buggy function.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Hemlos

Quote from: Sokurah on 2009-Sep-11
Could you post the project with the changes that solved the problem?

I posted in MATH section of this forum, a thread with algorithms concerning circular math.
In this section you should find a thread with SIN COS, and CLOCK.
There you will find functions that produce circlular discus polyvectors, including a ring style as well.
If these arent working to your needs, i(and other team members) can possibly rewrite them or send you in the right directions to achieving your goals.
Bing ChatGpt is pretty smart :O

Kitty Hello

also in Samples/Common open the QMATH.gbas and use QSIN/QCOS.