What about pathfinding , mobile and moving objects

Discussion and feedback on Construct 2

Post » Mon Mar 25, 2013 10:29 pm

Heya everyone ,

I'm making a game for someone , and it'll be a mobile game , I'll be using the pathfinder for this one , but I heard that the performance is really bad on mobile with pathfinding and I never knew if you could set the end of the path to a moving object (Ex. Player)

What I'm asking for is , is there a way to make a dynamic pathfinder ( Ex. Phatoms that pathfinds to the player ) that doesn't destroy the user's experience ?

My try at it :(

You can play with my capx if you want ...

Anyways , Thanks for reading ...
Posts: 2,247
Reputation: 17,436

Post » Tue Mar 26, 2013 12:55 am

[quote]but I heard that the performance is really bad on mobile[/quote]
It's always best to test it to see the actual performance as hearsay can be exaggerated.

For moving objects you should take the manual into consideration:
[quote]You should also avoid pathfinding every tick, since this will cause extremely high CPU usage and also increase the amount of time it takes for other objects to determine their paths.[/quote]
You'll still end up having to calculate a new path periodically, but all you need to do is get it close enough to the player so it has a line of sight to the player. Then you can switch to a much less cpu intense behavior such as the bullet behavior, to close the gap.

You could also try and do what gillis did and break the area up into boxes and make a list for every box of the best direction to get to any other box. It's a bear to setup as you'll basically be defining the path from every box to every other box, but once the game is running pathfinding will be very fast as it's just a simple lookup.
Posts: 5,104
Reputation: 60,319

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests