Isometric Pathfinding Optimization

0 favourites
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • JamesXXXYZ

    I don't understand the way you're trying to do it. There shouldn't be any key presses to change direction if it's following a path.

    In order to get the appropriate directional facing frame for a sprite, the movement of which is being controlled programmatically like this (path finding), you need to poll its vector.

    You can do that by comparing its position last frame and this frame, if you're not using physics. If you don't have walk/run or anything like that, you can throw out the magnitude and just keep the angle, which you can convert into the frame you want.

  • Pathfinding topdown and sync it with picture below.

    [attachment=0:274d0c9p][/attachment:274d0c9p]

    MVG

    This is how i can control something in topdown and project it in isometric view (with this picture above). It was only an example.

  • JamesXXXYZ

    I see. So, you should be able to also store the prior X and Y, compare it to the new one, and get the angle of movement, right?

    Or maybe there's another problem I'm not seeing.

  • MVG

    For me it is really complicated but if it is for you easier you can check this out, please?

    Capx (with some needless events):

    From:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • JamesXXXYZ

    Sorry, I don't have C2 installed on this computer (on laptop), so I can't check it right now.

    But basically:

    Set Xold to X

    Set X to Playertopdown.X

    Set Yold to Y

    Set Y to Playertopdown.Y

    Now you just need to compare the coordinates, (Xold,Yold) and (X,Y) to get the angle.

  • MVG

    thx

  • It should be pretty straight forward from there, but let me know if you have any problems.

  • rexrainbow

    Seems to work well, although I can't tell much without obstacles in the way to trip it up.

    However, I am seeing some aesthetically odd results.

    For example:

    Nine steps, yes, it's technically an acceptable path, and one of the shortest paths, but visually it's not the shortest path (just one of the shortest options given the tiles).

    Maybe you can add in a distance check, such that it will choose the shortest path that also *looks like* the shortest path, in that it's also the shortest linear distance?

    Just an idea.

    agree on this!

  • irina

    I'm happy to report that it's already fixed! rexrainbow is pretty amazing.

  • thanx for the info!!!

  • MVG

    irina

    I had fixed path mode to find path in "a line", see this post.

    But it is still not perfect

  • BTW, I thought that official path finding could be fixed to support moving on isometric/hexgen grids.

    I would like to try it.

  • BTW, I though that official path finding could be fixed to support moving on isometric/hexgen grids.

    I would like to try it.

    That would be really awesome! It seems like a lot of people like to use isometric view on their games, so any optimization towards that would be great.

  • BTW, I thought that official path finding could be fixed to support moving on isometric/hexgen grids.

    I would like to try it.

    that would be really something!

  • BTW, I thought that official path finding could be fixed to support moving on isometric/hexgen grids.

    I would like to try it.

    Yes please! Also maybe include collisions checks so the units don't walk on to each other!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)