Replies: 19 comments 20 replies
-
How would you handle random events like hordes or the vehicle skidding in a replay? Stop the replay and ask the player to handle the situation? |
Beta Was this translation helpful? Give feedback.
-
With Phase 1 functionality the replay will stop if the vehicle goes off-course or is unable to maintain the recorded speed, which will happen if the vehicle hits anything, skids due to low driving skill, or runs out of fuel. If you see you're about to crash you can also interrupt with the skip-turn key. No way to resume, so you have to drive the rest of the way yourself, or go back to the starting point if it's closer and try again. In Phase 2 either safe mode or collision detection should kick in before you hit anything. The player can either stop and deal with the problem or drive around it, then resume. Existing auto-drive code will be used to try to get back on track, which may fail. [This answer is obsolete due to design changes on 6/28] |
Beta Was this translation helpful? Give feedback.
-
Note that unless your vehicle is completely symmetrical around the pivot point, a return path won't be identical unless you drive the whole distance in reverse gear. Thus, generation of a return path isn't trivial if you've got some tight spots along the path. My "standard" obstacle driving issue is bridges with vehicles forming an obstacle course where you have to move very precisely to get past without the swiveling causing the vehicle to swivel into either the railing or a blocking vehicle (often requiring a 30 degree angle movement so that you can move a tile sideways [eventually] while still having the vehicle oriented straight). |
Beta Was this translation helpful? Give feedback.
-
It might be easier to improve the auto-driving feature that already exists. Though I don't know much about AI driving. |
Beta Was this translation helpful? Give feedback.
-
some alternate solutions
|
Beta Was this translation helpful? Give feedback.
-
Right, that's why it's further down the list in Phase 2. Driving in reverse could work but is unrealistic (you wouldn't / couldn't actually do that IRL) so I prefer to find an algorithm that generates a forward-driving route back to the starting point. If the vehicle is not perfectly symmetrical and the route involves "tight spots" then the auto-generated route may cause collisions, which is why collision detection is higher up in the list.
|
Beta Was this translation helpful? Give feedback.
-
I'm considering converting this to a discussion. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
I just need a place to collect feedback and report progress. If it's customary to put feature discussions in Discussions these days, then by all means feel free to move it there. |
Beta Was this translation helpful? Give feedback.
-
Recording and replaying speed and acceleration would mean that you could run into issues if you load up additional materials in the car, as additional weight reduces possible acceleration. If you are too heavy, you may not replicate the path because you cannot not accelerate fast enough, if you are too light you may accelerate too fast and take sharper turns than intended, leading to offsets and crashes. Checking vehicle position at least periodically could alleviate this a bit, but then you deviate from the idea that you replicate the path using speed, acceleration and turn commands. Getting this as a working feature would be an amazing QoL change, but I believe getting this right even as a basic implementation is incredibly complex. |
Beta Was this translation helpful? Give feedback.
-
I agree with pehamm that a simple recording/replay probably won't work with any degree of reliability. Instead, a path probably would have to be recorded as a path the vehicle should strive to follow, and the recording process should probably also check the size of the space available to the path (i.e. width between fixed obstacles, room for turning at some maximum speed, etc. and generate a path flagged as either illegal or with a warning if sufficient room isn't available. It might be useful to have the usage of paths monitor obstacles to allow them to remove or add warning flags. It doesn't exactly seem trivial, as pehamm points out. |
Beta Was this translation helpful? Give feedback.
-
I finished a proof-of-concept implementation (record and replay). Video demos below (only for the replay part). Now that I've had a chance to mess with the autodrive code I think I can actually change it to avoid obstacles and to drive off-road. Recorded paths should only be needed for getting through tough spots, or maybe not needed at all. to_base.mp4from_base.mp4Also, yay for Github video uploads! Too bad the files have to be <10Mb. |
Beta Was this translation helpful? Give feedback.
-
Thanks to everyone who provided feedback so far! Please note that the design/plan has been changed completely, and the focus is now on fixing what's wrong with the current auto-drive feature. |
Beta Was this translation helpful? Give feedback.
-
Note, BTW, the very sensible D* idea - plan (if sufficient information is available) from the destination point backward, and keep some info from it so that, if you get diverted, you can use the stored information to quickly get going again. Your current point changes a lot more than the target point! |
Beta Was this translation helpful? Give feedback.
-
I finished implementing the obstacle avoidance code, using A* as the pathfinding algorithm. I gave up on the idea of using "perfect simulation" for the vehicle's motion (it seemed too expensive) and implemented approximate simulation instead. As a result, the algorithm is very fast (can't even notice any delays) and uses very little memory. However it also bugs out half of the time (deviating from the predicted path, which cancels auto-drive). In addition to fixing that bug I need to address some of the current limitations before creating a PR:
Anyway, here's a demo of the code in action. When it works correctly it's pretty impressive. roadblock.mp4I'll post a demo of longer-distance travel after I get the bug sorted. |
Beta Was this translation helpful? Give feedback.
-
The second PR (#50637) which fixes a few issues, mainly offroad driving, is currently under review. Videos on the PR page. |
Beta Was this translation helpful? Give feedback.
-
After playing around with this for a while, this is a total gamechanger. It is insane how much tedium this saves. I have two questions/suggestions: Any way to force the vehicle to use only streets would be nice. It is easy to clear out the main connecting streets so I can just send it out to a far-away point and ignore the game because I know it will take a path free of monsters. But with the new offroading, I have found that once the vehicle leaves the street, it becomes harder to predict which path it will take and leads to more disruptions because it tries to pass mass graves or similar densly packed areas. This could be a setting or just a heuristic to only path through streets if both start and end tiles are streets and they are connected via roads. Just a suggestion should this be easy to do. A bit more involved, are successive waypoints something that is feasible? This would allow to more explicitly chart paths that avoid uncleared map extras which I as a player am aware of, but the game cannot. In terms of interface, the current system could be tweaked to start setting waypoints with "W", finishing by confirming the last one with "W" and clearing with "Esc". That could make things even simpler. And thank for for the great work! |
Beta Was this translation helpful? Give feedback.
-
hello @eltank thank you for your work. I wanted to point out the enormous importance of your work, which you hardly thought about. the fact is that this project significantly improves the ability of blind people to drive vehicles in a cataclysm. I played cataclysm last summer and had a bike. even with legacy autodriving system, I managed to enjoy the game. I will be happy to check how pleasant it is to play now. |
Beta Was this translation helpful? Give feedback.
-
hey @eltank are you still working on this? I'm really enjoying the new features and i'm looking forward for the additional open tasks that still need implemenation :) |
Beta Was this translation helpful? Give feedback.
-
Adding autoguidance will immediately add a new problem, a huge number of map files. My cards weigh 1 GB each and it takes an unbearably long time to load the game. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Players that settle down in a base often need to drive repeatedly to and from far-away locations, either for questing/trading or for looting interesting locations (e.g. labs). Traveling to a new location for the first time can be fun because you have to find a good path and deal with various perils and obstacles on the way. However subsequent trips are usually either boring (repetitive key presses) or annoying (having to constantly avoid wrecked cars and boulders). I think some automation would be helpful here and the current auto-drive feature doesn't cut it (very poor obstacle avoidance, can't drive off-road and can't follow custom paths).
Describe the solution you'd like
I'm planning to improve the existing auto-drive feature in the following ways:
Obstacle avoidance / autodrive improvements
The main idea here is to
refactor the game engine a bit toallow simulating the position of the vehicle several [game] turns into the future, accounting for various amounts of steering at each turn. This can be used to compute a reachability graph containing all the positions that the vehicle can reach in the near future without colliding with anything.Dynamic programmingA* can be used to collapse the multiple paths that reach the same spot and use search heuristics such as "don't drive away from the goal".This needs to be re-evaluated every turn, butthe previously-selected optimal path should be cached and reused if it's still collision-free. Non-stationary obstacles (e.g. monsters) should be given a 1-tile buffer zone for the purposes of collision detection (for the immediate next turn only) since they can move into your path.The current auto-drive algorithm uses as a waypoint the midpoint of the edge shared by the current and next OMT (overmap tile) in the path. This may be infeasible to reach due to an obstacle at or near that point. To fix this, the plan is to consider all points along that boundary that can be reached and try to pick something that gets as close as possible to the middle.
Another problem is that avoiding obstacles is difficult when travelling at high speed. The new algorithm will drop the speed to the minimum value when it's not able to find a path at high speed and try to raise it back up after clearing the current OMT. Future improvements may drop the speed less (e.g. binary exponential reduction until a path is found or the minimum is reached).
PR #49772 [merged on 7/31/2021]
PR #50803 [merged on 8/17/2021]
Deferred tasks:
Overmap pathfinding and UI improvements
This is aimed at letting you autodrive to any place that you can reach via manual driving. It should also let you avoid driving through places that are blocked (e.g. fields that are covered by trees, roads that are blocked by large wrecks) or are unsafe (e.g. overmap tiles with lots of monsters).
PR #50637 [merged on 8/9/2021]
PR #50835 [merged on 8/21/2021]
Deferred tasks:
Recorded paths[scrapped]This was the main point of the initial proposal, but now seems unnecessary. Autodrive v2 has already proved capable of handling "tricky" paths well enough and Vehicle Avoid Zones will let the player teach the system to avoid navigation mistakes. Designated Parking Zones as well as overmap UI changes to toggle OMT drivability should allow for plenty of path customization.
Tasks:
Add "Record path" to vehicle driving menu. Record position, heading and speed at each game turn. Stop driving also stops recordingAdd "Replay path" to vehicle driving menu, replay a previously recorded route. Requires starting from the same starting position. Can be interruptedSerialize recorded paths to JSONOptimize the path representation for memory and disk spaceChangedo_autodrive()
to prioritize paths that follow the recorded pathChange autodrive overmap pathfinding to consider (and prioritize) OMTs that have recorded paths on themZone manager integration to allow viewing and deleting recorded pathsAs an alternative to all of the above, it may be enough to simply use the Zone manager to add autodrive hints at the sub-map level (spots that pathfinding should prioritize routing through).[Checked items have been implemented but not necessarily turned into PRs.]
Describe alternatives you've considered
Instant fast-travel (teleport player and vehicle to destination + advance time). Very easy to implement but there's no way that would be approved, right?
"Fast-travel by teleportation is pretty much off the table. if we do it, it’ll just be continuously auto-moving, possibly skipping some redraws to speed things up." -- Kevin Granade 2015
An earlier design was built entirely around recorded paths (see above), going all the way from the player base to some far away destination. Abandoned because of poor usability, versatility and discoverability.
Additional context
This will probably take weeks or months to do. If anyone wants to help implement any of this I am perfectly willing to collaborate.
Has this been suggested/attempted before? I tried a few searches but didn't find anything on github. I did find some stuff on discord but very old. [1] [2]
[Initial proposal on 6/23/2021, rewritten on 6/28/2021 as "v2" and further refined on 7/8/2021 as "Autodrive v2"]
Beta Was this translation helpful? Give feedback.
All reactions