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

npc: improve NPC omt_destination finding #30288

Merged
merged 1 commit into from
May 7, 2019

Conversation

mlangsdorf
Copy link
Contributor

Summary

SUMMARY: Bugfixes "npc: improve NPC omt_destination finding"

Purpose of change

Playing with NPCs on a city size 0 world is immensely frustrating, because the game slows to a crawl as they spend every turn looking through a 900 overmap tile radius for terrain that isn't there. Make some changes to improve performance under those conditions.

Describe the solution

Increase the number of locations that NPCs will search in order to satisfy their needs.

Reduce the search radius that NPCs will search for a destinationlocation from 900 overmap tiles to 150.

Don't search for destinations if the city size is 0.

If an NPC can't find a destination for any reason, just have them pick a random location and go there instead of having them repeat the searchon the next turn.

Describe alternatives you've considered

The mapgen code should create the lists of possible omt_destinations, but that's going to be a fairly involved bit of code that is beyond the scope of this quick-fix PR.

Increase the number of locations that NPCs will search in order to
satisfy their needs.

Reduce the search radius that NPCs will search for a destination
location from 900 overmap tiles to 150.

Don't search for destinations if the city size is 0.

If an NPC can't find a destination for any reason, just have them pick
a random location and go there instead of having them repeat the search
on the next turn.
@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Code: Performance Performance boosting code (CPU, memory, etc.) NPC / Factions NPCs, AI, Speech, Factions, Ownership labels May 7, 2019
@Night-Pryanik
Copy link
Contributor

Special thanks for updated destination locations! Especially source_of_food: from lonely s_grocer to a big variety of places.

@ZhilkinSerg ZhilkinSerg merged commit 6b2ce8f into CleverRaven:master May 7, 2019
@mlangsdorf mlangsdorf deleted the npc_better_destinations branch May 7, 2019 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) [JSON] Changes (can be) made in JSON NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants