Car aligns to cardinal directions

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Car aligns to cardinal directions

Post by MalcolmCooks »

Playing with RSO mod I drive my car a lot before I have built railways, and with the new stone brick/concrete roads you can build in .12, the car is becoming more useful... but it's still very frustrating to drive! You usually want to drive in a straight line but keep having to correct the direction of your car. It reminds me of the original Grand Theft Auto game, which had very similar controls for driving. In this game you can direct your car any direction, but the roads only go north/east/south/west. BUT if your car is very close to driving in one of those cardinal directions then after a short while it automatically would align itself to the road so that you don't have to keep correcting your steering or crash into things. Could the same thing be implemented in Factorio? I think even though it's a little thing it would ivprove the driving controls a lot :mrgreen:
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Car aligns to cardinal directions

Post by ssilk »

Yeah. As long as it takes, use this mod: Better vehicle control https://forums.factorio.com/forum/vie ... =87&t=8976

(Which reminds me to go through all 0.11 mods, that are meanwhile converted :) )
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: Car aligns to cardinal directions

Post by MalcolmCooks »

ssilk wrote:Yeah. As long as it takes, use this mod: Better vehicle control https://forums.factorio.com/forum/vie ... =87&t=8976

(Which reminds me to go through all 0.11 mods, that are meanwhile converted :) )
Oh thanks for showing me this!
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Car aligns to cardinal directions

Post by orzelek »

It would be nice to have it in base game.
Using mod for this is a bit.. clunky.
Auto align of driving direction if it's near one of cardinals would be neat. (using 4/8/16 cardinals).
lancar
Fast Inserter
Fast Inserter
Posts: 158
Joined: Tue Dec 02, 2014 5:49 pm
Contact:

Re: Car aligns to cardinal directions

Post by lancar »

As I previously suggested this, I wholeheartedly support it.
Driving in a tightly built factory is a complete pain.
User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: Car aligns to cardinal directions

Post by MalcolmCooks »

Yeah, even if a mod exists to fix it, I still think this should be something in the base game. But in the meantime, I don't mind using a mod for it
mnicolella
Burner Inserter
Burner Inserter
Posts: 19
Joined: Thu May 18, 2017 2:32 pm
Contact:

sticky car steering

Post by mnicolella »

When steering the car, can the direction be made a little sticky so that it's easier to go exactly north/south/east/west?
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: sticky car steering

Post by steinio »

Image

Transport Belt Repair Man

View unread Posts
Tekky
Smart Inserter
Smart Inserter
Posts: 1040
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: sticky car steering

Post by Tekky »

I like the idea.

However, in the options menu, the player should be able to configure how close you must be to one of the cardinal directions for it to snap. By setting this value to 0, it would be possible to deactivate this feature altogether.
Zaflis
Filter Inserter
Filter Inserter
Posts: 514
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Please restrict vehicle moving angles some way

Post by Zaflis »

I'm author of mod Vehiclesnap, but i too have moments when i want to play just "pure vanilla" - no. mods. at. all. Let me show what i mean first:
https://www.youtube.com/watch?v=9X-4AqpFhUE

The controls are very touchy and it's almost impossible to drive straight along tracks, and that's even if the car sprite is pointing exactly downwards. There's always this little bit of sway to the side caused by angle being not for example 180 degrees but 178 or something. Closest sprite you can render is same as 180's, but game does no attempt to interpolate it to closest matching sprite angle over time (or any other form of "snapping").

What i did with mod is just that, 16 possible angles that car can drive to but i don't expect vanilla to work like that. It would likely be enough if just sprite angles were possible. And doing it in LUA is more performance expensive anyway than done internally. It's just a dirty hack. I even had to deal with issue where if i collided with water tile some not-yet-snapped diagonal angle, it would get stuck. The LUA code was trying to turn the car but it caused collision the moment car tried to move and hence causing it to stop. It was possible to remove the car with pickaxe and place it back down elsewhere. And because I solved that bug by only snapping in faster speeds, i couldn't allow it to snap when driving in reverse. That's because the speed when reversing with tank is so slow it is below the safe threshold.

So this really is a case that can't be left with modders hands. We don't have the means to do this properly, and your code would be faster and more failsafe.
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Please restrict vehicle moving angles some way

Post by Oktokolo »

