I am new to game programming I currently am using unity's 2D power to remake an 2D game for sake of practice. So I am just little confuse about one thing, so far every enemy in my game was dumb(they move on predefined paths) but this enemy, alien-copter, flies and follow the player wherever the player goes. My question is should I implement any pathfinding algorithm? I had studied A* but I trying to figure out if A* is gonna be helpful in my envoirnment because player will be moving and the enemy have to keep on looking for shortest path. I tried to write code for this AI my code was working perfect when there were no obstacles but my game has obstacles so I want something efficient so what do you people think should I implement A* or any other algorithm or not?

  • \$\begingroup\$ possible duplicate of How does A* pathfinding work? \$\endgroup\$ May 30, 2015 at 18:04
  • \$\begingroup\$ Though your question is more specific than that duplicate, you might find an answer there that covers your particular concern about moving destinations. \$\endgroup\$ May 30, 2015 at 18:05
  • \$\begingroup\$ I do know how A* works(not that deep but enough for my game) I just wanted to know if I should implement it or not I mean if it is too expensive for my 2D platformer. I was thinking that these algorithms are for bigger and more wider games. \$\endgroup\$ May 30, 2015 at 18:08
  • \$\begingroup\$ Ahha. Well, whether or not it's appropriate for your project is not a question that this site is suitable to answer, because it's a combination of your specific project details and opinion. If you would like to discuss it, another forum might be better (say, gamedev.net), or you could use the chat feature here. Unfortunately that second option requires earning a some reputation points, but that's fairly easy to do. \$\endgroup\$ May 30, 2015 at 18:25
  • \$\begingroup\$ Another good related question: gamedev.stackexchange.com/questions/12186/… \$\endgroup\$ May 30, 2015 at 18:26

1 Answer 1


without any clues of what your game looks like, what platform it is aimed for and what are you willing to do I'm going to try to give some hints (since I myself have been in your place):


  • Research games that look alike the one you're making;
  • Contact the devs of such games, converse with they implementations and strategies;
  • Do some reverse engineering.


  • You asked: "my code was working perfect when there were no obstacles but my game has obstacles [...] should I implement A* or any other algorithm?" Yes, yes you should. That's just the next step to know if the algorithm will be suitable for your game;
  • Experiment with navigational meshes, waypoints, different heuristics and note down the results to compare and evaluate;
  • Also https://gamedev.stackexchange.com/a/73740/30632

And lastly, when I was first learning path-finding algorithms, I used to make tons of little test cases to see how would the agent behave in certain situations and how could I make it do better by tweaking the heuristics and etc.

  • \$\begingroup\$ Thanks for the suggestion of contacting other devs I didn't thought of it. My game is 2D platformer(its a remake of android game "Random Heroes") I am just making it for my practice. I don't know much about nevmesh or waypoints but I will google them. I don't get enough time for my game(because of studies) that is why I am always late in replying \$\endgroup\$ Jun 4, 2015 at 17:18

Not the answer you're looking for? Browse other questions tagged .