-
Notifications
You must be signed in to change notification settings - Fork 58
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
Documentation / IntelliSense support #33
Comments
Hey @rm-code, Previous version of this library used abstract units. (A grid cell was '1' unit wide and '1' unit high.) Traversing a cell would have a cost. Also an abstract unit. The path finding algorithm tried to find a path with the lowest cost. Unfortunately it was very hard to reason how cost would affect the path, since all these abstract units are not found in real life. Because of this the latest version uses real units. A cell has a certain size. (For example it is 10 meters wide, or maybe 2 kilometers wide, whatever fits your game) and cells are connected through edges, which go from the center of one cell, to the center of another cell. Each edge has a speed limit. You could see these edges like a road, with a speed limit. Some roads are municipal roads and some roads are highways. This makes it easier to reason about paths in an intuitive way. A direct route over a dirt road might not always be faster than an indirect route over a highway. The path finding algorithm tries to find the path that takes the least amount of time. In your rogue-like everything also has a size. You might be using abstract units. But I could image that a single grid cell in your game's grid can hold a large monster. So we could use a I hope this helps thinking about how you should set up this library to work for you. Does this help? Or do you have more questions? Feel free to ask them here. I will check regularly :). |
@roy-t Thanks for the thorough explanation, but I'm still not sure how I would translate your system to my (indeed) abstract units. Let's say I have the following situation The Opening the door costs 3 AP, moving onto the door tile and to the empty tile costs two more AP so all in all this would cost 5 AP. How would I set your library up to get this information? Is it possible at all? |
Oooh new version! Thanks Roy! "Like A Bishop, Like A Queen" best GitHub lyrics 2020. |
@rm-code ah that makes your question a lot clearer. I think I would solve it like this: Let's think of AP as a measure for 'how many seconds it takes to perform an action'. And let's define that every tile is 1 by 1 meters long. Traversing a normal tile costs 2 AP which is 2 seconds. So the traversal velocity of a normal tile is 1/2 meter per second. Traversing a tile that has a closed door on it takes 3AP (for opening the door) + 2AP for traversing the tile the door is on), so 5 seconds. So the traversal velocity of a tile with a closed door is 1/5 meter per second. Using this logic the path finding algorithm will generate the fastest path, and the units make sense. If you prefer to use cost instead of velocity you can always try downloading version 2.1.0. It is slightly less fast than this version. (see the benchmark history) but I doubt that you would notice the difference in a rogue like. |
Thank you, I'll try it out 👍 |
Hey @roy-t,
this library looks quite interesting, but I find it hard to get started with the current state of documentation.
Your blog article seems to be outdated (or at least the examples are). The README examples work for me, but there are some parts I don't understand.
I want to use it for a roguelike-y game, so the
Grid
looks like the right starting point. It looks like thecellSize
andtraversalVelocity
are used to measure some sort of "real" distance. Can I omit them somehow? Can I use some default values without affecting the path calculations?Thanks in advance.
The text was updated successfully, but these errors were encountered: