I search optimisations... what the best things to do to keep fps in a 2D shoot them up game.. if anyone as some tricks or rules to get a good framerate everywhere...
I've replace some goto's with break command ( new in 3.80 ) and i've win 4-6 fps...
my game is in 800x600, and i want to keep a good framerate on some machines.
I use a lot of sprite3D.. is there some optimisations to it..?
Pol.
Intel Core2Duo 6600 - 3Gb DDR2 - Geforce8800Gts - Vista Home Premium 32bits
I've forgot that my game turn perfectly on my PIV 2Ghz with GF4Ti but with a 1,5 and GF4 MX, ( on 32bits mode, and all graphics options selected ) at few moments ( when it was a LOT of sprites on screen ), the framerate slow down at 48/50 fps and restart to 60 after...
Pol.
Intel Core2Duo 6600 - 3Gb DDR2 - Geforce8800Gts - Vista Home Premium 32bits
Johan_Haegg wrote:Sprite3DQuality() can be used, but its ugly...
its hard to optimize a code if you cant look at it.
Actual videocards have no speed difference with quality ON or OFF, some even are optimized for quality ON! (tested on a OpenGL 3D engine I made 2 years ago...)
The best optimization isn't on the graphic side (3D sprites are simply too fast!), but how you manage collisions, animation events and all those nice stuff a game requires...
Thanx! How to manage with the good way collisions for example?..
in my game, i made ( for example ):
dim enemix.w(10)
dim enemiy.w(10)
global playerx.w,playery.w
...shortcut...
for i=1 to 10
if spritepixelcollision(1,playerx,playery,2,enemix(i),enemiy(i)=1
kaboum!
endif
next i
it's a good way?
Pol.
Intel Core2Duo 6600 - 3Gb DDR2 - Geforce8800Gts - Vista Home Premium 32bits
I would use linked list for ennemy colision, because once an enemy is destroyed, it's removed from the list and the remaining checks are lower to do. Would influence on heavy loaded screen tough, for 10 ennemies, it won't hurt at all.
If you are testing for many sprite collisions then you might speed things up a bit by only using the slower spritepixelcollision if spritecollision is true:
chris_b: SpritePixelCollision() of course check the bounding box before doing pixel perfect collision so checking SpriteCollision() is useless. I will add this to the doc, thanks for the remark.
polux: Look in the Waponez II example. Basically, you have a linked list with all the displayed sprites and when you kill one, you do a 'DeleteElement()'. When you want to display all remaining sprites, you use ForEach..
lethalpolux wrote:OOOUps! sorry... i've not understand... ( me and my poor english )
Now, from such a stupid looking ogre (orc, or what the h...) like you I didn't expect much more. It's you shown in the image to the left, isn't it?
Just to be sure:
Fred wrote:SpritePixelCollision() of course check the bounding box before doing pixel perfect collision so checking SpriteCollision() is useless. I will add this to the doc, thanks for the remark.
Thanks for pointing this out. I guess I should have tested my theory before posting it