Jump to content

  • Log In with Google      Sign In   
  • Create Account

warisson

Member Since 05 May 2013
Offline Last Active Sep 17 2014 02:24 AM

Posts I've Made

In Topic: Algorithm to find neighboring rectangles?

16 September 2014 - 10:49 AM

Hmm, that's a pretty good idea. I was trying to tackle the problem from the approach of using a sweep line method, but couldn't figure out if I could use the BSP tree structure to improve the performance. The rectangle data is indeed static, and never changes, so I guess I'd agree that it wouldn't be too bad if this step takes a bit longer than the next step in the process. I'll try out what you suggested, thanks!


In Topic: A* pathfinding around axis-aligned rectangle obstacles

07 May 2013 - 10:46 PM

I see. Those two libraries would certainly help a great deal; they're probably optimized well beyond anything I could ever manage. Unfortunately, the game world's density can vary immensely. You might be trapped in a complicated maze and have to pathfind out, or you could be in a wide open area with a few obstacles lying around; it has to perform well on all test cases. I suppose I could also keep a record of places I've gone to and what their navigation mesh is to improve performance as well. In any case, I think those libraries' functionalities should be sufficient to generate a good graph to pathfind on. Thanks!

In Topic: A* pathfinding around axis-aligned rectangle obstacles

06 May 2013 - 02:25 PM

Hmm, it certainly sounds like I can reduce the running time by calculating connections while pathfinding rather than before, as you guys said.

Perhaps I should have mentioned some more details: the player character walks around a 2D area with rectangle obstacles that don't move (or rather, very few obstacles are able to move around, and they're always player-sized or smaller, so if we collide with something, we can just run the pathfinding again). The reason why I said that the rectangles move around a lot is that the player can only see a certain area of the map (which is huge), and because the player is constantly moving whenever it paths around, rectangles move around, get placed in the area of sight, fall out of the area of sight, etc, all the time. However, while pathfinding, they're definitely mostly stationary. The player is the only agent that needs to pathfind. Also, when I pathfind, I'm only looking to go from the starting point to wherever I want to go to, no more. The environment to path in is typically medium-sized (I know that's a poor description but I'm not sure how else to explain it). Also, the rectangle obstacles are allowed to overlap each other, which I hope will not affect the algorithm (at least, it doesn't seem to me like it should affect a great deal).

There's also something else I should have added. Sometimes, it's not possible to find a path from A to B (ie, when B is inside an obstacle or enclosed by rectangle obstacles). Would I have to search through all points, then?

In Topic: A* pathfinding around axis-aligned rectangle obstacles

05 May 2013 - 01:26 PM

 

One solution would be to have a 2D grid of cells covering your entire play area, and use each cell as an A* node. When it's time to do a pathfind it should be pretty easy to work out which cells are blocked due to being underneath one of your axis aligned rectangles.
 
The only tricky bit is getting the resolution of your grid good enough that you strike a decent balance between having far too many cells to do the pathfind quickly, and having too few so that small gaps are missed.

 

Hmm, this sounds like a fairly easy solution. But it would be ideal to have the path have as few turns or joints as possible, as each time I make a turn, I have to stop for a split second. Making very small moves and then moving in another direction will probably make traversing the path take a very long time; is there a way in which I can smooth out the path after finding it?

 

It looks like you implement only certain part of the whole pathfinding ? That is not a good idea, since it seems like the redesign of the problem is due, but you can only propose the change (and not enforce it).
 
What happens if you break down those 200 rectangles into actual nodes and set them as non-walkable ? I'd start with that.

 

Unfortunately, due to certain circumstances, I can't change anything about the problem I've been given, only the way in which I choose to solve it. I'm not sure what you mean by breaking down rectangles into nodes and setting them as non-walkable?

PARTNERS