Sprite thrusters lag me!

Blitz3D Forums/Blitz3D Programming/Sprite thrusters lag me!

Ryudin(Posted 2008) [#1]
I'm working on creating a thruster system for my space game with sprites. So far, it looks very pretty and I can run the thing at a good 60 FPS with my ship and a bot or two. However, when I add another AI bot, lag occurs heavily. Is there something i'm doing wrong with my thruster system?



Sorry if the code is a bit messy. I originally have it in a function and I pulled the types out from earlier in the program so that you can see what each field is.


Ryudin(Posted 2008) [#2]
Alright I fixed it a bit (I was using cube waypoints so I could see where my bots were going) but it still lags with 6-7 bots on screen, still way too few for a good game.


Matty(Posted 2008) [#3]
All I can think of is that maybe you are creating too many sprites with alpha...more than your GPU can handle easily.


Nate the Great(Posted 2008) [#4]
If you are using blitz sprites, they are the problem... in version 1.99 for some reason, sprites are extremely slow... not sure why. Try re-installing 1.64 and not updating. It should go faster.


Stevie G(Posted 2008) [#5]
How many sprites are you actually creating for the thruster?

As people are saying sprites are slow - full stop. By winding back to v1.64 they may be faster but you'll loose other features which you'll probably need so not recommended. For a speed up :

1. Use a single surface system
2. Recycle your thruster particles rather than creating and deleting.

If you search for either term you should find plenty of threads and code on the subject.

Stevie


Jasu(Posted 2008) [#6]
Don't use sprites at all. Doesn't matter what version of Blitz you have, they're still slow. In Blitz, a single sprite takes one surface and it's just a waste of processing power.

Do a single surface particle system or buy a lib that does it for you. I've done pretty much what you are doing. A single surface system can handle around 10000 particles until problems occur. And that plenty more than you need.