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
7 days ago
0.17 - 1.1
2.38K
Transportation

i Question and Comments

3 years ago

What is the current purpose of the Ammo and Fuel sensors? Is this for legacy support? Unless they do something more than their description, isn't this functionality (auto-reload) part of the base game? (At least now...I think I remember seeing that it is a new feature somewhere.)

I'd love to see some more toggles for the various sensors. The one that comes to mind specifically is the enemy sensor...be able to shut it off without removing the sensor from the vehicle so it doesn't engage the enemy. Particularly useful for peaceful mode game runs. I haven't gotten that far yet, but the same could probably be said of the logistics functions. Knowing the issues I run into with the personal inventory when I forget to turn off logistics, I could see similar problems arising with vehicles.

If you ever take it farther, I wouldn't mind seeing more functions for automating vehicles such as schedules or some other way of easily telling a vehicle to travel between 2 or more points. In short I guess it would be the AAI Programmable Vehicles mod (from what I've read about it) but without all the extra stuff. I actually downloaded it, but disabled it because I didn't want it modifying all the vehicle recipes and performance in my game...I just wanted the programmable functions so I could make some non-train based delivery routes. Yours looked promising and I think it will work, but seems like it is going to need a lot of circuit work. (I think I will be able to find other uses for it if I don't end up using it for what I got it for.)

Speaking of unwanted performance, I read the thread on the GCKI mod pop-up. I appreciate that you made it so it isn't going off all the time, but I have to agree that it is basically an ad and for what I have seen of the game and other mods, I personally find it inappropriate and intrusive and is my one actual complaint. If you think they go together that much, just roll the code into Autodrive as an optional function (so I can turn that segment on or off in the mod settings if I don't wish to use it) and be done with it. Otherwise, just make it an optional dependency. I can't speak for everyone, but when I see those in the in-game mod portal, I do often go check them out to see if they are something I'd be interested in. If I'm not, I don't expect to be badgered about it though, regardless of how infrequently.

3 years ago
(updated 3 years ago)

What is the current purpose of the Ammo and Fuel sensors? Is this for legacy support? Unless they do something more than their description, isn't this functionality (auto-reload) part of the base game? (At least now...I think I remember seeing that it is a new feature somewhere.)

I honestly don't know the new behavior because I haven't had time to play in months. If something has changed in that regard, I must have missed it. But perhaps it's just a misunderstanding? Ammo and Fuel sensor allow to reload from the trunk -- not just from the ammo/fuel inventory. So if a truck equipped with a Fuel sensor had solid fuel in its fuel slots, and if it ran out of solid fuel in all of its fuel-inventory slots while you'd use transport coal from A to B with this truck, it would take coal from its cargo to refuel itself (same thing goes for the ammo sensor). Would that really be a vanilla feature nowadays?

I'd love to see some more toggles for the various sensors. The one that comes to mind specifically is the enemy sensor...be able to shut it off without removing the sensor from the vehicle so it doesn't engage the enemy. Particularly useful for peaceful mode game runs. I haven't gotten that far yet, but the same could probably be said of the logistics functions. Knowing the issues I run into with the personal inventory when I forget to turn off logistics, I could see similar problems arising with vehicles.

Sorry, this will have to wait for some time. There's still a bugfix to release, which I can't do just yet because there's some functional thing I was already working on, so there's some code in my development version that doesn't work correctly yet. (It's about the actual driving -- accelerating to the max speed possible for a particular vehicle based on vehicle weight, friction etc. on particular underground already works, but last time I tried, determining the proper distance before braking still sucks. If the path has many curves a small distant apart from each other, the vehicle will come to a crawl. For the smaller bugs, there are solutions posted in the respective threads, though.)

Anyway, some weeks ago I still had a lot of time for modding due to the lockdown, but now I'm very busy with work in real life, and I've also other mods to take care of. I'll try to get another working release out before 1.0, but it may still take some time. I'd rather postpone working on this request until Factorio 1.0 is out. GUI related stuff is rather tedious, this one is the only of my mods so far that has one and after some time off from working on it, I've to read up on a lot of stuff again. Another concern is that the GUI may become too big to be practical. It may be OK with only one or two vehicles, but if you'd have 10 or more, it will take up a lot of space vertically -- and adding more and more buttons to it may extend it to a point where a big screen area is hidden. That may be OK for mods like Helmod, where you're taking time away from building while planning the next production line, but it would be bad if you'd want to have an eye on all your vehicles while driving one.

