1
\$\begingroup\$

I found that A* is an algorithm for grid (or tiled) maps. I want to use it or some alternative of it to my game. The problem is that I have no grid. I have canvas and GameObjects could be at position { x: 23.91324512, y: 131.12334253461 }. How would you do this?

And another question, I have element with stepSize (concretely called movementSpeed), and getPosition().getX(), getPosition().getY() AND getRadius() which returns the radius of a circle.

How would you do A* algorithm with radius?

Btw I am implementing it in Java, so maybe some Java snippet would be helpful.

EDIT

As you may suggest me to create a virtual grid, how do I check if I can move to the next node when I have my getRadius() and all the obstacles getRadiuses

\$\endgroup\$
  • 1
    \$\begingroup\$ I suggest you be a lot clearer about what you are asking, or this question is going to be closed shortly. Supply a picture if necessary to explain what you want. \$\endgroup\$ – Engineer Aug 1 '17 at 21:33
  • 1
    \$\begingroup\$ "A* is an algorithm for grid/tiled maps" is a common misconception. A* works for any planning problem that you can describe as a series of discrete options & state transitions. Those transitions do not need to form a regular grid. It's very common to implement A* and similar pathfinding algorithms over continuous space by first discretizing that space into a navigation mesh ("navmesh"), and treating the movement from (anywhere within) one convex polygon to (anywhere within) a neighbouring convex polygon as such a discrete transition. \$\endgroup\$ – DMGregory Aug 1 '17 at 22:17
  • \$\begingroup\$ This appears to be the XY problem. Please describe the issue you're trying to solve first, then your attempted solution. \$\endgroup\$ – Vaillancourt Aug 2 '17 at 10:01

Browse other questions tagged or ask your own question.