Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am making Sniper game in unity 3d. In this game zombies will come randomly towards the sniper and sniper have to kill them. I am using RAIN(indie) for path finding. It works best when zombies are few . As I increase the Zombies( that is 10) the performance decrease a lot. The fbs drops to 25.

I want to know is there any technique or steps so I can improve fps Any other technique/algorithm that I can use for pathfinding weith good fps.

PS

I already remove Sensor component from AI. FPS of game without AI is 61

share|improve this question
    
What have you tried since posting this question? You should edit to include updates. –  Seth Battin Aug 5 '13 at 5:01
    
@SethBattin As per suggestions I got, I used A* path finding technique but the FPS is still down. Then I used the Nav Mesh technique (unity pro) and FPS improved. So I decided to continue with Nav Mesh technique. –  zeeshan0026 Aug 7 '13 at 5:39
add comment

2 Answers 2

The main technique is to simply not run the pathfinder every frame. Typically, you only need to run it once a second or less to get good results. Depending on what you're using it for, you may even just need to run it once ever.

Another common technique, when pathfinding for multiple units in different places to the same end location, is to instead search outwards from the end location to each of the units. This requires only a single pathfinding call for all the units, rather than one for each unit. This requires you to actually get down into the pathfinder-implementation, though; if your library does not already support this technique, there is no way for you to "fake" it, you'd have to switch libraries or write your own pathfinding code.


I can also second the recommendation for Aron Granberg's Unity pathfinding library; I've looked at his code and actually spoken with him personally, and I can vouch that the library is very well-optimized. I am not familiar at all with RAIN.

If you do decide to go the code-your-own-pathfinder route, I have written a priority queue optimized specifically for pathfinding that would be useful. I have not tested it with Mono/Unity, but I believe it should work fine.

share|improve this answer
add comment

I'm unfamiliar with RAIN, however using Aron's terrific A* pathfinding for Unity3d with dozens of units (on mobile devices) work like a charm:

http://arongranberg.com/astar/

P.S. RAIN might be as good as the package I've suggested or even better, it might be that you're just using it incorrectly.

share|improve this answer
    
-1 This isn't a which technology to use question. Please include suggestions for improving performance instead of just recommending a different library. –  Byte56 Jul 31 '13 at 14:35
    
@Byte56 - Obviously since his question is so general it's nearly impossible to suggest how to improve suggestion - the 2nd part of my answer was "the answer" to his question –  Ron Jul 31 '13 at 15:13
    
General improvements apply. For example, only finding the path once and the next time a unit spawns at that location, just use the same path. Only update paths every once in awhile. Increase pathfinding node size, therefore reducing node count. And so on. It's actually easier to answer in this generalized form. "it might be that you're just using it incorrectly" is a fairly poor suggestion for how to make it work better. –  Byte56 Jul 31 '13 at 15:30
    
@Byte56 duly noted. –  Ron Jul 31 '13 at 22:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.