Locking vehicle orientation to multiples of 360°/n (with n configurable to the player's taste) would indeed be a nice QoL improvement in vanilla.
Tekky
Smart Inserter
Smart Inserter
Posts: 1040
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: Please restrict vehicle moving angles some way

Post by Tekky »

This has already been suggested half a year ago in the following thread:

viewtopic.php?f=6&t=60395 sticky car steering

EDIT: Now that the threads have been merged, the link above is no longer valid.
Last edited by Tekky on Fri Nov 02, 2018 4:09 pm, edited 2 times in total.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: sticky car steering

Post by Koub »

[Koub] Merged into older topic with same or similar suggestion
There are also quite a number of requests for either :
- mouse control over direction
- following automatically the roads/stone paths
Koub - Please consider English is not my native language.
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: sticky car steering

Post by Oktokolo »

Koub wrote: Fri Nov 02, 2018 9:22 am There are also quite a number of requests for either :
- mouse control over direction
- following automatically the roads/stone paths
Obviously, just snapping to angles is the easiest-to-implement of that requests (and VehicleSnap already implements it).
Zaflis
Filter Inserter
Filter Inserter
Posts: 514
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: sticky car steering

Post by Zaflis »

Oktokolo wrote: Sat Nov 03, 2018 12:44 amObviously, just snapping to angles is the easiest-to-implement of that requests (and VehicleSnap already implements it).
But as i said, it's not implementing it "properly". I had to use the onTick event, so it's actually doing something 60 times a second even if just waiting for delay or someone to step in a vehicle. Checking events now, I should at least use
https://lua-api.factorio.com/latest/eve ... nged_state

And don't you ever want to play vanilla game, or join multiplayer with others? You can't demand everyone to play with mods, so you face the issue occasionally anyway. Actually with mods you face the issue even less because you don't need cars after your first airplane.
User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 884
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: sticky car steering

Post by Oktokolo »

Zaflis wrote: Sat Nov 03, 2018 7:41 pm
Oktokolo wrote: Sat Nov 03, 2018 12:44 amObviously, just snapping to angles is the easiest-to-implement of that requests (and VehicleSnap already implements it).
But as i said, it's not implementing it "properly".
Koub mentioned related requests, of wich i think, that they are not as easy to implement in vanilla, as vehicle snapping.
I am pro adding vehicle snap to vanilla and if they do it, they will do it right.
I mentioned VehicleSnap as prior art they could look at to see, how the feature could work from a user's point of view.

That said, obviously, checking vehicle orientation six times per second should be enough - you definitely do not have to do it each tick. And enabling the check only for vehicles actually occupied by a player, is a good thing too.
But the orientation of an entity (like a vehicle) seems to just be a float. Doing orientation = (floor(orientation / step) * step) should not be costly enough to have an effect on UPS even when doing it every tick for a hundred cars on a really crowded map.
Zaflis
Filter Inserter
Filter Inserter
Posts: 514
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Car aligns to cardinal directions

Post by Zaflis »

Ok now i don't mind if they implement it or not anymore. I spent all day updating VehicleSnap and i highly doubt there is too much left it can be improved on. I went as far as using the vehiclestate events and turn off onTick when it's not needed. With the backwards driving and per-player options it is in a very good shape.

How i avoided the getting stuck in slow speed bug then? The mod is tracking something like tiles travelled per second, not exactly but in idea. 1 tile is very short distance, so i just had to find low enough time frame that it has to travel at least 2 tiles to keep snapping on, else it drops to regular driving mode. Even that is using ingame's events for tile change, so i'm doing next to nothing in terms of calculation.
User avatar
MoleOnDope
Inserter
Inserter
Posts: 44
Joined: Tue Jan 29, 2019 12:16 am
Contact:

Re: Car aligns to cardinal directions

Post by MoleOnDope »

Since there's still a lot of experimenting left to be done in vanilla for me personally, I haven't used mods yet, so no "vehicle snap" for me. It does sound interresting with driving in the cardinal directions is frequently needed but pretty much impossible as of right now. However, I'm not sure if this might not annoy me sometimes, depending on the situation.
As an alternative, I found another suggestion here:

viewtopic.php?f=6&t=64257

It proposes the possibility to rotate a still standing vehicle to the four cardinal directions (beginning with the closest one) with the 'r'-Button, without the whole process of picking it up an replacing it.
I love this solution because it won't mess with the steering when you don't expect/need it to.
And moreover, it's 1000% more intuitive than giving the user another slider in another submenu to define a custom threshold, which would make sense... But also be kinda ugly :?
bobucles
Smart Inserter
Smart Inserter
Posts: 1708
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Car aligns to cardinal directions

Post by bobucles »

You can vehicle snap in vanilla by picking up the car and plopping it down in one of 4 directions. It's not perfect but it can be handy.
User avatar
MoleOnDope
Inserter
Inserter
Posts: 44
Joined: Tue Jan 29, 2019 12:16 am
Contact:

Re: Car aligns to cardinal directions

Post by MoleOnDope »

bobucles wrote: Fri Feb 22, 2019 11:57 am You can vehicle snap in vanilla by picking up the car and plopping it down in one of 4 directions. It's not perfect but it can be handy.
And in the linked post I explain a bit more in-depth why I dislike this kind of unnecessary workaround :D
But thanks for the tip anyway!
Post Reply

Return to “Ideas and Suggestions”