How do I make the regenerate pathfinding obstacle map better

Get help using Construct 2

Post » Mon Apr 28, 2014 6:49 am

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?
B
4
Posts: 5
Reputation: 235

Post » Mon Apr 28, 2014 7:22 am

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.
Image
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 :D
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Tue Apr 29, 2014 4:39 am

grid maze.png


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
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 5
Reputation: 235

Post » Tue Apr 29, 2014 11:37 am

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 :(
Last edited by nimos100 on Tue Apr 29, 2014 1:20 pm, edited 1 time in total.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Tue Apr 29, 2014 11:51 am

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.
B
44
S
10
G
8
Posts: 437
Reputation: 6,463


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], leandrogenske, R0J0hound and 9 guests