ALPHAMODE: More speed in main loop? (FIXED!)

Previous topic - Next topic

Hark0

Hi!

I'm currently testing my app on iPad 1...

Due my excessive use of ALPHAMODE function my app needs from 1.2 to 6.5 ms to paint full screen (1024x768). I Get only 18 FPS on ipad.

Any idea for REPLACE alphamode with a trick on images (maybe gray?) or similar...


Thanks in advance!

;)
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

MrTAToad

Might be worth checking to see if you are using ALPHAMODE twice in succession with the same values (where only one would do).

Could also try batch processing with POLYVECTOR

Alternative do some code INLINE

bigsofty

One of the things to avoid, when using OpenGL and C is changing the various drawing states that OpenGL uses too often within your game loop. Its one of those situations that can hog the GPU. Maybe GLB is the same? Possibly try and structure your code so that alphamode is used at the start and end of a batch, as MR T. described?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Hark0

Thanks for the answers guys!!!

I try for optimize the code and the use of ALPHAMODE...

;)
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Hark0

Well, looks like I've done it!

Although I think I can get more FPS, now I have 45-60 FPS in almost all of the application, except in the game screen, which depente the amount of graphics that contains the map in question ... stays at 30 FPS.

The time display is currently painted in 0.5-1 ms to normal and falls to 3.5 ms for load screens with more graphic ...

Where was the problem?

- Looks like the iPad1, difficult run with the same speed as in computer graphics routines GLB DrawLine type, drawRect, etc. I replaced these functions DRAWSPRITE / DRAWANIM that work with acceptable speed.

- I precalculated positions before painting graphics mapping matrix. Earlier calculations performed in the loop maps painted, thus slowing the game speed. The difference can be very noticeable, I recommend testing in your loops if you have to calculate in real time the position of tiles, etc ... A change as simple as adding an addition in one loop can cause the render time a screen pass from 0.5 to 10 ms faster.

- For the map drawing routine, which is a fairly long loop due to the size of my map, I followed the advice of @ Hardyx ... with CREATESCREEN do a single calculation and then only I have to paint the sprite for the map ... I've been on this screen for 50 ms to 0.5 ms ...

...



You would be? With 30 FPS on screen "complicated" or would you try to win more?
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

MrTAToad

You are using LIMITFPS -1  aren't you ?

Hark0

Quote from: MrTAToad on 2012-Sep-21
You are using LIMITFPS -1  aren't you ?

FPS set in Options to 60.

In my tests, setting to -1 or 60000 are the same... maybe my problem are the excessive calculatons IN loop and use of graphic routines.
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

MrTAToad

If possible pre-calculate or go INLINE

Hark0

Quote from: MrTAToad on 2012-Sep-21
If possible pre-calculate or go INLINE

I try for first option, pre-calculate  ;)
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Hark0

Quote from: Ocean on 2012-Sep-21
in most any case, replacing drawrect with polyvector is the faster way.

Thanks  :)
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic