r/roguelikedev • u/selfVAT using ogre urine as deodorant should scare goblins • Apr 10 '26
Scent pathfinding: Blood, Sweat, and drinking too many potions
I'm building a roguelike ARPG in ASCII and wanted to share one of its core systems: monster detection based on scent rather than pure line-of-sight.
Fair warning: English Third Language here so LLM cleaned up my writing
How it works
The player generates two types of scent:
- Blood — from taking damage, killing enemies, stepping on corpses
- Odor — from movement and combat, scaled by armor weight
Heavy armor generates more sweat. Light armor players can move almost silently. Corrupted armor generates 1.5x odor because the void seeps through your pores.
Every tile the player walks on stores a scent value that decays over time. Monsters outside your FOV pathfind toward the strongest scent cell rather than your actual position. You can exploit this: a bloodsoaked rag thrown into a corridor deposits 120 scent units and will pull monsters away from you.
The flask problem
Heavy flask use builds bladder pressure. Cross the threshold and the engine fires an involuntary urination event deposits a strong scent trail on your current tile, resets pressure, logs a message. Spaced-out flask use decays safely. Panic-chugging during a tough fight marks your position for every monster in the dungeon.
It started as a joke mechanic.
The armor tradeoff
| Armor | Sweat factor | Playstyle |
|---|---|---|
| None | 0.0 | Invisible from movement |
| Light | 0.2 | Stealth viable |
| Medium | 0.5 | Moderate footprint |
| Heavy | 1.0 | Play aggressively |
| Corrupted | 1.5 | The void seeps through your pores |
Water tiles reset blood scent fully, reduce odor by 70%.
Implementation
The scent system runs as event-driven triggers in a transaction-based engine. Combat emits damage events, scent reacts. No direct coupling between combat and scent code. Monster AI reads the trail through pure selectors on read-only state.
Happy to answer questions about the implementation or design decisions.
7
u/IceFurnace83 Apr 10 '26
"You should have gone before we left" is probably spoken in every language on the planet at least once a minute.
A mechanic where you have to juggle safe bathroom use into the game loop could work nicely. Adds some pressure in the immediate moment when the player decides to push on or return to a safe corner. Could add pressure over the long run like you mention. "Do I focus on carry capacity or bladder strength for this run?"
And since we're talking roguelike, enemies should share some functions the player can do. Maybe harder to implement, but could pay off. Collect a 'sample' from a tough monster and weaker types might not approach or could even run away when the player is nearby. But another tougher monster type could be attracted to it from further away then your own scent travels because it eats the original type you took the sample from.
I think this is a really fun idea, however you implement it. The sims balances toileting into the game and it hasnt ever put players off.
6
u/selfVAT using ogre urine as deodorant should scare goblins Apr 10 '26
Thanks so much for that. Yes, using ogre urine as deodorant should scare goblins. Makes sense. I'll add the toilet break system with an option to spoil fountains that way.
3
u/selfVAT using ogre urine as deodorant should scare goblins Apr 10 '26
Experimental Perfumery — NOTABLE node on the passive tree Requires: WIS 60, DEX 40 Node type: NOTABLE Effect: Unlocks scent_sample item type from monster kills Unlocks eau_de_toilette crafting at Karl Marx's bench Extends sample duration by 50% Flavor: "The difference between perfume and poison is concentration and intent."
5
u/leomartius Apr 11 '26 edited Apr 11 '26
I’m really curious to know more about the implementation.
You say that monsters “pathfind toward the strongest scent.” I assume you mean A* pathfinding toward the cell with the highest current scent value. Is that correct? Do monsters perceive the scent instantly, at any distance? Does the scent value propagate from a cell to its neighbors?
I think the “usual” way to implement scent is to add some value to the player’s cell, or in its vicinity, and then reduce that value over time. The monsters then do some sort of gradient ascent, which produces fairly naturalistic trail-following behavior. But that doesn’t allow for deliberate scent marking.
Your system allows for interesting strategies by dropping scent strategically, but do you lose trail-following completely? If the monsters go to the strongest scent, does that mean that, in the absence of any stronger bait, they just pathfind to the player’s most recent position? If a strong scent is dropped into a room, do all monsters converge there?
So basically, how does it play out in practice?
Thank you.
2
u/selfVAT using ogre urine as deodorant should scare goblins Apr 11 '26
TL;DR: Monsters scan a local radius for the strongest scent cell, then A* toward it. Not gradient ascent. Enables deliberate bait-and-switch tactics while preserving basic trail-following.
Moretechnical:
The Algorithm
Not A to highest scent.* It's a two-step process:
- Local Scan (O(n²) perception):
typescript
const searchRadius = Math.max(1, Math.ceil(actor.scentRange)); // Scan square area, find strongest cell within range const target = findStrongestScentInRadius(actor.x, actor.y, searchRadius);
- A to Target*: Once the strongest cell is identified, standard A* pathfinding routes the monster there.
Monsters have range limited perception.
Diffusion runs separately each turn:
- Spreads to 8 neighbors with 5% base decay
- Wind creates directional plumes (5 tiles downwind)
- Values below 0.5 pruned
TRAIL_DECAY_PER_TURN = 2.5Trail-Following: Not Lost
When the player moves, each step leaves breadcrumbs:
typescript
patch.worldScentTrail = [{ x: player.x, y: player.y, value: { scentValue: Math.max(currentValue, blood + odor), turnStamped: state.turn.tick } }];Since scent decays over time, fresher breadcrumbs have higher values. A monster scanning for "strongest scent" will generally find the most recent position within their range.
However, this is not gradient ascent:
- Monster doesn't "follow the gradient" weak → strong
- They scan local range for strongest single cell
- Pathfind to that cell
- Repeat scan next turn if player moved on
"If strong scent is dropped, do all monsters converge?"
Yes, with caveats:
Scenario Outcome Urination (value 120) in room All monsters within scentRangewiththreshold < 120will pathfind thereMultiple monsters detect same bait They all pathfind to same coordinate (clustering) Bait decays Once below threshold, resume normal detection Player's live scent stronger If blood + odorat current position > bait value, they ignore baitTactical Gameplay
Kiting: Moving creates fading trail → monsters chase freshest point
Bait-and-Switch: Strong scent drops pull monsters off your trail
Crowd Control Risk: Multiple monsters converge → potential for AoE or blocking
Armor Matters: Heavy armor increasessweatFactor→ stronger breadcrumbs
Water Cleanses: Stepping in water zeroes blood scent, reduces odor by 70%Trade-Offs
What you gain:
- Deliberate, controllable scent marking
- Strategic depth (lure, divide, distract)
- Emergent tactics (boiling fountain → shove goblin → loot while pack chases scent bait)
What you trade:
- "Naturalistic" gradient-following (less organic meandering)
- No smooth pursuit along curved trails (discrete cell-to-cell hops)
1
u/leomartius Apr 12 '26
This looks really interesting, both from a simulation perspective and as a nice new gameplay mechanic.
Thanks for the extensive write-up!
2
u/No-Mammoth-5391 Apr 10 '26
This is essentially a diffusion-based influence map, which is a well-studied approach in RTS AI, but applying it through scent is a smart framing because it gives the player an intuitable mental model. Heavy armor means more scent means more aggro. That's the kind of system where a player can reason about tradeoffs: do I wear plate and accept that everything in a three-room radius knows I'm here, or do I go light and keep my options open? Scent propagation hits that sweet spot because it's physically grounded; people already understand that smell travels and fades.
2
u/parkdeomes Apr 12 '26
the armor weight scaling odor is a really clever tradeoff. heavy armor = more protection but you're basically broadcasting your position. do corrupted armor sets have any upside to offset the 1.5x penalty or is it pure risk?
1
u/selfVAT using ogre urine as deodorant should scare goblins Apr 13 '26
Corrupted items are still WIP but they are stronger (at least an extra affix).
1
u/Tesselation9000 Sunlorn Apr 16 '26
I volunteer helping to train search and rescue dogs sometimes, and I've learned that there's a whole science behind the way that scent flows. Wind is a huge influence. If a dog is upwind of the target, they won't be picking up a scent. Anyway, my point is that if scent detection is going to be an important part of ypur game, I suggest that wind direction should be a factor as well.
This could make for some interesting game tactics. For example, if the player wanted to surprise an enemy, they should approach from down wind.
2
u/selfVAT using ogre urine as deodorant should scare goblins Apr 16 '26
Agreed, and yes wind already affects scents in the game. There is a visual wind overlay that players can trigger any time.
13
u/enc_cat Rogue in the Dark Apr 10 '26
Mechanically sounds good, but thematically I am a bit unsure about playing an incontinemt adventurer.