GLBasic forum

Main forum => GLBasic - en => Topic started by: mentalthink on 2010-Oct-15

Title: HI, about Win CE and better performance
Post by: mentalthink on 2010-Oct-15
Hi I stay making comparations between Gp2X wiz and my winCe mobile, and in wince, runs too much slower than wiz.
Any coincil for pull up the performance on WINCE, I read use polyvector is much better than drawsprite, my background are 2 images about 1200x240 pixels and 7 images about 480x240, ok don´t slow too much, about 48 FPS, but in WIZ run too much faster, and I think Wiz is minus powerful than my phone.

I try to put LIMIT fps -1, but I have the same result.

Thanks, for your reply and time.

Best regards,
Iván J.
Title: Re: HI, about Win CE and better performance
Post by: backslider on 2010-Oct-15
Hi mentalthink,

Polyvector is much slower than drawsprite on my iPhone (first gen)... I don´t know the performance on winCE phones.
Title: Re: HI, about Win CE and better performance
Post by: mentalthink on 2010-Oct-15
HI Backslider, thanks for your reply.

uhmm...  this you said me about polyvector confuseme, becuase I read in some threads what polyvector is much faster than drawsprite, perhaps is because is 1st Generation iPhone, but I don´t be sure about this.

Thanks, again for you reply.

Best regards,
Iván J.
Title: Re: HI, about Win CE and better performance
Post by: Kitty Hello on 2010-Oct-18
WinCE uses the software rasterizer from the Wiz. However, the Wiz is usually a muc hmore powerfull device than the CE based ones.
Title: Re: HI, about Win CE and better performance
Post by: mentalthink on 2010-Oct-18
Thanks Kitty, but the difference is bigger, so , in WIZ the game is about 130 FPS whit Limitfpt command put to -1, but in winCE only arrives to 60FPS, equal than windows, but in some parts of the game this speed down too much.

Whit Polyvector, I don´t boost the performance on winCE?¿, so I read in some trehads than Polyvector y much faster than drawsprite, I only read about iPhone, but I´m not sure if this works fine on WINCE.

Kind Regards,
Ivan J.


Title: Re: HI, about Win CE and better performance
Post by: Kitty Hello on 2010-Oct-18
polyvector packs are faster on iPhone - and only iPhone (and Pandora - any OpenGL|ES device)
Title: Re: HI, about Win CE and better performance
Post by: ampos on 2010-Oct-18
Quote from: Kitty Hello on 2010-Oct-18
polyvector packs are faster on iPhone - and only iPhone (and Pandora - any OpenGL|ES device)

