Page 1 of 2

[MOD 0.12.x] Pavement Drive Assist

Posted: Wed Mar 16, 2016 9:32 pm
by sillyfly
Type: Mod
Name: Pavement Drive Assist
Description: Assists in driving on paved roads
License: MIT License
Version: 0.0.5
Release: 2016-05-16
Tested-With-Factorio-Version: 0.12.33
Category: Helper
Tags: Car, Driving, Drive assist
Download-Url:
PavementDriveAssist_0.0.5.zip
(3.39 KiB) Downloaded 353 times
Website: This page
License
Long description
Pictures
Version history

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Wed Mar 16, 2016 9:59 pm
by bruteman
Interesting I have been looking for something like this but more along the lines of the Old 10.4 Bumpers mod : viewtopic.php?f=87&t=5127

as i currently line my railways with concrete on ether side (or floor tiles from Yuoki or roadworks etc.) and be able to place road bumpers down as a "road barrier system beside the rails. and if you could make this Multiplayer compatable it would be the cats ass!.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Thu Mar 17, 2016 4:00 am
by sillyfly
Thanks for the feedback!

Well, I have made it for single player only because that's simpler (no need to fiddle around with which player I'm looking at, etc). Also, testing multiplayer is much harder, and currently neigh impossible for me (my ISP has NAT at the ISP level, so I can't define port-forwarding).

Still, I think I have an idea of how to port it to multiplayer, so I may just do it and see if people are willing to try untested MP mod and report back if it misbehaves :D

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Thu Mar 17, 2016 8:23 am
by GotLag
A very interesting mod, it reminds me of how the cars used to smoothly snap your car to the road grid in GTA2, if you were within a certain angle.

I noticed sometimes on long straight sections of road the car oscillates slightly. Adding the following at the end stops that and doesn't appear to cause any problems with following irregular roads:

Code: Select all

car.orientation = math.floor(car.orientation * 64 + 0.5)/64
It snaps the car to the nearest 1/64th orientation. I also set the changeangle to 1/64 which isn't strictly necessary but nicely aligns with the sprite sheet's orientations.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Thu Mar 17, 2016 3:08 pm
by sillyfly
Thanks for the suggestion, I have implemented both changes.

Also, 0.0.2 should work in multiplayer. As stated, I can't really test it (other than hosting a game and playing on my own).
If anyone tries this mod in multiplayer I would appreciate it if you could come back and report if it worked or not :)

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Thu Mar 17, 2016 5:10 pm
by bruteman
sillyfly wrote:Thanks for the suggestion, I have implemented both changes.

Also, 0.0.2 should work in multiplayer. As stated, I can't really test it (other than hosting a game and playing on my own).
If anyone tries this mod in multiplayer I would appreciate it if you could come back and report if it worked or not :)

All right well I stream regularly and will test this live today for you if you want to see it in Testing or even join and be a tester you can find me at twitch.tv/thebruteman

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Thu Mar 17, 2016 5:23 pm
by bruteman
Tesing it now on livestream having a hard time figuring out how "wide" i need corners to keep it turning at any kind of speed.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Sat Mar 19, 2016 3:50 pm
by Murlocking
I have an idea for this mod, which would be really useful in some cases.

A toggle button to enable "Cruise Control", this way the mod is not always active and it's a bit easier to control.

I would also love if my car would just drive for me (hold the W key) while this button is active :D

I think it would be great, what do you think?

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Sat Mar 19, 2016 6:49 pm
by sillyfly
I'm looking into it :)

I seem to have a mostly-working logic for it, but I'm trying to see if it won't lag the game, as it needs to process at least every other tick to be usable (current version processes every 6 ticks).

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Sat Mar 19, 2016 7:56 pm
by sillyfly
I have uploaded a new version (0.0.3). Path-correction is much more aggressive (30 times per second as opposed to 10 times in previous versions). It should handle most turns quite well, see updated video demonstration.

On my testing setup it seems not to cause any lags, but if it does please let me know (preferably with attached save file too!)

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Mon Mar 21, 2016 11:58 am
by Murlocking
sillyfly wrote:I have uploaded a new version (0.0.3). Path-correction is much more aggressive (30 times per second as opposed to 10 times in previous versions). It should handle most turns quite well, see updated video demonstration.

On my testing setup it seems not to cause any lags, but if it does please let me know (preferably with attached save file too!)
No lag for me and my friend in Multiplayer, I was able to make a 1x1 road and 2x2 in some corners and the car will follow it with no problem.
It get a little shaky sometime but that's the realignment.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Mon Mar 21, 2016 5:31 pm
by sillyfly
Thanks for the feedback!
Nice to know it's working well in a real MP game.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Tue Mar 22, 2016 12:48 am
by Murlocking
sillyfly wrote:Thanks for the feedback!
Nice to know it's working well in a real MP game.
No prob!

