Skip to content
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

[CR}Simple vehicle auto-driving #31978

Merged
merged 3 commits into from Jun 30, 2019

Conversation

Projects
None yet
9 participants
@davidpwbrown
Copy link
Contributor

commented Jun 29, 2019

Summary

SUMMARY: Features "Activity to auto-drive simple road routes"

Purpose of change

An Activity whilst in charge of a car - open overmap and select destination, like the overmap auto-walk, will only preview route if destination is on a road though.

Vehicle will then attempt to drive there automatically.

Describe the solution

Vehicle will have a set of omt path points.
It finds the next point which is on the shared border of the current and adjacent overmap point, ( thanks to OrenAudeles for some Amazing Algorithmical Assistance ) and paths there in a loop with pldrive()

Caveats : It's a bit dumb - it will just simply stop if it encounters an obstacle or a part gets damaged.
It cant avoid obstacles. it will stick to a fairly low speed.

It still can basically, without much input, make it far less tedious to travel a long road journey that you know is clear ( maybe you pre-cleared it )

[CR] because , I dont know for sure if I've got the tileray stuff down completely, where it pre-checks for potential collisions ahead of its proposed angle, sometimes it finds a tree near the corner of a road and stops, and its beyond me I think to tweak it any further when I dont really know what Im doing with it.

secondly - the turning is a bit last-minute - the centre-point of the vehicle gets to the point at which the road turns, and then the vehicle hs to turn drastically to align with the diagonal - A very long vehicle would certainly smash into trees as it turned in.

Hoping maybe someone can help tweak the algorithms here, but if not, its semi-usable and perhaps has some utility under controlled road conditions.

Describe alternatives you've considered

N/A

Additional context

Heres a GIF of the auto-driving

You can see it leaves the turns a bit late . https://gfycat.com/fatallightheartedarkshell

davidpwbrown added some commits Jun 29, 2019

path
test

wtf

added overmap selection for vehicle path

got maintain speed working and no infinite loop

first attempt at tileray obstacle forward detection

check vehicle obstacle

finalized algorithm and rotated tilerays

tweaks to detect distance

remove debug messges and lower speed
@Inglonias

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2019

Even what you have here is really impressive. Wonderful stuff.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 29, 2019

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/player-overmap-autotravel/20572/26

@OrenAudeles

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2019

awwww yiss this looks (ignoring the overshooting) great! :D 👍

@kevingranade kevingranade merged commit dc2cc10 into CleverRaven:master Jun 30, 2019

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
gorgon-ghprb Build finished.
Details
@paulenka-aleh

This comment has been minimized.

Copy link

commented Jul 1, 2019

Looks impressive.

A question I have in my mind: should this be interface feature like now or rather a vehicle autopilot (e.g. robot controls + sensors + tracking device)?

@ProfoundDarkness

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2019

Maybe instead of taking this away from the player (without such toys) we could instead extend this to robotic controls and such. That way if you don't have robot controls installed you can still have this auto driving take place. Meanwhile those who have such robot controls installed can sit back and let the car drive itself while they do something else, like read or play a game or something (sleep?).

I wouldn't recommend moving about the vehicle while it's in motion though...

@DieAxtImWald

This comment has been minimized.

Copy link

commented Jul 9, 2019

Wonderfull feature, if i only could use it... Autotravel on foot works, but autodrive with a vehicle not. The path is simply not visible. Testet different vehicles... What did i miss? a new world?

@anothersimulacrum

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

It only works on roads.

@DieAxtImWald

This comment has been minimized.

Copy link

commented Jul 10, 2019

i've tested this on different roads.
Guess, i have to test again with a new world...

@DieAxtImWald

This comment has been minimized.

Copy link

commented Jul 10, 2019

i can't get it.
fresh install > no mods > new world > spawned a vehicle on a road > started to drive, but no route in the map available/visible. Shift + w does nothing.
Autowalk works flawless. i've no idea why...

@joe9000

This comment has been minimized.

Copy link

commented Jul 13, 2019

can you make it treat #lake tiles as road to give boats some more use for it?

@davidpwbrown

This comment has been minimized.

Copy link
Contributor Author

commented Jul 13, 2019

Looks impressive.

A question I have in my mind: should this be interface feature like now or rather a vehicle autopilot (e.g. robot controls + sensors + tracking device)?

A full in-game autopilot may be possible on some vehicles, I can look into tht, so the player can do other things while the vehicle ( attempts to ) drive itself.

@davidpwbrown

This comment has been minimized.

Copy link
Contributor Author

commented Jul 13, 2019

Maybe instead of taking this away from the player (without such toys) we could instead extend this to robotic controls and such. That way if you don't have robot controls installed you can still have this auto driving take place. Meanwhile those who have such robot controls installed can sit back and let the car drive itself while they do something else, like read or play a game or something (sleep?).

I wouldn't recommend moving about the vehicle while it's in motion though...

as above

@davidpwbrown

This comment has been minimized.

Copy link
Contributor Author

commented Jul 13, 2019

i can't get it.
fresh install > no mods > new world > spawned a vehicle on a road > started to drive, but no route in the map available/visible. Shift + w does nothing.
Autowalk works flawless. i've no idea why...

Idk what the problem may be really, the route should appear on the map , when you press shift+W, when you are in a vehicle, the vehicle is running with you in control of it, and the start and endpoints of the route are on a road.

@davidpwbrown

This comment has been minimized.

Copy link
Contributor Author

commented Jul 13, 2019

can you make it treat #lake tiles as road to give boats some more use for it?

Yes, good idea. I can do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.