-
Notifications
You must be signed in to change notification settings - Fork 4.3k
The future of riot damage and other post-processing generators #79943
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
Comments
As a side note, if the lead developers are going to decide to try to keep mapgen strictly separated from game play map functionality in order to use bubble coordinates with implicit reality bubble references throughout except in mapgen, you have to be very careful with what functionality you add to the post processing, including exactly which operations you use to achieve it, as it's incredibly easy to call some operation that uses reference less coordinates somewhere down the call chain unless you know exactly what you're doing. Once you try to add something that's not in the current mapgen functionality set you have to be very careful, especially if it invokes weirdo call chains such as ammo checking or doing something to vehicles (beyond placing them and bashing them with the current mapgen used operation while they're fully within the OMT generated. Pushing vehicles around? I wouldn't count on it working correctly. Trying to do something with appliances? Ditto. Don't expect things to work just because it's a map operation: many have ugly call chains that involve reference less (i.e. implicit reality bubble) usage rather than the (mapgen) map that originated the chain. |
My 2 cts: Besides the ability to just disable it for some quests my main concern with the RIOT damage is that it looks so random.. (Don't understand why all buildings have a chance to randomly catch fire, etc.) It would be way cooler if there was some logic involved in picking hotspots for violence / violent looting instead of spreading it (thinly) all over the place. [Maybe by means of a list of mapgen-ids that have increased riot % [customizable in json?] -> ) When having determined some hotspots in the city also within that area specify some spots for outburst of violence / damage, so instead of a building randomly having 20 damaged tiles, get a spot or 2, 3 and have all the tiles around that damaged.. (Chance for riot-effects diminishing based on distance to those centers..) Blood outdoors would also disappear pretty fast depending on the weather. (Also missing is a variable to set the decreased riot impacts over time.. like just swapping (most -> all) fires with clusters of debris/destroyed buildings) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered. |
Is your feature request related to a problem? Please describe.
The current implementation of the 'riot damage' generator is hardcoded except for the flag which controls whether it runs. This is not ideal for a variety of reasons:
-Changing or tweaking any values require compiling C++, raising the effort bar for contributors.
-The same (re)compilation means turnaround time for testing changes to it is slow. JSON changes have almost 0 overhead, C++ changes have a very sharp minimum.
-The settings are not always appropriate for different gameplay experiences. Right now they are tailored towards vanilla CDDA, but not everything wants vanilla CDDA settings! For example we have the 'No Hope' mod, which aims for a darker bleaker world. It likely wants more riot damage, crazier stuff. But it has no way to do that, it can only toggle the riot damage on or off.
Solution you would like.
The solution is obvious: We offload most of the specific values into JSON, where mods can overwrite, extend, and modify it as they see fit.
The way I envision doing this requires a new JSON object type.
Here's an example of what the JSON format would look like:
This data would be attached to the
overmap_terrain
object and could be copy-from'd or extended/deleted, as a whole. That is if we added the above togeneric_city_building_no_sidewalk
it would apply to anything copying from that abstract. But it would not apply to rural buildings, as they would"delete": { "pp_generator": [ "PP_RIOT_DAMAGE" ] },
.If buildings needed finer control over which generators run, they would create a new
pp_generator
object. Here's one that only sets a bunch of fires:This allows granular control over the exact 'noise' applied to mapgen, to a degree. (If even more granular control becomes needed, we could do away with the
pp_generator
object and applygenerators
directly as part of theovermap_terrain
.)This will require some refactoring of the existing C++ code in addition to the new json objects. Let's take a look at some of it. Pretend we are running the program with our earlier riot damage generator, on
smash_stuff_up
.{ "id": "smash_stuff_up", "attempts": 20, "chance": 20, "min_bash": 6, "max_bash": 60 },
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/mapgen.cpp#L446-L449
The post-changes code would look something like this:
Notice how we've reduced the "magic numbers" down to a single one, 100. As an overarching rule this is much better for readability and maintenance. As a side benefit, breaking these up into individual "sub"-generators will eliminate much of the math weirdness I introduced. Instead of having to calculate 3-4 dependent events which may preclude your math from having the exact chance it says that it does, we run them independently at the exact chance. This will head off confusion before it starts.
Describe alternatives you have considered.
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: