This is great news.
I requested that pathfinding be accessible as an API a while ago here:
viewtopic.php?f=28&t=39896
If you're not already familiar with the AAI Programmable Vehicles mod, it enables you to select one or many vehicles and order them to locations, loop in paths with waypoints, transfer inventory between each other, or program them using structures connected to the circuit network.
The current setup involves spawning an invisible unit (the 'navigator'), issuing a go to command, logging the path, and then trying to use the path as a set of target tiles for a fake vehicle driver. As you can imagine, there are many issues with this approach. Usually the navigator gets close to the target point then wanders off in a random direction and goes in circles and I can't tell if that's part of the pathfinding or the actual found path so the vehicle follows the same pattern.
It would be great if an asynchronous pathfinding request could be made so that the path of a failed status code could be returned and I could use the returned path data to drive the vehicle. The kinds of data to send and get back are outlined here:
viewtopic.php?f=28&t=39896
Here are some other things that are relevant to scripted unit control that are worth looking at:
Sometimes units disappear or lose their orders, especially on large maps. I'm guessing that's an optimization thing and hopefully part of the stuff that can be solved as part of the prototype changes in the blog post.
When requesting path for a unit, the current system assumes that the units are land based, the pathfinder doesn't obey the unit's collision masks, which would be important for amphibious or fully aquatic units.
When finding a path, if path fails, it would be good to be able to have it return the path that it did find that is closest to the target point, along with the distance of the path end to the target. I'm assuming that information is already there if you're using something similar to A*. An example would be: go to a water tile but it's a land unit, pathfinder fails but returns the path to the closest piece of land to the target.
The last time I checked it was almost impossible for figure out if a unit actually had a proper order already. I can't remember quite what I was checking for or what the return value was, but it's the situation where biters are essentially 'idle' outside their spawners all facing north and not moving. Being able to easily identify those would be useful, I think the problem was they seemed to already have a command be not be active for whatever reason. The specific use case was to trigger all idle biters in a certain radius to accept an attack move command. The important point is that only idle biters should be affected as if multiple of these calls go off they'd keep changing directions and not get anything done. Anyway it would be better if there was more transparency regarding the unit's actual status and activity.
This is not unique to units, but a lot of the time it is necessary to check that a unit's position is still valid, otherwise it would need to be nudged to the nearest valid position.
If trying to check that the current position is valid with surface.can_place_entity it will be false because the unit itself is in the way. It would be great if can_place_entity could specify an entity to ignore. Likewise specifying an ignore entity for surface.find_non_colliding_position would be useful for the same reason. The current workaround I use is to teleport the unit out of the way before the check then teleport it back afterwards.
The option of being able to ignore trees as part of pathfinding would be very useful. I have a harvester unit (
https://mods.factorio.com/mod/aai-vehicles-miner) that can harvest trees as it moves so it pathfinding around them makes no sense.
Being able to make a unit prototype immune to all 'stickers' would be great. The invisible 'navigator' unit I mentioned before can catch on fire, so there would be a weird flaming sprite running about the map if there was fire on the ground near vehicles.
A lot of people that use my vehicles put a lot of time into making road systems (even though my vehicles tend to ignore them most of the time). It would be great if the pathfinder had the option to factor in the vehicle friction modifier or walking speed modifier into the tile cost and heuristic so that units could follow paths and roads.
This may be hoping for too much, but it would be great if the a lot of the unit mechanics could be extended to vehicles, or perhaps an extended version of a unit that supports most of the vehicle properties such as:
Turning speed (probably have to force tank turning mode otherwise that would be very difficult)
Acceleration
A separate turret
Fuel use
An Inventory
Ammo
Edit: Also, a flag to prevent units from attacking blocking trees and other obstacles would be nice. I couldn't make a unit without an attack, so I tried making one with 0 damage but it gets stuck endlessly attacking trees for no damage.