At some point, I want to write a pathfinder for Spring that takes into account how many units are moving as a group, and how wide are the available corridors. But that's still far away.Argh wrote:I'd already asked to be able to use Lua to define custom TypeMaps, and alter the pixel values, several times. I sat that one out in disgust, frankly. Having the ability to use Lua to simply write "don't go here" or "use this path ONLY" for a given Unit class would be very, very useful.
The problem is pretty darn simple: that data is currently read from the SMF. After that, it's static. There's no reason at all that it couldn't be dynamic data that could be altered on the fly, but the devs have expressed little interest. I could care less about simply changing typemaps that are already painted onto a map- that won't allow for Lua to do dynamic stuff in terms of pathing, such as denying movement through zones, slowing Units down by changing the state, encouraging certain Units to only use a certain part of the map to move on, regardless of the heightmap, etc.
In the meanwhile, I'd like to try and tackle this dynamic typemap issue. Making the data dynamic shouldn't be a problem, providing an interface all the way to the lua layer might prove more difficult, since I know very little of Spring's code. And in my experience passing data types between different languages can be hell.
I could allow you to retrieve the names and properties of existing typemaps and let you paint/read those wherever you want; or I could also allow you to ask Spring to retreive the next unused red value to dynamically create your own terrain type, and again, paint it or read it from the typemap.
Would that be enough, and does the lua interface provide you with everything you need for the dynamic pathing you were talking about?
Before you get too exited, I probably won't be done until february 2010. You know, real life stuff. But this is a medium-size project that actually seems doable (unless there's something even weirder than I expected in the Spring engine), so it's motivating.
Oh and... just thinking aloud here... does Spring have lava (damaging water) yet, or any type of terrain that can damage units?