-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record path then take it (again and again). #74433
Comments
I really need to do something else.... but.... |
There more discussion of this on Discord: https://discord.com/channels/598523535169945603/598529174302490644/1249842203056930826 |
This would be wonderful. Yes! The ability to create a path using intermediate points that you walk through. The old AD&D CRPGs like Baldur's Gate had pathsetting features like this, where you'd right-click in a sequence and your character would walk in optimal sub-paths to all those points. You know, this reminds me. Vim has a feature where it records keystrokes into macros. You can play the exact keystrokes back by invoking the macro. If you were implement it this way, you wouldn't have to rely on pathfinding; but you would be at the mercy of your own macro definitions, if you know what I mean. Not only walking, but also other repetitive activities could be handled this way. Just a thought. |
My current local implementation records the tripoints you step on specifically. I don't want to get into the weeds of key recording. I want it simple and bug-resistant. This also allows for some QoL optimizations that you couldn't get with plain key recording (the loop detection). I hope to make a PR today (at least a draft). |
I am not implementing any visuals to the path. This PR displays NPC path on overmap, maybe I could steel from it: |
If anyone has suggestions for keybinding to open the menu, I am all ears! |
Is your feature request related to a problem? Please describe.
TL;DR: I want to record the perfect path from a mine entrance to the bottom, then take it.
Long version:
I want to take the path I took last time and I want to spend as little IRL time as possible. I know the path by heart. Just follow the rails on the right and step aside when pit ahead. I would like to input this path once and let the game travel me to the end. Failing that, I am punished by falling into a pit because I don't want to tediously press the keys, I am bored doing it the 10th time. Realistically, my character would remember. I would remember IRL if I might fall into a pit. But I have 0 adrenaline sitting behind a keyboard pressing keys. It is a game. Let me do the fun stuff. Not the travel to stuff.
Existing solutions.
auto-moveAuto travel mode. It avoids puddles and such but is sometimes flat-out weird. Sometimes when the tile to the right is clear, you press right and the character goes down. It also is not good for spirals. Mines (the two I found) are spirals.Solution you would like.
Record a path:
tripoint
to the end of the vector.Walk the path:
Starting the auto walk: I imagine this like with auto hauling: the player presses
\
to open a menu and\
again to haul all items under their feet. Just like that, I want a double press to start walking.You could make four points in front of your base, each of them leading you all the way to a different place. Or maybe make a decision at each crossroads. Both would work.
I said player, I meant
Character
. Let's implement it for theCharacter
right away. It might be useful later.Quality of life.
When recording a new path: Going back to a tripoint you were already on, delete the loop you made.
Example path. Green is the final path from start to end. Red are the deleted loops. Pink is near a path that was already taken and it is in the final path.
The loop is deleted the moment you step to a tripoint you already were on.
Activated with a checkbox in the menu (on by default).
An example when you don't want to delete a loop: you are grabbing a vehicle and you need to turn it around.
Possible optimizations.
Don't store each tripoint. We can skip straight lines or other such easy things.
Or don't store tripoints at all. Just directions (example path: north, north, up a z level, south-west). Which is 10 bits instead of whatever the size of a tripoint is (I assume 3 x 32 bits).
Currently I implemented a vector of tripoints. To find a loop, we don't need to search the whole vector. The character in one step can (at maximum) increase/decrease z level by 1, or go diagonally. Look at one point at index
i
, count the distance from the new pointdist = abs(z1-z2) + max(abs(x1-x2), abs(y1-y2))
. The new point cannot be at indexesi-dist+1, ..., i+dist-1
. So skip those in loop checking. In case of straight path, this makes search closer to O(1) than to O(n).Describe alternatives you have considered.
Walk the path step 1.
Additional context
No response
The text was updated successfully, but these errors were encountered: