0 Favourites

How do I make the regenerate pathfinding obstacle map better

  • Hi, current trying to make a maze builder game which the user can build the obstacle to make the monster walk longer time

    but the problem is when i build the obstacle and i ask for regenerate pathfinding obstacle map it will lag

    if i built too much at a time, it will lag constantly

    so it is any better way to regenerate pathfinding obstacle map?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • [quote:1myzoiiz]so it is any better way to regenerate pathfinding obstacle map?

    Unfortunately there aint

    Which make games like the one you want to make kind of useless with the path find behaviour, its simply not fast or effective enough to handle such thing without lagging. However there might be some work arounds. However I haven't tried them, so they are just ideas.

    One way would be to try to use a tracker so you actually only update the obstacle map for this single object and then you use its data to control the monsters. Assume that you don't use tilemaps?

    It would go something like this:

    1. Regenerate obstacle map for tracker.

    2. Move tracker to each monster and find path to where it should go and then copy the path to the monster.

    3. Let monster move the path.

    Whether that will solve the problem or not im not sure.

    Another way which also uses a tracker object, but would be the only one with path finding behaviour and it should then "paint" the path for the monsters to follow. So the monsters themselves doesn't have path finding but simply react to whatever direction they encounter painted by the tracker.

    It would be something like this.

    So each of the small arrows are the nodes that the tracker have found when it calculated the path. So for each of these nodes you spawn a Sprite which have a direction (Left, Right, Up, Down) and when the monsters hit them they change direction, So it will look like they are finding a path. However it might sound easier than it is, because if you block the path you have to recreate it from the blocked path etc. But think it could work ok when it comes to at least solving the lag from doing path finding on all monsters.

    But again I haven't actually tried any of the solutions my self, so they might not work at all

  • [attachment=0:1wxw2xc3][/attachment:1wxw2xc3]

    Hi, thanks for reply

    my interface look like this, and i dont think construct 2 can handle this

    while the blue color is runner, and the purple color is target

    i think i have to think another way or this design just fail

  • [quote:3rlmrt2x]Hi, thanks for reply

    my interface look like this, and i dont think construct 2 can handle this

    while the blue color is runner, and the purple color is target

    i think i have to think another way or this design just fail

    Yeah its to bad, because when you design something like this in your head you think it wont be that hard just throw a path finding on there and then It works. But then it starts to lag and you notice that its never going to work, and then these type of games suddenly become very hard to make

  • I did experience with this too a while ago (Spawning 3 enemies every second on different locations of my map and let them go to a center point). By left clicking I was able to set a wall and with right clicking to destroy a wall. The best solution I got was to just assign the pathfinind at the beginning and only update the path, when one of my enemies collides with a wall.

    Still no great experience, but I do hope that this will improves sometime.

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