Muzzle flash question

Blitz3D Forums/Blitz3D Programming/Muzzle flash question

cash(Posted 2009) [#1]
I have a FPS I am working on and use a sprite to generate the muzzle flash. Problem is that when I use it with a machine gun.....a lot of recurring "flashes" the game seriously slows down.

Any tips on doing this type of thing efficiently....


_Skully(Posted 2009) [#2]
Are you sure its the flashes and not the multiple projectiles slowing it down? What happens when you disable the muzzle flash code? It just seems strange that hiding and showing a sprite would slow things down (on its own)


cash(Posted 2009) [#3]
I dont have any projectiles yet...just a hud and a flash..also sprites generated at the "hit" point....all works fine until I re-enable the muzzle sprite. i am wondering if it is working but created at the wrong point in the code thus slowing everything down....


RifRaf(Posted 2009) [#4]
Some thoughts,

You can parent the muzzle flash to the gun, and show/hide it , instead of recreating it each time (if thats what you are doing), reduce the texture size if its large, how fast does the gun fire ? are you linepicking every single shot ? If it's a machine gun firing every logic loop then you may just linepick every x milliseconds and average the location between them to reduce the linepick load.


cash(Posted 2009) [#5]
well the problem is specific to Windows 7. I made the sprite visible always rather than flashing... In XP it works fine.
Narrowing it down, Windows 7 actually causes a crash and the display driver (latest NVidia driver) fails and comes up with a recovery error...


cash(Posted 2009) [#6]
okay sorted this now, Windows 7 didnt like the entityorder parameter assigned to the muzzle sprite.

The gun has an order ensuring it is always infront of objects.
I also assigned an order to ensure the sprite for the muzzleflash was infront of the gun.

Removed the order on the muzzle sprite and problems solved.

Definately wasnt an issue with XP though.