neonspectra / CDDA-Choice

Guide: Commonly requested tweaks for CDDA
10 stars 0 forks source link

Contributing my tweaks #1

Open random-cdda-modder opened 1 year ago

random-cdda-modder commented 1 year ago

These might not be as popular as the big ones you have already, but at least some location uniqueness behavior changes have been requested in main repo issues multiple times. Also the mod changes are probably against the vision of the modders.

These are also very time-consuming to create a mod for since the json entry types are not extendable, leading to the mod needing changes every time something unrelated to the mod changes in the original json document.

If you're on Windows same changes can be done manually. I use jq tool to help re-apply these on every update to experimental.

Make everything important spawn closer together

    jq '(.[] | select( .id == "aircraft_carrier"           ) | .occurrences) |= [999,1000]' data/json/overmap/overmap_special/aircraft_carrier.json | sponge data/json/overmap/overmap_special/aircraft_carrier.json
    jq '(.[] | select( .id == "exodii_base"                ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/alien.json | sponge data/json/overmap/overmap_special/alien.json
    jq '(.[] | select( .id == "nuclear power plant"        ) | .occurrences) |= [999,1000]' data/json/overmap/overmap_special/nuclear_plant.json | sponge data/json/overmap/overmap_special/nuclear_plant.json
    jq '(.[] | select( .id == "Hunting Lodge Glooscap"     ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "Cabin_Lapin"                ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "evac_center"                ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "New England Church Retreat" ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "hub_01"                     ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "Isherwood Farms"            ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "mil_base"                   ) | .occurrences) |= [1,1]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json

Some things should be globally unique

    jq '(.[] | select( .id == "exodii_base"                ) | .flags) |= [ "EXODII", "GLOBALLY_UNIQUE", "SAFE_AT_WORLDGEN" ]' data/json/overmap/overmap_special/alien.json | sponge data/json/overmap/overmap_special/alien.json
    jq '(.[] | select( .id == "Hunting Lodge Glooscap"     ) | .flags) |= [ "CLASSIC", "WILDERNESS", "GLOBALLY_UNIQUE", "SAFE_AT_WORLDGEN" ]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "Cabin_Lapin"                ) | .flags) |= [ "CLASSIC", "WILDERNESS", "GLOBALLY_UNIQUE", "MAN_MADE" ]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "evac_center"                ) | .flags) |= [ "GLOBALLY_UNIQUE", "SAFE_AT_WORLDGEN", "MAN_MADE" ]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "hub_01"                     ) | .flags) |= [ "GLOBALLY_UNIQUE", "SAFE_AT_WORLDGEN" ]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json
    jq '(.[] | select( .id == "Isherwood Farms"            ) | .flags) |= [ "FARM", "GLOBALLY_UNIQUE", "SAFE_AT_WORLDGEN" ]' data/json/overmap/overmap_special/specials.json | sponge data/json/overmap/overmap_special/specials.json

Dinomod dinos are too prolific

For a recent lab accident they should be still relatively rare and around dino related locations.

    jq '(.[] | select( .name == "GROUP_FOREST"      ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_RIVER"       ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_SWAMP"       ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_PARK_ANIMAL" ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_POND_BIRD"   ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_CAVE"        ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_ROOF_ANIMAL" ) | .monsters) |= []' data/mods/DinoMod/monstergroups/wilderness.json | sponge data/mods/DinoMod/monstergroups/wilderness.json
    jq '(.[] | select( .name == "GROUP_ZOMBIE"      ) | .monsters) |= []' data/mods/DinoMod/monstergroups/zinosaur.json | sponge data/mods/DinoMod/monstergroups/zinosaur.json
    jq '(.[] | select( .name == "GROUP_ROOF_ZOMBIE" ) | .monsters) |= []' data/mods/DinoMod/monstergroups/zinosaur.json | sponge data/mods/DinoMod/monstergroups/zinosaur.json

XedraEvolved stuff is too common

It was very likely your first 10-20 usual looting locations(houses/lightindustries/etc) would contain artifacts etc. These paranormal things should be found from Xedra locations as the whole idea of the org is to contain this stuff.

