CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.33k stars 4.14k forks source link

Single issue project to make the monsters that track by scent more appropriate #62681

Open Maleclypse opened 1 year ago

Maleclypse commented 1 year ago

Describe the bug

Edit: I'm adjusting my approach to this as I've been informed of the existence of KEENNOSE as opposed to base detection. So there is some differentiation between how various creatures with smell experience the scent map.

Firstly track by scent is currently set by species despite almost every species in game is too broad to have all the monsters in a given species to track by scent. Secondly, the logic in the c++ seems to be broken so as to prevent any individualized changes by mon_id to whether something tracks by scent or not. Thirdly, basically every species of monster currently tracks by scent including Robots.

Steps to reproduce

akrieger — Today at 4:55 PM

    const scenttype_id &type_scent = scents.get_type();
    bool right_scent = false;
    // is the monster tracking this scent
    if( !tracked_scents.empty() ) {
        right_scent = tracked_scents.find( type_scent ) != tracked_scents.end();
    }
    //is this scent recognised by the monster species
    if( !type_scent.is_empty() ) {
        const std::set<species_id> &receptive_species = type_scent->receptive_species;
        const std::set<species_id> &monster_species = type->species;
        std::vector<species_id> v_intersection;
        std::set_intersection( receptive_species.begin(), receptive_species.end(), monster_species.begin(),
                               monster_species.end(), std::back_inserter( v_intersection ) );
        if( !v_intersection.empty() ) {
            right_scent = true;
        }
    }

basically the first right_sent is ignored if the species is receptive to the scent type at all

Expected behavior

I would expect scent tracking to not be a universal thing performed by every creature in existence that is not the player character.

Screenshots

No response

Versions and configuration

Current version until fixed

Additional context

No response

Maleclypse commented 1 year ago
 {
    "type": "scent_type",
    "id": "sc_human",
    "receptive_species": [
      "MAMMAL",
      "BIRD",
      "AMPHIBIAN",
      "REPTILE",
      "FISH",
      "MUTANT",
      "NETHER",
      "SLIME",
      "FUNGUS",
      "INSECT",
      "CENTIPEDE",
      "SPIDER",
      "PLANT",
      "MOLLUSK",
      "WORM",
      "ZOMBIE",
      "ROBOT",
      "HORROR",
      "ABERRATION",
      "HALLUCINATION",
      "HUMAN",
      "UNKNOWN"
    ]
  },
Maleclypse commented 1 year ago

Ideally I had hoped that everything was working and I could just create a project list to go through the monster ids and make it so base zombies don't automatically have the noses of bloodhounds, but it appears that all monsters have the noses of bloodhounds currently.

mqrause commented 1 year ago

Secondly, the logic in the c++ seems to be broken so as to prevent any individualized changes by mon_id to whether something tracks by scent or not.

The logic is actually fine, because there's also scents_ignored, giving the hierarchy of scents ignored by monster > scents tracked by species > scents tracked by monster. Calling that a hierarchy isn't really the best description. Species is just default, and you can add to that with scents_tracked and remove from it with scents_ignored.

Maleclypse commented 1 year ago

Secondly, the logic in the c++ seems to be broken so as to prevent any individualized changes by mon_id to whether something tracks by scent or not.

The logic is actually fine, because there's also scents_ignored, giving the hierarchy of scents ignored by monster > scents tracked by species > scents tracked by monster.

Ok so then would I be able to start working on this by removing a species say ZOMBIES then adding scents_tracked to any individual zombie id's that should be able to track by scent? Or would I need to make zombie cops ignore all scents because the species must be included?

mqrause commented 1 year ago

I edited my previous reply. Species should contain all the most common scents a species can track to keep the json as small as possible. Then track or ignore scents for specific monsters.

Maleclypse commented 1 year ago

I edited my previous reply. Species should contain all the most common scents a species can track to keep the json as small as possible. Then track or ignore scents for specific monsters.

But if we were to say that only zombie dogs and certain advanced zombie lines like the zombie predators were able to track by scent wouldn't it be less json to remove zombie from the above receptive species and then add scents_tracked only to those 6+ mon_ids rather than setting scents_ignored for all 200 hundred zombie mon_ids outside of the zombie dogs and predators?

mqrause commented 1 year ago

Yes, absolutely. The species should only have the tracking ability, if most of the monsters of that species have it.

kevingranade commented 1 year ago

Unless there's a different regression, the comment that they have the noses "of bloodhounds" is an overstatement, this code here https://github.com/CleverRaven/Cataclysm-DDA/blob/f643cd5519e9399408b728e388e50b7d680f9ae0/src/monmove.cpp#L1292 adjusts for scent detection ability. If they don't have the "keen nose" trait, it limits the distance they can detect from, and also makes them confused when they get close to the target.

This is just a note to keep in mind, everything else about your conclusions is correct.