I have a question and a request at the same time.

First the request.
I was wondering if it would be possible at some point to choose between Concrete or Stone brick roads for the auto-pathing in, let's say, a config.lua file.
I'm requesting this because some part of my best are grass, some near building are Stone bricks and my road are made of Concrete, it's a bit hard to navigate inside my factory with the vehicle because it sometime tend to be attracted toward the buildings.
Would love this feature :)

And now the question!
I've been working on updating and fixing/tweaking the Bulldozer mod and noticed that it would also auto-path on roads.
I would prefer if it didn't and I was wondering if you knew how I could modify that.

In the entity.lua of Bulldozer :
type = "car",
name = "bulldozer"

Is it because it has the type "car" associated to it?
Or do you call for the item name in the .lua?
I see "car" and "tank" in there.

I'm gonna try to add "bulldozer" = false and see if I can blacklist it.

If you know some magic tricks please share with me 8-)

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Tue Mar 22, 2016 1:36 am
by Murlocking
Murlocking wrote:
In the entity.lua of Bulldozer :
type = "car",
name = "bulldozer"

Is it because it has the type "car" associated to it?
Or do you call for the item name in the .lua?
I see "car" and "tank" in there.

I'm gonna try to add "bulldozer" = false and see if I can blacklist it.

If you know some magic tricks please share with me 8-)
That didn't work :(
Not sure what to do now.. there's not a lot of info on modding Factorio.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Tue Mar 22, 2016 2:53 am
by sillyfly
It's because I'm testing against type, when I should be probably testing against name. I will fix this and upload a new version later today, but in the meanwhile you can try to change, in line 24,

Code: Select all

vehicles[player.vehicle.type]
to -

Code: Select all

vehicles[player.vehicle.name]
As for changing pavement type - you can remove the type from `scores` in line 16, or set it's value to 0. You can even set the value to a negative number, which should have the effect of making the vehicle try to avoid these tile types.

I'm thinking of adding support to more tile types for mods, and if I do perhaps it would be a good opportunity to move the configuration to a separate file with proper documentation.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Tue Mar 22, 2016 4:25 am
by Murlocking
sillyfly wrote:It's because I'm testing against type, when I should be probably testing against name. I will fix this and upload a new version later today, but in the meanwhile you can try to change, in line 24,

Code: Select all

vehicles[player.vehicle.type]
to -

Code: Select all

vehicles[player.vehicle.name]
As for changing pavement type - you can remove the type from `scores` in line 16, or set it's value to 0. You can even set the value to a negative number, which should have the effect of making the vehicle try to avoid these tile types.

I'm thinking of adding support to more tile types for mods, and if I do perhaps it would be a good opportunity to move the configuration to a separate file with proper documentation.
Thanks man, you're always really fast on the replies :)
I will try these changes tomorrow and let you know how It went !

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Tue Mar 22, 2016 11:52 am
by Murlocking
Oh by the way, if you want to integrate some mod support for 5dim's mods, here's the item name for the Colored Concrete ;

5d-concrete-a
5d-concrete-b
5d-concrete-b2
5d-concrete-m
5d-concrete-r
5d-concrete-v

It's not necessary to have them in there but sure wouldn't hurt :P

I'm not sure about Bob's Mods and Dytech but they probably add they own roads aswell.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Wed Mar 23, 2016 12:07 am
by sillyfly
Uploaded version 0.0.4 -
Fixed that vehicles are tested with name, not type.
Moved configuration to config.lua, for easier tweaking and messing with values.
Added 5dim tiles (But not tested, so if it doesn't work - let me know).

I have tried looking at Yuoki and Bob's mods, but couldn't find where they add new tile types (if they actually have any). If anyone can point me out to where to look for them I'll add them to the default configuration.

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Thu Mar 24, 2016 2:47 pm
by Peter34
So this mod works on paled linear roads? But not really if you pave the entirety of your factory floor? Or what?

Re: [MOD 0.12.x] Pavement Drive Assist

Posted: Fri Mar 25, 2016 1:17 am
by sillyfly
Peter34 wrote:So this mod works on paled linear roads? But not really if you pave the entirety of your factory floor? Or what?
My idea was to make it easier to drive on "roads", so while you are driving straight ahead the mod tries to keep your vehicle on certain tiles (concrete and bricks for vanilla). This is done by comparing how many such tiles are straight ahead, and a bit to the left and right, and changing the orientation to the direction with the best score (most paved tiles).
This means if you are in a large paved area it will simply do nothing, as all directions are equally paved.

If you have a suggestion to a logic that will work in all-paved factories I'll be happy to try and implement it.