That's a very useful thread it seems first, since I also thought, it obviously could save cpu.
... I did a stress-test with both solutions, as follows:
(Galaxy SIII - dead same conditions, besides described below)
- 8 Spawning points (for Heroes)
- each spawning Heroes every 2s (8 at once)
- each of them with their own path finding detection at "created" (no map regenerating/registering new obstacles/costs, only FindPath command, rotate object on)
- going to the same goal
- 1 Spawning point (for one hero at once)
- Spawning point finds path on start and saves it in an array to share with spawned heroes (exactly as in zatyka's capx)
- Spawning point spawning 1 Hero at a time, every 0.5s
- Hero has bullet-behavior and follows path (exactly as in zatyka's capx)
A vs. B
Sum of Heroes on Map / FPS (average)
A: 0/21; 25/20; 50/18; 100/15; 150/14; 200/12; 250/11; 300/10; 350/9; 400/8; 500/7; 600/6;
B: 0/21; 25/18; 50/16; 100/14; 150/12; 200/10; 250/9; 300/7; 350/6; 400/6; 500/6; 600/5;
I also have to note, I tested it first in my desktop browser - same tendency, though it spreads way more, so "A" has a bigger advantage
A: dropping below 60 fps only above 500 heroes on map and 56 fps when 850
B: dropping already after 250 heroes on map below 60 fps and 56 fps when 425
Since "move along path" does also rotate/turn my heroes smoothly around corners - whereas bullet-behavior does not (it is possible of course, but why bother, it surely won't make it faster) - I am not sure it makes any sense to substitute the path-finding-behavior.
Feel free to correct me, if I'm wrong, since I am really keen to find a faster solution than path-finding (especially on mobiles).
This thread is a bit older, maybe path-finding got better meanwhile? Or bullet-behavior worse
Any explanation? For me it does not really make sense, since the path objects have to move and rotate too in addition to generating the path.. how can that be faster, right? But the numbers