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

Player overmap auto-travel #31786

Merged
merged 3 commits into from Jun 27, 2019
Merged

Player overmap auto-travel #31786

merged 3 commits into from Jun 27, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jun 23, 2019

Summary

SUMMARY: Features "Player overmap auto-travel"

Purpose of change

Getting annoyed at the long-distance travelling back to base, I thought it might be cool to get the player to do it for you automatically.

Describe the solution

Leverages activities set_destination and player automove functionality.
Gets the omt pos from the overmap UI, where you can preview the route. ( press W to select and again to confirm )
THe player will then do an automove route there.
Similar to the automove, it will cancel when enemies are spotted.
This could probably be tweaked better to allow the player to keep movng even though enemies are visible, otherwise it is slightly less convenient, unless the path is known to be safe.

Describe alternatives you've considered

A proper absolute co-ord pathing system would be nice.
What I did here instead was find the next omt along , so its still inbounds and get its centre point, then path again when reaching that point, and so on.
This means it probably could be a whole lot faster.
Would welcome feedback on this area.

Additional context

N/A

@Night-Pryanik
Copy link
Contributor

Screenshots or, even better, gif would be helpful.

@ghost
Copy link
Author

ghost commented Jun 24, 2019

Screenshots or, even better, gif would be helpful.

https://gfycat.com/classicesteemedguineapig

A gif of the selection of the route and the auto-travel.

Bear in mind my laptop is an absolute potato, and recording and travelling in cata looks slow.
Itd be much faster for everyone else I imagine.

@Night-Pryanik
Copy link
Contributor

Oh, this is absolutely marvelous!

@ifreund ifreund added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Character / Player Character / Player mechanics Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA labels Jun 24, 2019
src/player.h Outdated Show resolved Hide resolved
data/raw/keybindings.json Outdated Show resolved Hide resolved
src/overmap_ui.cpp Outdated Show resolved Hide resolved
src/overmap_ui.cpp Outdated Show resolved Hide resolved
src/overmap_ui.cpp Outdated Show resolved Hide resolved
src/overmap_ui.cpp Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Jun 25, 2019

Fixed some pathing problems, and the prompt to continue travelling when mosnter spotted.
Think it's fully there now.

It's much faster.

https://gfycat.com/fondspicykiwi

@kevingranade
Copy link
Member

It keeps stopping after what looks like reaching the next submap.

@ghost
Copy link
Author

ghost commented Jun 26, 2019

It keeps stopping after what looks like reaching the next submap.

It's not doing that for me... any particular situation you were in when it stops moving? any potential difficulties in pathing the terrain perhaps? or nearby monsters?

David Brown added 3 commits June 26, 2019 11:36
initial implementation

changed description

remove include

putting something back as I dont need it afterall

linty lint lint

Update src/activity_handlers.cpp

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

Update src/activity_handlers.cpp

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

made overmap UI text neater

move omt_path to character.h

change default key from F1 to W to initiate route

Update src/overmap_ui.cpp

Co-Authored-By: BevapDin <tho_ki@gmx.de>

Update src/overmap_ui.cpp

Co-Authored-By: BevapDin <tho_ki@gmx.de>

Update src/overmap_ui.cpp

Co-Authored-By: BevapDin <tho_ki@gmx.de>

make it faster by delaying draw() call

overmapui - changed to std::find, fixed pathing problems, and safe prompt

test output
@Inglonias
Copy link
Contributor

This looks really cool!

@kevingranade
Copy link
Member

I was just auto-traveling down a road, sometimes on it and sometimes not on it, there were no monsters or other threats and nothing in particular was happening to the player, so I'm not clear what would have cancelled it, but it was very persistent. It's possible I just had a bad merge with other stuff I was testing at the same time, so if I re test and that doesn't happen we can proceed.

@kevingranade
Copy link
Member

This was breaking in iso tiles mode. Don't ask me why, no idea.

@kevingranade kevingranade merged commit b8698af into CleverRaven:master Jun 27, 2019
@kevingranade
Copy link
Member

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/1

@ghost ghost deleted the player_overmap_travel branch September 11, 2019 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Mechanics: Character / Player Character / Player mechanics Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants