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

Radio contact with followers, NPC overmap movement. #29094

Merged
merged 5 commits into from Apr 3, 2019

Conversation

@davidpwbrown
Copy link
Contributor

commented Mar 28, 2019

Summary

SUMMARY: Features "Radio contact with followers, NPC overmap movement"

Purpose of change

If you and your follower both have a two-way radio, you can select them in your follower menu, and talk to them.
All I've enabled in that menu so far is "go to location" the location being either a) player location or b) location of one of your camps. and " stay where you are " so they stop moving.
The NPC will then path to that location on the overmap and inform you when they are there.
( this functionality has also been added to the standard talk menu )
There is a debug menu option to show NPC path as an overlay.
NPC will use the A* to find best overmap route ( they prefer roads )

This is the first step towards https://github.com/CleverRaven/Cataclysm-DDA/projects/7 and #28393

I have only enabled NPC followers to be ordered to move, but theoretically all dynamic NPCs could be allowed to travel on the overmap now.

This is a rough first-pass. there are some caveats and limitations.

  1. Radios don't use batteries when used to give orders.
  2. Radios don't have range currently - rising a z-level, being indoors, having a radio tower at your camp, all these things could potentially change radio range.
  3. NPCs kinda just pop-into existence if you are there in the destination location to see them arrive, this is beyond my ability to fix, due to the the NPC spawning code using submaps.
  4. There is no risk to the NPC whilst travelling, some kind of risk calculation would be good, aswell as a speed calculation to determine the terrain and the NPCs skills.
  5. the A* algorithm is very basic in terms of OMT terrain costs, this could be refined. ( roads are preferred to fields which are preferred to rivers and forests and swamps, basically. )
  6. z-level weirdness may occur, althoug in testing they seemed to cope with going up or down z-levels fine.

Describe the solution

Added code to check for a radio with follower and player, in faction menu.
made a new talk menu for radio contact.
made a new mission type, making use of existing pathfinding omt goal that NPCs have.
added code to do_turn() that checks for follower NPCs with travelling missions.
do some pathfinding, and spawn them in appropiate submaps every x minutes.
ensured that overmapbuffer keeps track if they switch overmap.
added some more robust follower validation and serialization for player followers ( pathfinding may take them too far away for the standard validation to find )

Describe alternatives you've considered

Had lots of ideas for other things, but its already getting too big, and wanted the first pass out the door for feedback.

Additional context

Things this may enable further work on :
Radio towers in camps.
vehicle mounted radio transmitters for further range.
remote administration of a basecamp
radio contact with non-follower faction NPCs ( old guard etc )

image

image

( NPC takes path through forest trail instead of through forest )

initial change
got remote talk working

added goto_location

mission destination

added goto to normal dialogue

fixed up interactable checks

finished off local movement, added overmp movers list

added 1st pass at pathfindin

fixed NPC move overmap scale

added travel_cost to path

almost there

before experiment

finalized

astyled

removed test code

removed test code

removed test code
@kevingranade

This comment has been minimized.

Copy link
Member

commented Mar 28, 2019

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

https://discourse.cataclysmdda.org/t/i-was-wonder-if-there-will-have-walkie-talkie-on-the-game-and-how-about-riot-shield/16434/13

Show resolved Hide resolved src/faction.cpp Outdated
Show resolved Hide resolved src/faction.cpp Outdated
Show resolved Hide resolved src/faction.cpp Outdated
Show resolved Hide resolved src/faction.cpp Outdated
Show resolved Hide resolved src/faction.cpp Outdated
Show resolved Hide resolved src/faction_camp.cpp Outdated
Show resolved Hide resolved src/game.cpp Outdated
Show resolved Hide resolved src/npcmove.cpp Outdated
Show resolved Hide resolved src/npctalk_funcs.cpp Outdated
from review: debug_pathfinding toggle
Update data/json/npcs/TALK_COMMON_ALLY.json

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update data/json/npcs/TALK_COMMON_ALLY.json

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update data/json/npcs/TALK_COMMON_ALLY.json

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update data/json/tool_qualities.json

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/faction.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/faction.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/faction.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/faction.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/faction.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/faction_camp.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/npctalk_funcs.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

Update src/npcmove.cpp

Co-Authored-By: davidpwbrown <39344466+davidpwbrown@users.noreply.github.com>

give me a break

@davidpwbrown davidpwbrown force-pushed the davidpwbrown:radio_contact_2 branch from 6671f1e to 015acad Mar 29, 2019

@adamkad1

This comment has been minimized.

Copy link

commented Mar 29, 2019

OBEY ME!

davidpwbrown added some commits Mar 29, 2019

@mlangsdorf mlangsdorf added this to In progress in NPC dialog overhaul via automation Mar 29, 2019

@davidpwbrown davidpwbrown changed the title [WIP]Radio contact with followers, NPC overmap movement. Radio contact with followers, NPC overmap movement. Mar 31, 2019

@kevingranade kevingranade merged commit 3bfa17a into CleverRaven:master Apr 3, 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

NPC dialog overhaul automation moved this from In progress to Done Apr 3, 2019

@davidpwbrown davidpwbrown deleted the davidpwbrown:radio_contact_2 branch Apr 3, 2019

@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

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

https://discourse.cataclysmdda.org/t/yelling-commands-and-using-military-hand-signals/19487/7

Show resolved Hide resolved src/game.cpp
@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 10, 2019

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

https://discourse.cataclysmdda.org/t/latest-experimental-features/5582/1106

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.