CleverRaven / Cataclysm-DDA

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

Trap Rework #7800

Closed Eighth-of-Third closed 10 years ago

Eighth-of-Third commented 10 years ago

Based on discussion in #7786, it seems the entire trap system is in need of a rework. This will probably include the removal of randomly-placed minefields and stashes, and the addition of traps to areas where they make sense, such as landmines protecting military outposts/bunkers, or makeshift traps protecting LMOE shelters and survivour houses. This issue is for the discussion of this rework.

jeremyosborne commented 10 years ago

Commenting for the sake of being bothered in my email when people comment here.

Zireael07 commented 10 years ago

I say add the purposeful ones where they make sense, as @Izicata pointed out. However, I would still keep the random minefields and stashes, but at greatly reduced chances.

inverimus commented 10 years ago

Thumbs up. This makes a lot more sense then how it works currently.

jeremyosborne commented 10 years ago

For the sake of immersion, I'd love it if "stashes" weren't just randomly out in the open. In fact, those sorts of stashes I'd love to have disappear in the longer term. Instead, have themed stashes:

But despite my earlier dissenting, I'd be cool with a small number of stashes in the game, landmines and all. I'd vote for small enough percentage chance that in any given game we see statistically see somewhere between 0-1.

vache commented 10 years ago

A thought I had on this, even if the player doesn't have the raw stats to detect a trap every time, it could be possible to include some rng based element to detection so that you have a small chance to detect something regardless of your stats, and have that detection train your trapping skill. It could be tied to the examine action, or just happen when the trap is in view. Otherwise, we are running the risk of having the only way of training trapping be to make traps (that players may not ever want to place) because they can't detect traps to attempt to disarm them.

kevingranade commented 10 years ago

Now that it latches on, that's a possibility, the reason not to do it before is the game didn't track which traps were spotted, so you'd spot then forget constantly.

Lain- commented 10 years ago

Not sure how hard it will be, but I'd would love to see the trapping skill become more proactive. Instead of just as obstacles to low PER characters and for base defend which is pretty underdeveloped IMHO. For example the ability to rig trap and baits to hunt games, or remote-controlled trap, more way to interact with traps (throw rock to trigger landmine, use wooden stick to disarm beartrap...)

KA101 commented 10 years ago

more way to interact with traps (throw rock to trigger landmine, use wooden stick to disarm beartrap...)

Already in, thanks @BevapDin. Throw a heavy object such as a Heavy Stick on a tile that you believe has a trap, and if you're right, chances are you'll set it off.

Remote-controlled traps would be Nifty, and the biggest problem with bait would be tracking it outside the reality bubble: IIRC critters can already be distracted by things (such as Chunk of Meat).

EricFedrowisch commented 10 years ago

Is there any way to add notes to the overland map announcing you have seen traps/mines as is currently done with stairs?

Hague commented 10 years ago

Perhaps there needs to be an overhaul in how perception and stealth works and treat traps and mines and the like as objects that are intentionally hidden from the player by a person with Trapping skill? Perhaps an amateur or rookie placed these mines and they are easier to spot?

First on to the concept of a perception overhaul. Every item/mob (including the player) is given a Profile score that represents how much it sticks out from it's current environment. Profile can be modified by things like stance, gear, terrain, skills and item/mob size. Objects in the environment also have a Cover score that is applied against a perceived thing's Profile. A line is traced between the object and the spotter. The highest cover score of all tiles between the target and the spotter is subtracted from targets profile. This means that some zombies, like crawlers, will have a lower profile and can be hidden in grass. A player's is always passively perceiving with a default score based on their perception. This means that obvious things will never be missed However, if there is rough or cluttered terrain they may miss enemies or objects. A player can search an area (an x by x area, perhaps modifiable by mutations or CBMs) by spending move, which lets them to pit their skill against the Cover-modified Profile of all the objects in that area. Traits like Near-sighted or Farsighted could be added for penalties to these checks based on their relative effects.

The same applies to the player. A player can wear items to reduce their profile, crouch or crawl to avoid detection and apply their Stealth skill. Mobs will usually only perceive passively. When they hear noises they attempt to spot in the tile where they think they heard the noise from, alternating between spotting and moving toward the source. When they smell something, they attempt to simply follow the scent as normal, pausing to spot centered on their own tile.

