Pathfind with Moving Obstacles

Get help using Construct 2

Post » Thu Feb 28, 2013 12:25 am

I found a small and very simple solution if anyone is interested.

On my "On Pathfinding Path found" event, I added a subevent that checks if the Zombie is currently overlapping another Zombie. It checks which Zombie is the closest and which is the farthest. It then assumes the Farthest Zombie is behind the Closest Zombie and Stops its Pathfinding. It then moves the Closest Zombie along the path, assuming its also not colliding with another Zombie that is even Closer.

It's not too buggy and is better then nothing for now.
Posts: 31
Reputation: 1,387

Post » Thu Feb 28, 2013 1:35 am

When i was working on a zombie game I ended up ditching precision pathfinding and instead gave them a decent Line of Sight system and ability to detect closest targets and a few other useful things.

They recorded the most recent location they spotted a target and would go to that location. If they lost sight of the target they still knew the last place they saw them and would go there, that often meant they regained sight and could change direction. if they were quick enough it meant they would end up following targets round corners even if they lost line of sight for several seconds. They had a timer. When they spotted something it sent an 'alertness' value right up and for every second they lost sight it reduced. When it dropped below a threshold they gave up and returned to wondering about.
Posts: 38
Reputation: 3,741

Post » Thu Feb 28, 2013 9:57 am

Pathfinding is a strategic operation - it certainly shouldn't be recalculated on every step of an update loop, and preferably much, much less than that. Nor should it necessarily be calculated for every instance in the game. Some alternatives:

- Are your zombies moving as a group? If so, just calculate a single path for the "leader" zombie, and make the other zombies follow the leader.
- Make each zombie lay a (invisible) breadcrumb trail. When any zombie finds whatever target it is they were looking for, tell the other zombies to follow the breadcrumbs it left to get to the same location.
- Scrap pathfinding altogether and implement a steering behaviour to navigate to a target destination while steering (i.e. swerving) round obstacles. e.g.
Posts: 83
Reputation: 2,668


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests