Page 1 of 1

Roads/streets as steering guide. Cars will try to stay on it

Posted: Wed May 06, 2015 3:17 pm
by tobsimon
In my base, I refrain from using the car. Because I embarrassingly always crash into stuff. :oops:

Think of streets as soft rails. You can leave them, but normally you stay on them.
If you are on a street and don't heavily steer to either side, you will stay on it. It should feel like the car has a steering guide, which keeps you on the street. Even in curves, but with limitations. In sharp curves at high speeds you have to steer, the steering guide won't manage alone.

How would it work?

Street tiles are 2x2, just like rail. Tileable, merging to an arbitrary large street surface. Curves and diagonals should be smoothed, I'm not sure how yet.

Steering implementations tend to define a virtual steering axle. There is a point in front of the car towards which the car drives (basically the angle of the front wheels). At high speeds the point is further away from the car than at low speeds. When you steer this point is moved some fixed distance out of the center line to one side. So at high speeds, your turns will have a bigger radius. This point is very much a physics object. It has inertia and your steering input executes force on it, counterd by a spring force pulling it back towards the center line. The steering guide also executes a force on this point, pushing it away from the edges of the road. Simple, isn't it?

How hard should it push? Not to hard, so you can break free, but hard enough to actually guide you. It should push harder the closer you are. This needs some careful balancing, so as not to bounce you away from the edge, but redirect you parallel to it.
Area of effect? Not really large. Discovery two tiles radius around this point should suffice.

This will make you want to use your car much more.

And it is the first step towards railless ground vehicle traffic in the base.


Details:
- A cobble road would only need stone and has low/no speed advantage.
- An asphalt street would also need some oil product and has a significant speed advantage.
- Maybe there should be some way to add street markings to define lanes and parking spots.
- The planes https://forums.factorio.com/forum/vie ... f=6&t=8955 need a runway. Runway lights extend this steering guide mechanism a certein length past the runway, to guide incoming planes.


Reference:
- Amit's game programming website with many ressources for steering behaviour, motion planning and obstacle avoidance
  http://www-cs-students.stanford.edu/~am ... eprog.html

Related:
- This recent suggestion wanted street tiles to mark a designated driving area https://forums.factorio.com/forum/vie ... f=6&t=9860
- Wish to use the mouse to better steer the car: https://forums.factorio.com/forum/vie ... f=6&t=6015
- Roads as a mid-tech logistics alternative https://forums.factorio.com/forum/vie ... f=6&t=1157
- Mod: RoadWorks https://forums.factorio.com/forum/vie ... =14&t=4405, and corresponding request https://forums.factorio.com/forum/vie ... f=6&t=1094,
  focusing on the aesthetics, and effects on speed.
- Something realated will probably be implemented for 0.12: https://www.factorio.com/blog/post/fff-67

Re: Roads/streets as steering guid. Cars will try to stay on it.

Posted: Wed May 06, 2015 10:34 pm
by lindenk
Sounds like a great addition. It would make getting around much easier (and less destructive) imo

Re: Roads/streets as steering guid. Cars will try to stay on it.

Posted: Thu May 07, 2015 6:34 am
by ssilk
Well, this is off-topic, but I want to point to a subject, cause they are a bit coupled: Transporting automated stuff. A new type of transport besides belts, bots and trains.

There are these threads, which do it by street: (that is because I mention it here)
https://forums.factorio.com/forum/vie ... f=6&t=7475
https://forums.factorio.com/forum/vie ... f=6&t=3072

And that streets will be in direct concurrence to the ropeway. https://forums.factorio.com/forum/vie ... f=6&t=7977

Again: Off-topic, just want you to throw a short eye on it, because it makes no sense to have automated transport by road AND a ropeway. But, ok, that thought is eventually too far. :)

Re: Roads/streets as steering guid. Cars will try to stay on it.

Posted: Thu May 07, 2015 11:23 am
by tobsimon
So here is a simple way to "smooth out" street tile edges for diagonals:
street edge smoothing mockup
street edge smoothing mockup
path5040.png (6.89 KiB) Viewed 5741 times
Every tile is only either street or not, and decides by neighbour lookup, what kind of sprite to display. The sprites for diagonal edges overlap their borders a bit.

Maybe there even is no real need for a more complex setup to allow rounder curves. The cars smallest u-turn diameter appears to be 5 tiles (slow speed), the largest 14 to 15 (over 100 km/h). The mockup has a diameter of 8 tiles (radius: 4).

But if we want another edge angle in between, say 22.5°, the half angle to the diagonal, then the gradients 1:2 (26.6°) and 1:2.5 (21.8°) are both good approximations. While 1:2.5 is the better one 1:2 is tileable, so probably preferable. Below is a mockup with the 1:2.5 gradient.
street corner smoothing mockup
street corner smoothing mockup
path5050.png (1.91 KiB) Viewed 5741 times
These gradients cause much more tile overlap and need a larger lookup area for formation detection

Re: Roads/streets as steering guid. Cars will try to stay on it.

Posted: Thu May 07, 2015 12:46 pm
by bobingabout
Interesting.

Re: Roads/streets as steering guide. Cars will try to stay on it

Posted: Tue Feb 13, 2018 11:21 am
by voddan
That would be a nice addition! IRL this feature is know as lane-keep assist, which keeps a car on a lane unless a bigger steering force is applied by the driver

Re: Roads/streets as steering guide. Cars will try to stay on it

Posted: Tue Feb 13, 2018 11:39 am
by eradicator

Re: Roads/streets as steering guide. Cars will try to stay on it

Posted: Wed Feb 14, 2018 11:44 pm
by FactorioParadox
Maybe have it as a toggle as opposed to being always on but allowing you to break free because with your suggestion it would still be possible to accidentally drive off the road.

Re: Roads/streets as steering guide. Cars will try to stay on it

Posted: Thu Feb 15, 2018 8:14 am
by Aeternus
Bit of a gravedig this thread. There's a mod that handles this by now, AAV.

[Edit] I do like the idea of an Asphalt surface. Stone (grind) + heavy oil (Tar) -> Fast surface. Will split that off into a separate suggestion.

Re: Roads/streets as steering guide. Cars will try to stay on it

Posted: Thu Oct 11, 2018 1:55 pm
by Joe78man
I would be happy if there was a key that when pressed the vehicle would adjust to the closest 45° angle. I often found myself turning left and right constantly attempting to straighten the car at top speed, sometimes crashing with a post or lamp or something just because it is not possible to make a minor adjustment at that speed.

How about asphalt, where vehicles have a speed (and break) bonus AND after 1 second it would align to the closest cardinal point, set every 45°? The break bonus is also necessary IMO

Re: Roads/streets as steering guide. Cars will try to stay on it

Posted: Thu Oct 11, 2018 2:16 pm
by xfir01
There's a mod that will do something similar to that. I pretty much need it to not crash into everything.

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