If you ever take it farther, I wouldn't mind seeing more functions for automating vehicles such as schedules or some other way of easily telling a vehicle to travel between 2 or more points. In short I guess it would be the AAI Programmable Vehicles mod (from what I've read about it) but without all the extra stuff. I actually downloaded it, but disabled it because I didn't want it modifying all the vehicle recipes and performance in my game...I just wanted the programmable functions so I could make some non-train based delivery routes. Yours looked promising and I think it will work, but seems like it is going to need a lot of circuit work. (I think I will be able to find other uses for it if I don't end up using it for what I got it for.)

That's the reason I opted for Autodrive instead of AAI myself -- AAI was too overwhelming, but being able to program routes with the circuit network appealed to me. However, I never had the chance to really try it out yet (modding is my game now), so I'm not sure if it would meet my expectations. Anyway, there's already a request for a destination list that I want to implement (which would take up some more screen real estate). Perhaps that would help you?

Speaking of unwanted performance, I read the thread on the GCKI mod pop-up. I appreciate that you made it so it isn't going off all the time, but I have to agree that it is basically an ad and for what I have seen of the game and other mods, I personally find it inappropriate and intrusive and is my one actual complaint. If you think they go together that much, just roll the code into Autodrive as an optional function (so I can turn that segment on or off in the mod settings if I don't wish to use it) and be done with it.

No way! The control script of Autodrive already is a monster with 2000 to 3000 lines of code, comments, and white space, and GCKI has more than 1000 lines as well! I really should restructure everything at some time, but if I were to add all of GCKI to this mod I'd go insane -- and then I wouldn't be able to fix anything anymore. :-D

Otherwise, just make it an optional dependency.

Impossible, unfortunately, for historical reasons. GCKI is my very own mod. I wanted to make it compatible with Autodrive because I used both in my own game, and fixed some bugs in Autodrive on GCKI's end, so I had to add a dependency on Autodrive to GCKI. Much later, dorfl (the original author of Autodrive) transferred ownership of this mod to me. Adding a dependency on GCKI to Autodrive doesn't work because that would introduce a circular dependency and Factorio wouldn't load, but of course I also wanted to promote my first bigger mod… But I'll let you in on a little secret! Open control.lua and comment (put "--" without the quotes at the start of the line) or delete lines 102-103, like this:

    -- log({"AUTODRIVE-misc.no_GCKI"})
    -- game.print({"AUTODRIVE-misc.no_GCKI"}, {r = 1, a=.1})

That will remove the messages for good. I hope that helps!

3 years ago

As for the auto reload function from the trunk for ammo and fuel, yes, that is vanilla now...at least ammo is. I honestly haven't verified fuel, but I'm pretty sure it is now too. I also didn't check to see if it would switch types when I tested. I had the same type ammo in the trunk that I had loaded for use.

Totally get the work part. Certainly don't expect them to be instant changes if you choose to implement them at all. I also actually found the line in control.lua and commented it out already too. In the process I saw all the lines of code for GCKI. Not doing much myself yet besides tweaking some existing mods for my personal use for errors the devs haven't fixed yet or things like recipes I disagree with, I don't know what's involved with a full on build. There was so much there already though my first thought was "why isn't it just part of the mod?" Not really sure I'd use it, but at the same time it would solve the problem it was designed to...walked too far or "took the train" and the train left so now I'm stuck walking back to base. I think it is the "teleport" part that is holding me back. Mods by definition are cheats as they are outside normal game play, but for the most part, they all seem to add new things to be able to do additional stuff, not cheat the game. I've been staying away from the "instant" transport mods so far though because that does seem too cheaty...part of the fun, for me, is figuring out the logistics. Having stuff just appear between point a and point b defeats that for me. Then again, with the limits you placed, it is mostly just that initial get the vehicle to you. I'll probably download it eventually...I do keep looking at it. Anyway, I digress...