In my app I see no performance difference between moving around 300 sprites (5x5 pixels) using drawsprite or polyvector.
Title: Re: HI, about Win CE and better performance
Post by: Kitty Hello on 2010-Oct-19
what device? 3GS or iphone 4?
I noticed that my iphone 4 is much faster than my 3G, but !!! with DDgui it was partially slower!
(I already tweaked DDgui to be a tad faster for the future, using the new PRINT commands e.g. and use the DRAWRECT function for the fillings. (As it is the default).
Title: Re: HI, about Win CE and better performance
Post by: ampos on 2010-Oct-19
I have at home 3G, 3GS and 4.

4 can move at 60fps, 3GS drops to 40-50, and 3G falls miresably to 10-30. I have changed from drawsprite to plyvector and saw no difference, at least in 3G.

Will post later my code, to see where it can be improved, as in 3G it is real slow.
Title: Re: HI, about Win CE and better performance
Post by: Kitty Hello on 2010-Oct-19
Did you use polyvector with "one" call to STARTPOLY?
Title: Re: HI, about Win CE and better performance
Post by: ampos on 2010-Oct-19
Ni, one startpoly...poly...endpoly per sprite...
Title: Re: HI, about Win CE and better performance
Post by: Kitty Hello on 2010-Oct-20
then it's the same as drawsprite, thus slow.

you must go:

startpoly texture, 2

foreach spritething
   polyvector
   polyvector
   polyvector
   polyvector
   polynewstrip
next
endpoly
Title: Re: HI, about Win CE and better performance
Post by: ampos on 2010-Oct-20
I will try, thanks. Will post results later.
Title: Re: HI, about Win CE and better performance
Post by: ampos on 2010-Oct-20
I have made a little program to test 3G performance...

I have to ways of painting snow (5x5 pixels, in a 5x60 anim)

Code (glbasic) Select
IF dmode=0
STARTPOLY 1,2
FOR n = 0 TO BOUNDS(puntos[],0)-1
POLYVECTOR puntos[n].x,puntos[n].y,puntos[n].frame*5,puntos[n].color*5,RGB(255,255,255)
POLYVECTOR puntos[n].x,puntos[n].y+5,puntos[n].frame*5,(puntos[n].color*5)+5,RGB(255,255,255)
POLYVECTOR puntos[n].x+5,puntos[n].y+5,(puntos[n].frame*5)+5,(puntos[n].color*5)+5,RGB(255,255,255)
POLYVECTOR puntos[n].x+5,puntos[n].y,(puntos[n].frame*5)+5,puntos[n].color*5,RGB(255,255,255)
POLYNEWSTRIP
NEXT
ENDPOLY
ENDIF
IF dmode=1
FOR n = 0 TO BOUNDS(puntos[],0)-1
DRAWANIM 1,(puntos[n].color*5)+puntos[n].frame,puntos[n].x,puntos[n].y
NEXT
ENDIF


With 180 sprites, the polyvector mode is at 31 fps, and the drawsprite mode, at 50.

Also, the polyvector mode deformate my sprites. Note that my previous polymode did not deformate them:

Code (glbasic) Select
FOR n = 0 TO BOUNDS(puntos[],0)-1
STARTPOLY 1,0
POLYVECTOR puntos[n].x,puntos[n].y,puntos[n].frame*5,puntos[n].color*5,RGB(255,255,255)
POLYVECTOR puntos[n].x,puntos[n].y+5,puntos[n].frame*5,(puntos[n].color*5)+5,RGB(255,255,255)
POLYVECTOR puntos[n].x+5,puntos[n].y+5,(puntos[n].frame*5)+5,(puntos[n].color*5)+5,RGB(255,255,255)
POLYVECTOR puntos[n].x+5,puntos[n].y,(puntos[n].frame*5)+5,puntos[n].color*5,RGB(255,255,255)
ENDPOLY
NEXT
Title: Re: HI, about Win CE and better performance
Post by: ampos on 2010-Oct-20
Also I have noted that the framerates are not constant, varies between 20 and 50, with no sense.

Can it be this jerky related to constantly adding and removing elemtents to the sprite matrix? Will it be faster to define a matrix of... 300 elements, and just use it?
Title: Re: HI, about Win CE and better performance
Post by: Slydog on 2010-Oct-20
I think your poly deform is from your STARTPOLY mode.
In the deformed version (using one STARTPOLY command), you use Mode 2.
In the other, you use Mode 0.

In Mode 0 (FAN), your points will look like this:
2  1
3  4

In Mode 2 (STRIP), your points will look like this:
1  3
2  4

Since Mode 0 works, try changing your code to:  (I moved your 1st POLYVECTOR to the 3rd position)
Code (glbasic) Select
         FOR n = 0 TO BOUNDS(puntos[],0)-1
            POLYVECTOR puntos[n].x,puntos[n].y+5,puntos[n].frame*5,(puntos[n].color*5)+5,RGB(255,255,255)
            POLYVECTOR puntos[n].x+5,puntos[n].y+5,(puntos[n].frame*5)+5,(puntos[n].color*5)+5,RGB(255,255,255)
            POLYVECTOR puntos[n].x,puntos[n].y,puntos[n].frame*5,puntos[n].color*5,RGB(255,255,255)
            POLYVECTOR puntos[n].x+5,puntos[n].y,(puntos[n].frame*5)+5,puntos[n].color*5,RGB(255,255,255)
            POLYNEWSTRIP
         NEXT


Not that it will make much of a difference, but you could pre-calculate the white RGB into a local variable before the loop and use that in the POLYVECTOR command, saves calling RGB() four times per loop.

[Edit]
And changing your sprite matrix into a fixed size should speed up your code some, but I'm not sure how much.
How slow is C at reallocating memory and copying the data to the new location, if that's how it's done?
Title: Re: HI, about Win CE and better performance
Post by: Kitty Hello on 2010-Oct-21
When using large lists (enemies, particels) I usually go for static arrays and an couter variable.
That way I can remove an object by copying the last object at the position of the one to be deleted and DEC the counter.