Hi Facet,
it's hard work to find it all out, but possible in all these forums and documentations, tutorials. There are great guide here!
First of all with families and collision-checks, you can take a look at this: download/file.php?id=10965
(see post here: isometric-multiple-floors_t121850?start=30)
I managed to reduce a lot of collisions here, not done yet. You have to be really informed and clever and read a lot, but I managed to work my way through in the past.
Anyone, who can enhance the list with tips, you are very welcome to do so!
Reducing collisions (collision checks) hardcore:
- reduce not just off screen objects, but also objects further away then a specific distance > n, take care though, if you are too low, you might skip the object without colliding, if frame rate drops too much
- disable not just collisions, but solid behavior as well. Since if you don't, your platform/8-dir-movement behavior gonna check ALL SOLIDS all the time. (since that's what they have to do to work as such on). Collisions also are good to be disabled, since when you check for collisions, they still count, if collision is on. so solid and collisions both on disabled, is important!
- Turn off also solid engines, platform, 8-dir behaviors (all properly, not just ignore input set disabled, even here collision off, turn it on if you are in the appropriate distance, as described) or path finding (do that as rarely, as needed) and switch on, when approximately needed.
- Destroy all objects you don't need. Maybe at the beginning already, stuff you need for structure, layout, but not in the game, or just at the very start.
Use any collision-check-events wisely:
(like "on collision", "when overlapping" (checks every tick for collision, a killer)
- Try to abandon unnecessary collision checks, e.g with approximately round (e.g. hexagon) objects, where you can check distance, or squares, where you can compare the "CollsionBox" as coordinates
- In your code, if you have the exact same collision check twice, it checks twice, thus multiplying your collision checks with times two each tick.. which is a lot.. usually, you should have a transparent object-oriented architecture, but in this case reduce all possible collisions you need to just one event each tick!
____________________________________________
- also place them at the end of your chains, so instead of starting with "player > on collision with Object "wall", if "wall.LayerNumber=player.LayerNumber" rather "Wall.LayerNumber=player.LayerNumber" first, then "player > on collision with Object "Wall". This way, you reduce the objects actually getting checked for collisions. If you have a good chain, (with screen, distance and other conditions you can narrow down the selected possible colliding objects) you can have 2-3 collisions instead of 100.
NOTE TO THE LAST ENTRY: I just read this, but to be honest, it was written for 155.. I am not sure, since I managed to reduce the displayed collision checks by a lot, and I am quite sure, it helped. Of course you need to be careful... Anyone knows about this more specifically? Now I'm confused <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">
____________________________________________
Try all that, first the easyest thing, and you will lick blood <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> Like I did. Ending up with only 10% of the previous collision-checks, than before my optimizing trip (on this game actually: http://www.exitthegame.eu (you can skip through the levels with CTRL+ALT+SHIFT+N, pressed in game level. TAKE A LOOK AT LEVEL 12!)
Though its not optimal, since I would start completely different today, it was my first game ever.. so I suffered badly with collision check. Used to have over 100.000, peaks even 200-300.000, managed to lower it down to around 1200, peaks at 2800-3500. But I have physics (also checking for each possible collision, multiplying), rocks (platform behavior 5 rocks is nearly 5 times the check), other players running around...
Additional general advices:
- Use in general rather tile maps, also background tiles, where you can do that instead of placing multiple sprites as a tile (like I did in exit mostly). Try to redraw everything only when needed with e. g. trigger once (instead of every tick, also the case, if condition left empty)
- Avoid huge transparent stuff overlaying other things...
- Set your background-layer "clear background"-option to "No", pixel rounding on (interpolation to point) helps as well (but is problematic)...
Well, that's it for the first.. I might add some things, if I remember anything else, but that's pretty much I know <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">
Kyatric : You seem to be a crack, and might correct me easily, or give us some more tips on the fly? Wanna loose bad habits and learn <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> Please take a look. Thanks!
Hope it helps. If you have any further questions to this, just ask.