Thanks, and if I think about it, I'll test out the fuel generally and auto switching fuel and ammo types with the vanilla game and get back to you. I'm usually pretty good about making sure I have proper fuel and ammo supplies, but if the vanilla version won't auto switch types, this version could still be useful.

3 years ago

Apparently I was wrong...upon further testing it seems it was auto reloading ammo from the player inventory and not the trunk like I thought it was. And fuel didn't seem to auto reload at all. Now that makes sense to still have them.

3 years ago

Is there a setting somewhere for the gate sensor range? Aside from some strange pathing (though not entirely unexpected...gonna have to get creative with some waypoints I think) I was able to fairly easily setup my routes. One of the key things I had to do was set up a "garage" to force the car into a specific position for the inserters. (Couldn't use logistics because requester and provider are dependent on which end of the trip it is.) I don't suppose I needed them, but I went all out and put gates on them. The problem I'm now having is the cars have a tendency to driver faster than the gates can open with the current settings. I actually don't mind so much as I actually kinda like the fix I came up with and might do it anyway, but I thought I'd still double check if it was normal. (my fix, btw, was to place some "slow" concrete at the entrance of the garage to slow down the car as it approaches giving the gate time to open. I'm looking into Dectorio for the looks, but currently I'm using Shinys Parkingzone.)

I'm just using the vanilla car with solid fuel. Coal seems slower enough I haven't run into a problem. I'm pretty sure I tested with coal before switching to solid fuel but if I didn't I have a second route currently powered by coal till it runs out and switches to solid fuel I've had no problems with. Granted I also had already found and corrected the issue in the garage build so I may have just not noticed. I would assume "faster" fuels would compound the problem, but I haven't put any of them in my vehicles yet...I have enough problems going left when I want to go right because I'm driving backwards and/or "upside down" I don't need to add more speed to the mix yet. :)

3 years ago

Apparently I was wrong...upon further testing it seems it was auto reloading ammo from the player inventory and not the trunk like I thought it was. And fuel didn't seem to auto reload at all. Now that makes sense to still have them.

OK, thanks for checking! It's not that I couldn't have missed something… But auto-reloading of ammo -- is that really a vanilla thing or could that come from another mod, e.g. Fill4Me?

3 years ago
(updated 3 years ago)

Is there a setting somewhere for the gate sensor range? Aside from some strange pathing (though not entirely unexpected...gonna have to get creative with some waypoints I think) I was able to fairly easily setup my routes. One of the key things I had to do was set up a "garage" to force the car into a specific position for the inserters.

