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

Remove mission search radius from most missions #78949

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented Jan 4, 2025

Summary

None

Purpose of change

"Failed to assign mission target <name_of_OMT>"

We let our searches purposefully fail due to putting in a too-low number in json. Why?

There is absolutely no reason to let these searches fail on purpose. But for some reason, instead of just searching as far as reasonably possible, we let them fail. Not only that, but we leave it up to the JSON to determine just how often we want to purposefully fail, with wildly varying results. Why?!

Most of them are just cargo culted, and didn't understand what they were doing. Well let's lock it down.

Describe the solution

Guard against people accidentally setting a lower search range by enforcing random. If it's not random, it'll always search closest first and then you never want to stop the search early.

Upgrade the default search range from OMAPX (180 OMTs) to OMAPX * 14 (2520 OMTs). Upgrade the error to mention how far we searched, too. So that errors in search radius are apparent in debug messages, and don't have to be sussed out.

I audited every single search radius and kept search ranges for anything that previously had random search and seemed vaguely appropriate.

Conversely, I removed random (and did not return manual search range) from a few cases where it was clearly inappropriate. Anything searching for a GLOBAL_UNIQUE, for example, has no business searching an extra-limited range.

The end result is that all of our missions looking for singular important locations (i.e. all the ones which fail constantly) should be much more reliable.

Describe alternatives you've considered

Enforced 5000 tile search range

Testing

Loads. Properly errors if you try to lower the search range for no reason.

image

Additional context

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON Missions Quests and missions [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [Markdown] Markdown issues and PRs Scenarios New Scenarios, balancing, bugs with scenarios Mechanics: Enchantments / Spells Enchantments and spells EOC: Effects On Condition Anything concerning Effects On Condition labels Jan 4, 2025
src/mission_util.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Jan 4, 2025
@RenechCDDA RenechCDDA force-pushed the remove_search_radius branch from dc78bbf to ad827b4 Compare January 4, 2025 23:59
@github-actions github-actions bot added Map / Mapgen Overmap, Mapgen, Map extras, Map display Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Aftershock Anything to do with the Aftershock mod Mods: Dinomod Anything to do with the Dinoclysm mod (DinoMod) Mods: No Hope Relating to the mod No Hope Mods: Defense Mode Anything to do with the Defense Mode mod Mods: Innawood 🌲 Anything to do with Innawood mod Mods: Xedra Evolved Anything to do with Xedra Evolved Mods: Sky Island Anything about the Sky Island mod Mods: Isolation Protocol ☣ The total conversion mod Isolation Protocol labels Jan 4, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-requesting reviews from non-collaborators: @LyleSY @Light-Wave @Night-Pryanik

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

[JSON & C++ formatters](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/DEVELOPER_TOOLING.md)

[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "triffid_grove",
"om_special": "Triffid Grove",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "goblin_1A",
"om_special": "goblin_encampment",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "black_dragon_lair_z-0_NW",
"om_special": "black_dragon_lair",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "mine_balrog_central",
"om_special": "Balrog mine",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "central_lab_entrance",
"om_special": "Central Lab",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "exodii_base_x0y3z0",
"om_special": "exodii_base",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "temple_stairs",
"om_special": "Strangle Temple",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "attunement_altar_NW",
"om_special": "attunement altar",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "druid_ritual_home_z0",
"om_special": "druid_tower",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "magic_field_a1",
"om_special": "magic_field",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"effect": [
{
"mapgen_update": "mx_skyisland_pond",
"om_terrain": "sky_island_core",
"offset_x": -1,
"offset_y": -1
}
]


[JSON & C++ formatters] reported by reviewdog 🐶

"effect": [
{
"mapgen_update": "mx_skyisland_pond",
"om_terrain": "sky_island_core",
"offset_x": 1,
"offset_y": -1
}
]


[JSON & C++ formatters] reported by reviewdog 🐶

"effect": [
{
"mapgen_update": "mx_skyisland_pond",
"om_terrain": "sky_island_core",
"offset_x": -1,
"offset_y": 1
}
]


[JSON & C++ formatters] reported by reviewdog 🐶

"effect": [
{
"mapgen_update": "mx_skyisland_pond",
"om_terrain": "sky_island_core",
"offset_x": 1,
"offset_y": 1
}
]


[JSON & C++ formatters] reported by reviewdog 🐶

"target_params": {
"om_terrain": "sky_island_core",
"om_terrain_match_type": "CONTAINS",
"offset_z": -1,
"offset_x": -1,
"offset_y": -1
}


[JSON & C++ formatters] reported by reviewdog 🐶

"target_params": {
"om_terrain": "sky_island_core",
"om_terrain_match_type": "CONTAINS",
"offset_z": -1,
"offset_x": 1,
"offset_y": -1
}


[JSON & C++ formatters] reported by reviewdog 🐶

"target_params": {
"om_terrain": "sky_island_core",
"om_terrain_match_type": "CONTAINS",
"offset_z": -1,
"offset_x": -1,
"offset_y": 1
}


[JSON & C++ formatters] reported by reviewdog 🐶

"target_params": {
"om_terrain": "sky_island_core",
"om_terrain_match_type": "CONTAINS",
"offset_z": -1,
"offset_x": 1,
"offset_y": 1
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "mi-go_camp1",
"om_special": "Mi-Go Encampment",
"reveal_radius": 3,
"cant_see": true
}


[JSON & C++ formatters] reported by reviewdog 🐶

"assign_mission_target": {
"om_terrain": "triffid_grove",
"om_special": "Triffid Grove",
"reveal_radius": 3,
"cant_see": true
}

@RenechCDDA RenechCDDA force-pushed the remove_search_radius branch from ad827b4 to 6ab8e88 Compare January 5, 2025 00:04
@John-Candlebury
Copy link
Member

I think expanding the search radius is fine when it comes to missions trying to find unique placement specials.

However there's incredibly many reasons for why you'd want something to forcibly spawn within <X overmap tiles of the player, (mission and non mission related) and the mission spawning code is AFAIK the only way in which this can be achieved, so completely getting rid of the functionality is not a great idea.

For example I'm not sure how this will trully affect the spawning of Aftershock shuttles, if the player has explored enough fields around them, could the shuttle be placed so far away that they wont be able to reach it before it leaves? I wouldnt want that to ever happen.

@RenechCDDA
Copy link
Member Author

I think expanding the search radius is fine when it comes to missions trying to find unique placement specials.

However there's incredibly many reasons for why you'd want something to forcibly spawn within <X overmap tiles of the player, (mission and non mission related) and the mission spawning code is AFAIK the only way in which this can be achieved, so completely getting rid of the functionality is not a great idea.

For example I'm not sure how this will trully affect the spawning of Aftershock shuttles, if the player has explored enough fields around them, could the shuttle be placed so far away that they wont be able to reach it before it leaves? I wouldnt want that to ever happen.

get_target_position() (lambda) always tries to find or create on your overmap first. It only proceeds to other overmaps if it fails in your local overmap. The shuttle eoc looks like it can just be placed down in any field regardless of existing submaps.

TBH if we find issues with this it's a lot easier to re-add the functionality for the few cases that (might?) need it, than to allow it for every mission. Missions should definitely not be using this unless they explicitly need it, and (no offense intended) I am not convinced any missions have a need for it.

@John-Candlebury
Copy link
Member

John-Candlebury commented Jan 5, 2025

But you still gave no valid reason to remove it? Like I see its being extensively misused, but you are completely getting rid of our ability to say: "Game spawn this far enough but not too far away"

Sure you cannot think any reasons for why youd want to use the option in vanilla but that not true off in mods. Just familiarizing myself with the changes here, the sky island mod setting the exildistance between two values seems extremely deliberate and a valid use case to me, especially since it changes depending on choices the platyer makes?

Never mind that theres other valid reasons that are not implemented example: you use hellgate spell and the helgate spawns between 3 and 5 overmaps away from you (because you dont want to do the effects of spawning the thing live in the reality bubble but you dont want it too far away), same logic applies to for example Aftershock using a SAM site to down a drone/plane/spaceship.

@RenechCDDA RenechCDDA force-pushed the remove_search_radius branch 2 times, most recently from a2e4e5b to b1643a6 Compare January 5, 2025 01:53
@RenechCDDA
Copy link
Member Author

Okay after some discussion with Candlebury: They're completely right. That WAS doing something useful. Oops.

So I went through every single one of them, again, and re-added the search ranges to anything that previously had random search and seemed vaguely appropriate.

Conversely, I removed random (and did not return manual search range) from a few cases where it was clearly inappropriate. Anything searching for a GLOBAL_UNIQUE, for example, has no business searching a limited range. Dinomod had one case of searching only one overmap for a 4x4 (!!!) surface lab. That was incredibly prone to failure, so I just nixed that to make sure it could be found.

Other than that, very cut and dry. But they're in a separate commit so mod authors/reviewers can look them over to be sure.

@Procyonae
Copy link
Contributor

I don't hate this as a temporary measure but this needs a more nuanced permanent solution, I've thought quite a bit about ideal solutions but still haven't decided on anything, you can find some of my previous thoughts here #76684 (comment)

@RenechCDDA RenechCDDA force-pushed the remove_search_radius branch from b1643a6 to 0011167 Compare January 5, 2025 01:57
@RenechCDDA RenechCDDA changed the title Remove mission search radius Remove mission search radius from most missions Jan 5, 2025
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 5, 2025
RenechCDDA and others added 3 commits January 5, 2025 16:31
…ndom range function

-Remove random from those that clearly should never have had it applied (and don't return their search range either)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Maleclypse Maleclypse force-pushed the remove_search_radius branch from b385de0 to 7e4ea7d Compare January 5, 2025 22:32
@github-actions github-actions bot added BasicBuildPassed This PR builds correctly, label assigned by github actions and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 5, 2025
@GuardianDll GuardianDll merged commit 9d60e47 into CleverRaven:master Jan 6, 2025
23 of 26 checks passed
@RenechCDDA RenechCDDA deleted the remove_search_radius branch January 6, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs Mechanics: Enchantments / Spells Enchantments and spells Missions Quests and missions Mods: Aftershock Anything to do with the Aftershock mod Mods: Defense Mode Anything to do with the Defense Mode mod Mods: Dinomod Anything to do with the Dinoclysm mod (DinoMod) Mods: Innawood 🌲 Anything to do with Innawood mod Mods: Isolation Protocol ☣ The total conversion mod Isolation Protocol Mods: Magiclysm Anything to do with the Magiclysm mod Mods: No Hope Relating to the mod No Hope Mods: Sky Island Anything about the Sky Island mod Mods: Xedra Evolved Anything to do with Xedra Evolved Monsters Monsters both friendly and unfriendly. NPC / Factions NPCs, AI, Speech, Factions, Ownership Scenarios New Scenarios, balancing, bugs with scenarios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants