   bullets,bullets,bullets! performance goes RAAWH
  my game contains a lot of projectiles(slow projectiles,not the rifle type of projectiles) which seem to be causing a lot of performance problems since every action with a projectile is multiplied by the number of projectiles.for example, i check each projectile for collision with the world every frame. i already divide the world into regions,so if i have 100 projectiles in the game,that's 100 "Which region to check" checks,and another 100 checks minimum considering there's at least 1 object in each region.the problem here is that every small action that i do with a projectile,is multiplied by the number of bullets and causes some serious performance problem. and i really prefer finding a solution to increase the performance checks here rather than reduce the number of projectiles.is there any kind of optimization suited for a situation like this?   
  Sounds like you have some algorithm-level inefficiencies in your implementation; 100 projectiles is peanuts. Modern hardware should be able to handle many thousands of projectiles with (relative) ease.Can you provide some details on what exactly is going on? Maybe some code that illustrates what seems to slow things down? (If in doubt, whip out your profiler and see what has to say.)   ;  i haven't actually used a profiler yet. i probably should have before i made this thread.for now there's quite a lot of not so final code,so i'll just go to the part where i say what i do.so err,the world is divided into a tree of bounding boxes. each bounding box contains a pointer to all the collideable objects in that area. for each bullet i get a pointer to the deepest bounding box(region) that contains the projectile,and then i simply make simple collision checks with the objects inside it(a ray intersection check for quads,and an AABB-point test for platforms).and well,that's for the collision checks. i also check all projectiles if they are visible on the screen and icons on the screen for each projectile that the player can't see. someone gave me an interesting algorithm for that in this threadi know it's a bit inconvenient that i am not giving any code,but for now i am trying to understand if i should have used another algorithms for all those tests instead of finding mistakes in my code.   ;  Are you doing any acceleration for the ray-quad collision checking? Checking a ray against a bunch of quads in a handful of objects can get expensive without something like a bounding interval hierarchy or whatnot. In general there's a lot of great libraries out there that already solve this problem for you, so it's probably worth looking into that if you haven't already; we use Bullet, for instance, to do collision acceleration.   ;Quote:Original post by ApochPiQAre you doing any acceleration for the ray-quad collision checking? Checking a ray against a bunch of quads in a handful of objects can get expensive without something like a bounding interval hierarchy or whatnot. In general there's a lot of great libraries out there that already solve this problem for you, so it's probably worth looking into that if you haven't already; we use Bullet, for instance, to do collision acceleration.pretty much i am trying to depend on external libraries as less as possible,so i rather do any accelerations myself. so what's a bounding interval hierarchy?edit: aright, i JFGIed and found this :is this what you meant? because i do that for storing the world.   ;Quote:Original post by Doctor Shinobi i have 100 projectiles in the game,that's 100 "Which region to check" checks,and another 100 checks minimum considering there's at least 1 object in each region.This sounds wrong to me.  I would loop over each region and check for collisions in that region(unless there are more than 100 regions). Most it sounds like you are doing something to many times a 100 checks shouldn't be a big deal.  Try profiling your code.   ;Quote:Original post by stonemetalQuote:Original post by Doctor Shinobi i have 100 projectiles in the game,that's 100 "Which region to check" checks,and another 100 checks minimum considering there's at least 1 object in each region.This sounds wrong to me.  I would loop over each region and check for collisions in that region(unless there are more than 100 regions). Most it sounds like you are doing something to many times a 100 checks shouldn't be a big deal.  Try profiling your code.i doubt that would be faster. it's just brute force collision checks.   ;  You say the world is divided into regions, and bullets in the region are collided only to world objects in that region.- exactly how much stuff is in each "world region"? Is the bullet in a region colliding with only a few objects or hundreds?;  only a few. each region is quite small.   ;  Sounds like it's profiler time [smile]   