First, contain the paranormal stuff:

    jq 'del( .[] | select( .id == "SUS_junk_drawer"           ) )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq 'del( .[] | select( .id == "SUS_junk_drawer_messy"     ) )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq 'del( .[] | select( .id == "SUS_office_filing_cabinet" ) )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq 'del( .[] | select( .id == "costume_misc_items"        ) )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq 'del( .[] | select( .id == "homebooks"                 ) )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

Second, re-add the stuff to Xedra overmap locations:

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "group": "xe_all_spells_mid", "prob": 100 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "group": "xe_all_spells_mid", "prob": 100 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "wolf_mask", "prob": 10 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "wolf_mask", "prob": 10 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "magicians_hat", "prob": 10 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "magicians_hat", "prob": 10 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "syringe_artifact", "prob": 10 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "syringe_artifact", "prob": 10 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "foil_hat", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "foil_hat", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "book_inventor", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "book_inventor", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_notes"          ).entries |= . + [{ "item": "book_inventor", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "money_strap_magic", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "money_strap_magic", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_notes"          ).entries |= . + [{ "item": "money_strap_magic", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "firmament_driver_book", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "firmament_driver_book", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_notes"          ).entries |= . + [{ "item": "firmament_driver_book", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "ray_diagrams", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "ray_diagrams", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_notes"          ).entries |= . + [{ "item": "ray_diagrams", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json

    jq '. |= map( select( .id == "xed_cubical_office" ).entries |= . + [{ "item": "eater_book_artifact", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_office"         ).entries |= . + [{ "item": "eater_book_artifact", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
    jq '. |= map( select( .id == "xed_notes"          ).entries |= . + [{ "item": "eater_book_artifact", "prob": 5 }] )' data/mods/Xedra_Evolved/itemgroups/itemgroups.json | sponge data/mods/Xedra_Evolved/itemgroups/itemgroups.json
neonspectra commented 1 year ago

Agree, these are cool and I'd like to add them. I really like the XedraEvolved one in particular-- might start using that myself. IMO you should consider trying to PR that into CleverRaven (if someone hasn't already) since it seems kind of obvious when you bring it up.


Couple small questions about the spawn closer tweak, since I've always found overmap unit verbiage confusing in the official documentation.

Please correct my understanding if I'm wrong: one overmap chunk is 180 overmap terrains wide and 180 overmap terrains tall, yes? And, an overmap terrain is just one cursor-size unit of overmap.

If this understanding is correct, I'm also curious as to what the spawn chance means. So let's say we have a 30/100 ratio. Based on your explanation above, this means that we have a 30% chance of spawning in the overmap chunk at origin. What happens the other 70% of the time? How does it determine how many overmap chunks out it should be to spawn?


TIL about sponge. I've always just piped to a tmpfile or fifo and then piped back. But then again, I commonly work with systems that don't have GNU moreutils installed by default.


Will probably take some more time for me to go through these (gotta love having real life commitments). Either way, I really appreciate this stuff. It's really cool of you to contribute your knowledge in this way.

random-cdda-modder commented 1 year ago

you should consider trying to PR that into CleverRaven

I hereby relinquish any and all copyright to my contributions in this issue and you are free to pursue this yourself without attribution or anything. I also cannot be held liable for any effects aforementioned contributions might cause when applied. No warranty is provided either.

one overmap chunk is 180 overmap terrains wide and 180 overmap terrains tall, yes?

one chunk is a square of X map unitsize locations yes, don't remember the amount.

What happens the other 70% of the time?

There are two implementation of occurrences, unique and non-unique https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/OVERMAP.md#occurrences-default

You're asking about the unique one so maybe view it like a loot table in an MMO; there are spawn chances for each item, a hand reaches into a bag and draws out the winner item. Having a 100% chance means you will always get chosen when the hand brushes against you in the bag.

Iterating over available specials and the diceroll per special is probably this code here https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/overmap.cpp#L6256

How does it determine how many overmap chunks out it should be to spawn?

This is not considered at all. specials get placed in the chunks they win the lottery in.

If a chunk is overloaded with stuff that won the lottery they spill out to adjacent (to-be-generated at this point) chunks if I have understood this correctly: https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/overmap.cpp#L6287

TIL about sponge. I've always just piped to a tmpfile or fifo and then piped back. But then again, I commonly work with systems that don't have GNU moreutils installed by default.

By unix philosophy you want to combine basic simple tools, like you have, to get the desired effect. But sometimes after the thousandth time you just give up purity for a macro.