More advanced path-finder - LUA interaction
Posted: 15 Dec 2009, 20:35
Path finding - The stuff that allows units to get from point A to point B.
Lua - Magical stuff. That's all that is needed to describe it.
Currently, the pathfinder is very inflexible with the way it calculates its paths. I would like to see that change though.
What I want to see, is a way for the pathfinder to temporally allow Lua to take over. When lua does have control, it can either define the rest of the path itself, or just define a small part before letting the pathfinder do the rest.
My suggestion is we define areas on the map with lua, that simply tells the pathfinder that lua can find a faster way between any two of them. From the lua side, you could either just specify some weighting information, or tell it to assume that any unit using any shortcut provided by this feature will behave and act as another unit during the duration of the trip, so that the pathfinder can get an idea of how to determine if it would truly be shorter or not.
One immediate example that comes to mind: Imagine a transporter managing script that works by exposing a transporter's pickup and drop off zones to the pathfinder. Normally only units that are set to go within the pickup zone will be picked up, moved, and dropped off at the drop off zone. But with a widget using my suggestion, ANY unit that could gain an advantage from the transporter would be able to use it without extra effort from the player. If you even want, you could perhaps allow units to use the drop off and pickup zones in reverse, allowing a quick retreat when needed.
Another few examples that comes to mind is allowing some exotic movement that can't normally be defined without lua, such as defining a bridge, tunnel, or a feature with movable surfaces. With this idea, making lua capture commands and decide own its on whether or not a unit should use a bridge or not could all be done with this feature. In fact, this could be seen as one of the first steps needed to realize workable bridges in spring.
With a feature such as this, combined with the ability to better define a movable surface upon a feature, or even on another unit, we can change the way me make maps, the way widgets will handle precise movement of units, and even take battles to new heights!
Optionally, I would also like to define a "floating surface," an area that isn't attached to the map directly that defines a surface for units to move on. Information such as geometry needed for the pathfinder could be provided in form of type of height map. You could then seamlessly connect it to the map's main geometry using the proposed lua-path finder interactions. I heard that this is already mostly possible with lua, so perhaps just defining this in the pathfinder would suffice?
Please consider this idea, discuss it thoroughly, and try to realistically find any solutions to any flaws that may be present. Perhaps you know of a better way this could work? Feel free to post that here as well.
I might provid diagrams to better demonstrate what I mean later on if this is seriously being considered.
If I could better understand the path finding of spring, perhaps i'll even help out? Where could I find out how the pathfinder works, aside from reading the source code? Is anyone familiar with the pathfinder enough to give me a quick explanation on how it works? Assuming that I do in fact get the free time I want from my RL, and if I decide to help, how would I begin coding such feature request? I'm pretty sure that this would have to go in a separate git/svn branch/repository, just like what is being done for the ROAM version of spring.
Lua - Magical stuff. That's all that is needed to describe it.
Currently, the pathfinder is very inflexible with the way it calculates its paths. I would like to see that change though.
What I want to see, is a way for the pathfinder to temporally allow Lua to take over. When lua does have control, it can either define the rest of the path itself, or just define a small part before letting the pathfinder do the rest.
My suggestion is we define areas on the map with lua, that simply tells the pathfinder that lua can find a faster way between any two of them. From the lua side, you could either just specify some weighting information, or tell it to assume that any unit using any shortcut provided by this feature will behave and act as another unit during the duration of the trip, so that the pathfinder can get an idea of how to determine if it would truly be shorter or not.
One immediate example that comes to mind: Imagine a transporter managing script that works by exposing a transporter's pickup and drop off zones to the pathfinder. Normally only units that are set to go within the pickup zone will be picked up, moved, and dropped off at the drop off zone. But with a widget using my suggestion, ANY unit that could gain an advantage from the transporter would be able to use it without extra effort from the player. If you even want, you could perhaps allow units to use the drop off and pickup zones in reverse, allowing a quick retreat when needed.
Another few examples that comes to mind is allowing some exotic movement that can't normally be defined without lua, such as defining a bridge, tunnel, or a feature with movable surfaces. With this idea, making lua capture commands and decide own its on whether or not a unit should use a bridge or not could all be done with this feature. In fact, this could be seen as one of the first steps needed to realize workable bridges in spring.
With a feature such as this, combined with the ability to better define a movable surface upon a feature, or even on another unit, we can change the way me make maps, the way widgets will handle precise movement of units, and even take battles to new heights!
Optionally, I would also like to define a "floating surface," an area that isn't attached to the map directly that defines a surface for units to move on. Information such as geometry needed for the pathfinder could be provided in form of type of height map. You could then seamlessly connect it to the map's main geometry using the proposed lua-path finder interactions. I heard that this is already mostly possible with lua, so perhaps just defining this in the pathfinder would suffice?
Please consider this idea, discuss it thoroughly, and try to realistically find any solutions to any flaws that may be present. Perhaps you know of a better way this could work? Feel free to post that here as well.
I might provid diagrams to better demonstrate what I mean later on if this is seriously being considered.
If I could better understand the path finding of spring, perhaps i'll even help out? Where could I find out how the pathfinder works, aside from reading the source code? Is anyone familiar with the pathfinder enough to give me a quick explanation on how it works? Assuming that I do in fact get the free time I want from my RL, and if I decide to help, how would I begin coding such feature request? I'm pretty sure that this would have to go in a separate git/svn branch/repository, just like what is being done for the ROAM version of spring.