0
\$\begingroup\$

I am developing a little game, where I need an A* path-finding algorithm for enemies who follow the player. I have already learned and tested a path-finding algorithm, but it only works with fixed-size array.

How can I turn an open world into a fixed-size array? I am developing with Irrlicht engine 1.6 version. I know that it is a quite old, but it is the only engine which works for me, on Windows XP.

Here is my A star path-finding code that works on a 2D grid. Additionally , if needed, Here there is a link to a walking person I have created with Irrlicht. You must place the media folder in your local drive.

\$\endgroup\$
  • 1
    \$\begingroup\$ Please add the relevant code and only the relevant code to the question. \$\endgroup\$ – Alexandre Vaillancourt Aug 30 '16 at 20:05
  • \$\begingroup\$ @AlexandreVaillancourt I have done it. Look my A star pathfinding algorithm. It has been extracted from a webpage that I don't remember. I just need a bit of help. Please avoid downvote me. I am just a newbie. i need help. Thanks. \$\endgroup\$ – user90710 Aug 30 '16 at 20:59
  • \$\begingroup\$ The problem is, although you may see it all as relevant code, you've actually provided us with all of your code (from what I can see). It is far less likely that users will take the time to read through all of your code, especially if you can not tell us a specific problem with it. Perhaps you could detail why you can only use a fixed array size, and perhaps just include functions relevant to your path-finding? You should put your code in your question, using four spaces to format the line into code. \$\endgroup\$ – Gnemlock Aug 31 '16 at 0:15
1
\$\begingroup\$

There are two options that come to my mind:

  1. You create a fixed size array from your 3D game world. Fixed size is not a problem if your world is finite. You divide the world up into little squares and put information into it whether or not a character can traverse. How this is implemented depends on your game world, the used geometry, the obstacles and so on. You want to go for an automated approach. If you got this you can apply the A* algorithm.
  2. You use a technique that is made for 3D worlds: navigation meshes. There are a lot of results on Google for "C++ navigation mesh" and there are ready to use libraries. A lot has been written and coded for that, do some research and you will surely find a solution fitting your situation.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy