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

Monster cameras, vision optimizations, and an implementation through Slime #56231

Merged

Conversation

MylieDaniels
Copy link
Contributor

@MylieDaniels MylieDaniels commented Mar 19, 2022

Summary

Features "Monsters can serve as cameras, adds Slimewave, optimizes seen_cache usage"

Purpose of change

Heavily inspired by @bombasticSlacks wonderful PR #55625, this adds the ability to use friendly monsters as an additional source of vision. In addition, it adds a trait to Slime that allows for vision through Slimesprings (renamed to Slime Microbians) within 8 tiles, and through a new monster that cannot yet be created, the Slime Ocularium, within 32 tiles. The Ocularium is not yet creatable because it is created as part of a WIP mutation rework- it is the reason I made this change, to be honest.
While testing, I found that seen_caches were used in excess, and optimized their usage, allowing for more accurate vision on short term activities and faster long activities.

Describe the solution

Vision can be cast from any friendly monster, specified by a "moncams" array in any trait/mutation.
The monster's daytime vision is the maximum view distance, and the moncams array specifies the range at which it can "transmit" to the avatar.
Vision will be cast only on the Z-level the monster is on- as such, a monster cam on a different Z-level does nothing when not using experimental Z-level, and will only cast on it's own level, even when using experimental Z-level vision. This is because having monster cams cast full Z-level vision was found to be rather slow.
Vision from cameras is no longer limited to the player's maximum view distance, but is of course still limited to the reality bubble.
map::build_map_cache (called every turn) no longer rebuilds the seen cache, and instead, map::build_lightmap (a new function, called when player vision should update) handles that.

Describe alternatives you've considered

Testing

Mutated Slimewave, spawned Oculariums and Microbians and tested in a variety of situations, from vehicles to a limited usage in experimental Z-levels.
Tested long term resting and activities, found that incoming enemies were correctly detected, etc.

Additional context

image
I am on the second floor, in an enclosed room. There are two Oculariums on the first floor, represented by green capital I's.

bombasticSlacks and others added 5 commits March 19, 2022 12:09
Currently the Ocularium cannot be created, this is intentional - Slimewave is still useful through slime minions from Omnicellular
This code is present in bombasticSlack's current draft PR, and this is technically a different feature.
@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions labels Mar 19, 2022
@github-actions
Copy link
Contributor

Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details.

Click to expand
  • A spire of hardened slime, coated in rotating eyespots and glistening ocular nerves.
  • slime microbian
  • slime microbians
  • slime ocularium
  • slime oculariums

This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to tools/spell_checker/dictionary.txt so they will not trigger an alert next time.

@github-actions github-actions bot added Code: Tooling Tooling that is not part of the main game but is part of the repo. astyled astyled PR, label is assigned by github actions labels Mar 19, 2022
@Theawesomeboophis
Copy link
Contributor

Slime cameras, something I never knew I wanted in a game until right now, this sounds awesome.

@Maleclypse Maleclypse added Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies <Enhancement / Feature> New features, or enhancements on existing labels Mar 20, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 20, 2022
Makes cameras independent from player vision radius limits, dirties vision cache while cameras are active, and adds better vision falloff to cameras.
In addition, removes recalculation of seen_cache during long activities except on refresh frames - an optimization that arose from camera needs.
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 21, 2022
@github-actions github-actions bot added the Code: Tests Measurement, self-control, statistics, balancing. label Mar 21, 2022
@MylieDaniels MylieDaniels changed the title Monster cameras and an implementation through Slime Monster cameras, vision optimizations, and an implementation through Slime Mar 21, 2022
Player was able to detect a monster existed, especially on the compass, but not see their location, when the mosnter was outside of sight_max range (usually 9999, but sometimes much smaller for certain mutations and effects)
@MylieDaniels MylieDaniels requested a review from KorGgenT as a code owner March 21, 2022 18:00
Also upped MYOPIC vision radius, preventing an adverse effect of excessive blindness - and somehow making a much nicer vision effect for short-sighted characters.
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 22, 2022
@MylieDaniels
Copy link
Contributor Author

MylieDaniels commented Mar 22, 2022

This ended up rather sprawling, touching many parts of vision code. Not touching it again unless a bug is found, not even for the complete jsonification of sight_max that I will be doing in a different PR.

EDIT: Right, bad vision is tested for.

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 22, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 22, 2022
Mirrors were giving inaccurate vision ranges - also I nerfed mirrors because its now possible to nerf mirrors.
Co-authored-by: Kevin Granade <[email protected]>
@github-actions github-actions bot added the Monsters Monsters both friendly and unfriendly. label Mar 26, 2022
Co-authored-by: Kevin Granade <[email protected]>
@kevingranade kevingranade merged commit 52d991b into CleverRaven:master Mar 27, 2022
andrei8l added a commit to andrei8l/Cataclysm-DDA that referenced this pull request Apr 28, 2022
andrei8l added a commit to andrei8l/Cataclysm-DDA that referenced this pull request Apr 28, 2022
andrei8l added a commit to andrei8l/Cataclysm-DDA that referenced this pull request May 4, 2022
kevingranade pushed a commit that referenced this pull request May 4, 2022
This reverts commit 52d991b.
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` Code: Tests Measurement, self-control, statistics, balancing. Code: Tooling Tooling that is not part of the main game but is part of the repo. <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Monsters Monsters both friendly and unfriendly. Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants