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
2 months ago
0.17 - 1.1
2.98K
Transportation Combat Logistic network Circuit network

g [Pending] Max speed limited to 100km/h?

4 years ago

I'm using this alongside the Aircraft mod and it seems to be limiting the speed to just under 100km/h, instead of the max of 280km/h~. Is there something limiting the speed in the code that I could edit? Not exactly a programmer but I fix it locally if pointed in the right direction.

https://mods.factorio.com/mod/Aircraft

4 years ago

Sorry, can't answer that right off the top of my head. I'm currently busy working on two other mods already. Can't afford to get distracted even more, otherwise nothing will ever be released. But I'll look into that soonish! (Actually, looking forward to get back to work on Autodrive again.)

4 years ago

I'm using this alongside the Aircraft mod and it seems to be limiting the speed to just under 100km/h, instead of the max of 280km/h~. Is there something limiting the speed in the code that I could edit? Not exactly a programmer but I fix it locally if pointed in the right direction.

There is indeed a speed limit of exactly 100km/h (or whatever the unit may be). You can find it in control.lua if you look for this:

--------------------------------------------------------------------------------------------
-- rails was out of scope here (Pi-C)
--------------------------------------------------------------------------------------------
if range > 8 or rails then
speed = 100
elseif range > 4 then
speed = 50
end

It should be in lines 1554-1561 (version 0.2.1) or 1490-1497 (version 0.2.0).

https://mods.factorio.com/mod/Aircraft

I wonder if it would make sense to exclude aircraft from all these checks. Never used them for real before (just installed the mod for some minor testing). That particular code seems to set the usual traveling speed to 100 (or the speed if a train is in the vicinity); if a waypoint (where the vehicle will change direction) is near, the vehicle is slowed down to 50, so it can turn more easily.

That is useful for vehicles driving on land (slowing down before a waypoint is reached may be useful for aircraft as well), but flying aircraft don't have to care about train collisions. The exception may be aircraft parked somewhere, or aircraft preparing to take off. So I'll have to think some more about whether it's worth the trouble to exclude aircraft from this check (handling all exceptions will make the code more complicated). But thanks for bringing this point to my attention! :-)

4 years ago
(updated 4 years ago)

Speed it still limited in the new version :(
Here I go patching again.
P.S. mod crashes now without GCKI

4 years ago

Speed it still limited in the new version :(

I'm sorry I can't do everything at once. Unfortunately, there are only 5,184,000 ticks in a day …

P.S. mod crashes now without GCKI

Yes, I noticed (Or was there already a bug report? Not sure…). It's fixed for the next release, which should drop still today. Testing takes time, though, because I have to test for Autodrive alone, GCKI alone, Autodrive+GCKI, Autodrive+GCKI (removing Autodrive), and Autodrive+GCKI (removing GCKI) -- and I have to test for Factorio 0.17, Factorio 0.18.1-26, and Factorio 0.18.>=27 to cover all bases. In an ideal world, I'd have the time to do all this both in single player and multiplayer mode, but as things are, I can only manage to test multiplayer for some of these cases and hope that it will work in the others as well. I won't even mention that MP testing slows everything down considerably because of two Factorio instances running simultaneously on sub-optimal hardware …

4 years ago

I'm using this alongside the Aircraft mod and it seems to be limiting the speed to just under 100km/h, instead of the max of 280km/h~.

I've played around with this last night, and I must confess: It's quite tricky! There are two major problems:
1) Determine if a vehicle is airborne.
2) Determine the maximum speed a vehicle may run at.

There is a render layer "air-object" that' used by the prototypes of Aircraft, Hover Car, and Dirigibles. Helicopter Revival doesn't use it though. Instead, it just defines an empty collision mask -- which the Dodge Challenger also does. So neither the render layer (which can't be accessed in the control stage anyway) nor the collision mask are sufficient to reliably identify an airborne vehicle.

There also is no indication of the maximum speed a vehicle may move at, one can only access the current speed. Traveling speed must be balanced. It wouldn't help to hardcode one value. The cargo plane from Aircraft seems to have a top speed of about 100, so it shouldn't become faster; but 100 is too low for a jet (I've got a top speed of about 770 with rocket fuel -- but that was a testing setup with Creative Mod, and that may have falsified the result).

The only way to make this setting versatile (so that aircraft from other mods can also use it) would really be a hard-coded list of prototype names and the top speed (perhaps also the speed it slows down to when approaching a waypoint). The top speed should be capped to about 300. Flying the jet, I noticed that the top speed really is too high! The minimap was black because I was flying faster than the game could generate the chunks I've moved over. That should be avoided.

If you can compile a list with reasonable values (you're the expert, I've never used the Aircraft mod in a real game), I'll try if I can implement this.

New response