Interesting! Last time I played, I entered my truck, let Autodrive go to my BI outpost, manually aligned it with the inserters, did some building there until it was loaded with coal, and sent it back to the main base for unloading. (Side note: GCKI was really useful in that situation because I could just summon my normal car to the outpost, fill it with some more coal, enter the car, and use Autodrive to drive back to the truck. With this play style, it really makes sense to use both mods. That's another reason why I implemented the "advertising" -- it really made sense for the way I was playing, so it seemed just natural to recommend GCKI: I needed to recommend it, I couldn't add a dependency because of the circular dependency issue, and I couldn't assume that really everybody installing this mod would also go to the mod portal and read the entire text on the info page. So a nag message on starting or resuming the game seemed to be reasonable. I believe with the changes suggested here, this will be acceptable. Making compromises is a huge part of modding -- you can only work with the tools that are available, but there are limitations you have to work around in strange ways. It may be impossible to avoid unwanted behavior completely, and the best one can do is to minimize the impact of including a feature.)

Anyway, would you be willing to share a saved game? I'm definitely interested in how you got positioning your car next to inserters working. :-)

(Couldn't use logistics because requester and provider are dependent on which end of the trip it is.) I don't suppose I needed them, but I went all out and put gates on them. The problem I'm now having is the cars have a tendency to driver faster than the gates can open with the current settings. I actually don't mind so much as I actually kinda like the fix I came up with and might do it anyway, but I thought I'd still double check if it was normal. (my fix, btw, was to place some "slow" concrete at the entrance of the garage to slow down the car as it approaches giving the gate time to open. I'm looking into Dectorio for the looks, but currently I'm using Shinys Parkingzone.)

I'm aware of the problems with logistics, and I agree that manually toggling the inventory slots for loading/unloading isn't practical. I haven't come up with a good solution yet. dorfl suggested automatically toggling the slots' state based on underground (e.g. a vehicle that's stopped on hazard concrete would request items in the marked slots while a vehicle stopped on refined hazard concrete would provide them). Sounds good, but there's still the problem that inventory slots can only have 2 states (reserved for one item, and accepting all items). I'd need another state (ignored by logistic bots), or bad things are bound to happen: Assume you want your car to pick up iron plates at A and unload them at B. So you'd mark some slots to request iron plates and bots a A deliver them. At B, slots are toggled, so the iron plates are taken away -- but now everything in the other slots is regarded as a request! You then go back to A and request iron plates again. Anything else is regarded as "provided", so the bots take away all the ammo and fuel from your trunk -- that's definitely not what you want! I really should make a request for an "ignored by bots" slot setting …

Regarding the gate sensor, the way the sensor works is this: On each tick, if a vehicle has no human driver, and if a gate sensor is installed, or if an enemy sensor is installed and enemies are in range, a dummy character will be placed into the vehicle. Gates react to characters, so if a vehicle with any character (controlled by player or a dummy controlled by script) is in range, they will open. At the end of the tick, the dummy will be removed again. So the gate sensor itself doesn't have any influence on when the gates open. The only thing I could do is to change activation_distance in the gate prototypes. But that would have to be done on loading Factorio, in the data stage. You wouldn't be able to change the distance during the game, e.g. when you've switched from coal to solid fuel. Also, other mods may add gates (usually no problem) or change the settings of gates (could be a problem if they are loaded after Autodrive and overwrite the changes I've made).

3 years ago

I'd be willing. Just pardon any "what was this guy thinking" stuff. It's my first base. I have started a couple new games, but I keep this one around to test things on (like new mods) and generally see where I can ultimately take things. Here you go...https://www.dropbox.com/s/8o5sa6obczdzasn/Freeplay%201B%20with%20Mods.zip?dl=0

If you don't have all the mods, it shouldn't break things too bad. I haven't figured out importing and exporting blueprints yet or I could probably just send you the blueprints too. There isn't much special to it. It is a 5x6 minimum box with walls around it (and a gate, primarily for looks, on one end as I mentioned above) I set the X,Y coordinates to be more or less in the middle of the box. The 5 wide is important so you end up with a 3 wide channel the car pulls into. The 6 long dimension allows for "drift" in the coordinates. Might be able to go smaller, and obviously longer is ok. (If you're using a longer vehicle, you may actually need to go longer.) Once you figure out where the car actually stops along that channel, there should be at least 2 tiles, possibly 3 per side where an inserter will repeatably line up with the car. (Inserters will replace wall segments and be "in" the wall.) If the car doesn't path to a point inside the walls, adjust the X or Y coordinate by 1, usually in a direction opposite where the car pathed to.

I used the Markers mod you recommended to get the coordinates...just had to manually update it to work. (I saw a comment I think was from you in the discussion for it mentioning some other issues, but for me I just needed to change the info.json to say 0.18.) Practicaly, it then took a little finesse to actually get it to path correctly. If you have or download the mods and dig that deep and figure out my logic, you'll notice that the X,Y values I send or read and the X,Y values on the markers don't always match. For some reason, the way it reads and/or rounds values, it would sometimes register as being off by a tile. To put it another way, the point on the car where it reported the location from and stops the vehicle seems to change depending on the direction . It does at least seem to do so repeatably. I saved the game centered on the east side of my base as that one is much simpler and working better (it will actually path more or less on a straight, logical line.) On the west side of my base is another one with all the waypoint logic I devised and you can see this in action more. That one, if you figure out the logic, I would send it one set of coordinates, it would go there, but to register it's arrival I would as often as not have to adjust either the X or Y coordinate (technically reading the V and W values) by 1.

In the end, not 100% happy with the results, but I don't think there is anything specifically related to your mod and it IS working. There is just so much delay in the pathing process it ends up being 10 mini routes instead of 1 route with 10 waypoints. Without it though, if I tried to go directly from point A to point B, it had a tendency of pathing along the tracks in one direction and the car would keep getting hit/killed by trains. Even with the waypoints it doesn't always take the most logical (direct) path which is why I had to add the walls next to the tracks at the depot garage...the only value that changed between 2 of those points was the X value but it still insisted on driving up on the tracks first instead of straight across.

I'm assuming not, at least not without a major rebuild of the mod which we've already discussed, but I was wondering if there might be a way to maybe incorporate Pavement Drive Assist or something similar to somehow have it path along a road instead of based on the pathing engine. Pavement Drive Assist I know doesn't work right now even with me along for the ride. (Wasn't expecting it to, but tried anyway.) I just downloaded it while I was working on the waypoint logic and I haven't tried doing anything with it yet, but Asphalt Roads (a Mod recommended by PDA) looks like it has some AI functions to it though it also seemed more automation of a player based driver than full autonomous vehicles. Earlier today I also found Transport Drones. Has some drawbacks for my current play style, but seemed like it could also do what I'm ultimately trying to do for the more complex paths.

3 years ago

I'd be willing. Just pardon any "what was this guy thinking" stuff. It's my first base. I have started a couple new games, but I keep this one around to test things on (like new mods) and generally see where I can ultimately take things. Here you go...https://www.dropbox.com/s/8o5sa6obczdzasn/Freeplay%201B%20with%20Mods.zip?dl=0

Thank you, I've got the file and will try it out tonight. Nothing to worry about "what was this guy thinking" -- I guess my own base would make you think the same in a lot of places. :-)

If you don't have all the mods, it shouldn't break things too bad.

I should be able to get them by syncing with your saved game -- unless you had to change mods yourself to get not-updated ones to work with Factorio 0.18.

I'm assuming not, at least not without a major rebuild of the mod which we've already discussed, but I was wondering if there might be a way to maybe incorporate Pavement Drive Assist or something similar to somehow have it path along a road instead of based on the pathing engine.

I know about PDA and Asphalt Roads, and of course I'm aware of Autodrive's pathfinding issues. It's really not logical that Autodrive would decide to send vehicles along a route through rough terrain if there already is a nice road just some tiles away it could use instead. But I'm not sure how to get these mods to work together as they are completely different: Autodrive works on a macro level (find a path from one point to a destination that may be on the other end of the map), while PDA uses micro management (look for asphalt tiles a short way ahead of the vehicle).

Earlier today I also found Transport Drones. Has some drawbacks for my current play style, but seemed like it could also do what I'm ultimately trying to do for the more complex paths.

I haven't looked at its code yet, perhaps I should. As it's one of Klonan's (i.e., a Factorio dev's) mods, I guess there may be some things I could learn from his code.

3 years ago
(updated 3 years ago)

Still researching things to see if it is a mod conflict and if so, which one (I've been getting a lot of similar oddities with some of my mods lately...backtracking them to see if I can determine when everything starts working normally) but having some issues with the Follow Sensor functionality restoring on a game reload. Seems to be car based. I had some other thoughts based on early testing, but in my current testing if I reset the car by say loading it onto a vehicle wagon and then unloading it, functionality of the sensor seems to come back regardless of where I have the sensor when loading the car (earlier testing I thought it was the actual sensor as I built a new one and it worked, but I couldn't repeat that and it occurred to me I had placed the new sensor in a car that didn't have one when the save was loaded.)

Any immediate thoughts you are already aware of while I research to maybe point me towards something? If I find something definitive in terms of "it happens repeatably when I load this mod" I'll also let you know...maybe something you can account for work with the other dev on.

3 years ago

Didn't find any mod conflicts yet. I found a different one between Dectorio and Long Reach, but nothing with yours and I ended up going back to a save with no mods installed so it is just the base, yours, and the shortwave dependency. Thinking you may already know at that point in which case I apologize for "stating the obvious"...

What I did discover is that the status of the follow enabled or disabled, seems to be what's getting stuck. If I save the with follow disabled, the car comes back stuck in disabled when the save is loaded. If I save in enabled, the car comes back stuck in enabled mode. I also discovered that it is the process of removing the car from the Autodrive list that is what resets it to normal control. I thought I had done that already, but I'm not so sure now.

New response