Car aligns to cardinal directions
Moderator: ickputzdirwech
- MalcolmCooks
- Filter Inserter
- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Car aligns to cardinal directions
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
Re: Car aligns to cardinal directions
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 )
(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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
- MalcolmCooks
- Filter Inserter
- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Car aligns to cardinal directions
Oh thanks for showing me this!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 )
Re: Car aligns to cardinal directions
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).
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).
Re: Car aligns to cardinal directions
As I previously suggested this, I wholeheartedly support it.
Driving in a tightly built factory is a complete pain.
Driving in a tightly built factory is a complete pain.
- MalcolmCooks
- Filter Inserter
- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Car aligns to cardinal directions
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
-
- Burner Inserter
- Posts: 19
- Joined: Thu May 18, 2017 2:32 pm
- Contact:
sticky car steering
When steering the car, can the direction be made a little sticky so that it's easier to go exactly north/south/east/west?
Re: sticky car steering
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.
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.
Please restrict vehicle moving angles some way
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.
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.
Re: Please restrict vehicle moving angles some way
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.
Re: Please restrict vehicle moving angles some way
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.
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.
Re: sticky car steering
[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
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.
Re: sticky car steering
Obviously, just snapping to angles is the easiest-to-implement of that requests (and VehicleSnap already implements it).
Re: sticky car steering
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 useOktokolo 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).
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.
Re: sticky car steering
Koub mentioned related requests, of wich i think, that they are not as easy to implement in vanilla, as vehicle snapping.Zaflis wrote: ↑Sat Nov 03, 2018 7:41 pmBut as i said, it's not implementing it "properly".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).
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.
Re: Car aligns to cardinal directions
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.
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.
- MoleOnDope
- Inserter
- Posts: 44
- Joined: Tue Jan 29, 2019 12:16 am
- Contact:
Re: Car aligns to cardinal directions
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
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
Re: Car aligns to cardinal directions
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.
- MoleOnDope
- Inserter
- Posts: 44
- Joined: Tue Jan 29, 2019 12:16 am
- Contact:
Re: Car aligns to cardinal directions
And in the linked post I explain a bit more in-depth why I dislike this kind of unnecessary workaround
But thanks for the tip anyway!