Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not use diagonals #1

Open
freddymx opened this issue Jul 24, 2012 · 5 comments
Open

not use diagonals #1

freddymx opened this issue Jul 24, 2012 · 5 comments

Comments

@freddymx
Copy link

Hi, I'm working in a game and I need not use diagonals to avoid cutting corners. Can you help me?

@prettymuchbryce
Copy link
Owner

Hey Freddy. EasyStar does not even support diagonals at the moment. I think it should fit your needs out of the box.

It is my plan to eventually add diagonals as optional, and for the implementation to be something like this:
myEasyStar.allowDiagonals = true;

I hope this answers your question.

@freddymx
Copy link
Author

ok ... I have an error in my code because my character is diagonal in the way. The game that I am making is for mobile devices is there any room for improvement in easystar about the performance?

@prettymuchbryce
Copy link
Owner

Hey Freddy. Could you post the error you are getting that relates to diagonals?

I am sorry to hear you are experiencing poor performance.
Are these performance issues directly related to EasyStar?
What value are you using for calculationsPerFrame?
Do you have more than a single instance of EasyStar?
How big is your tile grid?

When you say the performance is slow what do you mean? Does attempting to calculate a path slow down your game, or does it take a long time to calculate a path?

Is there any way I can look at your source code? It would be helpful for me to look at your use case and see if there is anything else I can do to help.

-Bryce

@freddymx
Copy link
Author

Hi, the problem was in my code to move the characters ... I have already fixed.
The performance problem is not just for EasyStar although clearly consumes resources for a mobile. I have put the calculationsPerFrame to 60 (too low?). The map is 2048x2048 (64x64 tiles).
I am working with the framework Axel ... would be great if integrated pathfinding ;-)

@prettymuchbryce
Copy link
Owner

I think you might have some luck trying to lower the calculationsPerFrame. It may take long for your characters to "think" of the way to get to their path, but at least it wouldn't drag your game to a grind when they do. Do you have many npcs trying to find paths all at the same time?

2048x2048 is pretty huge. I would make sure that no npcs are trying to find paths when they are not on the screen. You might have better luck with a custom node based pathfinding system rather than a tile-based one. EasyStar considers every tile a node. In some use-cases it's better to define your nodes manually in a level editor. This way npcs are smarter about where to go, and only check nodes that are important.

I found this image on google images to demonstrate what I mean: http://i49.tinypic.com/2mq24g0.png
These nodes are probably placed manually in a level editor at only the places that the enemies will need to know about.

EasyStar draws no distinction between tiles. Every tile is a node:
http://images.gamedev.net/features/programming/astar/image007.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants