Autodrive

by Pi-C

Car equipment for train avoidance, logistic network integration, circuit network connectivity, fuel refill, ammo reload, vehicle repair, radio control, enemy targeting, and gate control.

Content
5 months ago
0.17 - 2.0
3.59K
Transportation Combat Logistic network Circuit network

i Better pathing - offroad too often

19 days ago

My car often picks up paths off road even if road is near. Some setting like:
"Roads1 regexps" - regexp delimited list of roads
"Roads1 priority multiplier" = 2

"Roads2 regexps" - regexp delimited list of roads
"Roads2 priority multiplier" = 5

"Roads3 regexps" - regexp delimited list of roads
"Roads3 priority multiplier" = 20

Would be good, to make pathing better. Multiplier is basically mean that length over road get devided by specified multiplierm when considering different path.

19 days ago

Adding settings is no problem – but getting the pathing right sure is!

I've already thought about this years ago. One idea was to interact with Pavement Drive Assist, so that AD would manage pathing on a macroscopic scale and PDA would micromanage by keeping the vehicle on the road whenever possible. But that would mean that I'd actually have to replicate the game's pathing algorithm! If there is a road a bit off the path, I'd have to check whether it leads in the same direction as the path or whether it will make a curve away from the path, or even a U-turn. Also, I must check where to leave the road and turn back to the path, considering obstacles like cliffs or big lakes.

Currently, I rely on the game to provide pathing (the game makes use of this algorithm for enemy units like biters and spitters). This is much faster (running C-code) than whatever I could come up with. Autodrive already is somewhat heavy on UPS, so unless I've got struck with a genius idea there is close to no chance that I'll implement your – admittedly reasonable –– suggestion.

However, I've just made a modding interface request for specifiying preferred_tiles in LuaSurface::request_path. If that should ever be implemented (which I doubt the devs will do, as it puts additional load on pathing), it would be quite easy to call the function with a list of suitable tiles. :-)

19 days ago
(updated 19 days ago)

I have the following ideas regarding pathing issue:
1. Most obvious: allow manual laying path, i.e. I click 10 times instead of one, then vehicle just follows goes from 1 to 2, from 2 to 3, etc. For now I can't even set more than one destination point.
2. At least follow roads when both A and B are on road tiles (then use road only pathing). (in fact 1 + 2 will already give very good results I think)
3. Look into Transport Drones mod - it somehow handles pathing inside roads only but they likely also use vanilla pathing for doing this.
4.a. Remember chunks with roads. And interconnect them - i.e. if 2 chuncks with roads are near-connected.
Then use current pathing, but when it intersects chunk with roads - switch to still vanilla pathing - but roads only variant. Same for exit.
5.b. Don't remember anything, but just check if vehicle is near road while moving. When it's on road - switch to road-only pathing.
6. But if I did that myself I would likely try to implement pathing-on-roads algorithm using GPT by myself, the idea is to split all road into straight and diagonal segments (most roads will likely follow this exact shape). All adjacent rects form graph. Then just iterate from both ends, starting with rects that in same direction as other end until some connections found, than compare those connections by length and pick best. Of course cache. And also I would just start moving in straight line from A to B while calculating in async (x iterations per tick). Doing this by hand would take days or even weeks, but with GPT/Codex - it's just requirement doc, and it'll do... something... somehow.
So I'd use ChatGPT Codex to implement all these....

I will maybe try this. Will you accept a PR? I don't want to do separate mod...

New response