How does this tie in to traps? Well, traps are just hidden objects. An antipersonnel mine would be hard to detect in a field of grass filled with battered appliances and cabinetry. The person whom places a mine applies a bonus based on either their Traps skill or their Stealth skill. I feel like stealth should determine how well-hidden they are but it might be simpler to stick with Traps. Traps would also determine how much extra damage a trap does, its activation-rate, hit-rate and how hard it is to disarm. Essentially, individual traps would have their own profile scores with bonuses for clever or stupid placement through the skill of the trapper. Common traps like bear traps could be spray-painted to match certain kinds of terrain (street, forest, field, etc)

A Power Goal: The player delivers supplies for making bombs to a faction. When the player leaves the faction's territory and returns, Reginald the faction-trapper has used his fledgling skill to place mines around the base, warning the player via radio if they are on good terms with the player. The mines all have profiles related to the skills of Reginald.

It's a long-shot goal, but I think how the player perceives the world around them could use an overhaul that would sweep up Trapping with it and putting a nice cozy space for Stealth

KA101 commented 10 years ago

Long-term ideas are great and all, but since this is a Blocker (meaning that until it's resolved we aren't releasing the next stable version) we kinda prefer more compact/easier solutions. Thanks for keeping that in mind.

Hague commented 10 years ago

Okay then, just implement the last part then, whereby the trappers skill when placing the trap is checked to determine how hard it is to detect and disarm. Traps will store the Trapping skill of the Trapper and it's directly opposed by the traps skill of the person whom is attempting to locate them:

Difficulty-to-find = Base Profile (base perception required to find) of trap (bigger traps have higher profile) + (Trapper's Trapping Skill - Searcher's Trapping Skill) checked against the player's perception. This way trapping is an opposed task. Perhaps add some scaling effectiveness bonuses and penalties based on the result of the opposed skill check. Meaning if the trapper's trapping skill is higher, their traps will do more damage. This means trap's can have maximal effectiveness against dumb creatures but creatures with inherent Trapping skill would be more resistant to traps, less likely to set them off, etc

Probably set a default Trapping skill for traps in already-generated areas. Then modify the world-gen to include raw skillsets for the "builder" of that particular zone. So if a generated area was assumed to have been or is occupied by a master trapper, then the traps there will be more dangerous and harder to detect than even advanced traps set up by amateurs. Perhaps scale the skill progression based on the skill of Trapper involved too. Better placed or more efficient traps represent a more robust learning experience for the player disarming them.

jeremyosborne commented 10 years ago

Here's the current function that I think is at the heart of this:

bool trap::can_see(const player &p, int x, int y) const
{
    return visibility < 0 ||
        ((p.per_cur - const_cast<player&>(p).encumb(bp_eyes))/2) + ((const_cast<player&>(p).skillLevel("traps"))*2) >= visibility ||
        p.knows_trap(x, y);
}

And rewritten without casts and adding pseudo code:

bool trap::can_see(const player &p, int x, int y) const
{
             /* Trap visibility less than 0, always visible */
    return visibility < 0 ||
        /* Players current perception - players eye encumbrance + trap skill * 2 */
        ((p.perc - p.eyeEncum)/2) + (p.trapSkill*2) >= visibility ||
       /* Player has seen the trap before. */
        p.knows_trap(x, y);
}

Reference:

Quick fix to add challenge but not really break the current game or expectations:

Traps 0 worst roll: ~1.4 * 3 + 1 = -5 (penalty against can_see, rounded down to int)

Traps 4 and above still have a minor fudge. This will end up being more atmospheric than anything, as traps will start to be noticed more as one walks around.

An additional stroke of luck could be added that occasionally gives a bonus for those with bad perception.

And tiredness and other maladies could be added in to make trap detection worse.

Then again, if the fix right now is to: remove stashes (one of the earlier suggestions which I like) and then reimplement "stashes" as flavored areas, the simplest fix to this blocker is that.

jeremyosborne commented 10 years ago

Please ignore my idiotic math above. I'm taking a stab at "fixing" this with math that seems to work. See the PR above.

kevingranade commented 10 years ago

nothing wrong with cocktail napkin math that doesn't work out in practice :)

KA101 commented 10 years ago

OK, with the rework merged and no significant issues, closing.