View Issue Details

IDProjectCategoryView StatusLast Update
0006623The Dark ModAIpublic13.07.2025 12:00
ReporterJnon Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilityalways
Status feedbackResolutionopen 
Platformx86_64OSUbuntuOS Version22.04.1
Product VersionTDM 2.13 
Summary0006623: Patrolling AI Ignore absence_alert spawnargs
DescriptionIn TDM 2.12, AI would enter an alert state when absence_alert (and absence_alert_increase) flags were placed on objects in the map which were subsequently moved or stolen.
In TDM 2.13, AI no longer seem to respond to these flags. This was initially noticed in during testing of a map created in DarkRadiant, and was further confirmed in a test map created for the purpose of isolating the behavior.

In both cases, the map was made in DarkRadian 3.9.2 amd64. A Loot entity was placed with the flags "absence_noticeability 1" and "absence_alert_level 23" (which should be "agitated searching". Running the map in TDM 2.12 results in agitated searching behaviour as expected. In 2.13, the patrolling AI does not react to the missing loot entity and simply continues patrolling with no change in suspicion level, or even barks indicating a reaction.
Steps To Reproduce1) Create a map in DarkRadiant, placing a loot entity in the path of a patrolling AI with "absence_noticeability 1" and "absence_alert_level 23" spawnargs on said loot entity
2) Run the map in TDM v2.13
3) Steal the loot entity without being detected by the AI, then observe its behaviour during patrol
4) AI will not react

Following the first three steps in TDM v2.12 reliably results in Step 4 being "AI increases suspicion" as expected.
Additional InformationI started a forum thread of my initial encounter with this problem:

https://forums.thedarkmod.com/index.php?/topic/22732-absence_noticeability-spontaneously-stopped-working/

While I have reliably reproduced this error on more than one map on my own system, I have yet to hear of this being reproduced by others, so I cannot rule out that some factor on my own system is causing this error. However, before upgrading TDM to 2.13 this behaviour did not occur, so it still seems likely this is related to the new version. I would very much like to confirm whether or not this can be reproduced by others.
Tags2.12, 2.13, absence_alert_level, absence_noticeability
Attached Files
absence_notice_test.zip (10,656 bytes)

Relationships

related to 0006546 feedbackstgatilov Proper system for measuring light factor of bodies 

Activities

Jnon

Jnon

23.05.2025 09:19

reporter   ~0017030

Addendum: Forgot to mention, the test map I created to reproduce the bug is attached to this issue as "absence_notice_test.zip". File contains a simple map that should demonstrate the problem behaviour if steps for reproduction are followed in TDM 2.13 and 2.12
stgatilov

stgatilov

15.06.2025 10:15

administrator   ~0017040

I wonder if the issue goes away with "g_lightQuotientAlgo 0".
That's the cvar to restore the old code for light computations for AI and the like.
Jnon

Jnon

16.06.2025 11:09

reporter   ~0017041

I can confirm that "g_lightQuotientAlgo 0" restores normal behavior in TDM 2.13 with regard to noticing missing objects in the test map provided below.
stgatilov

stgatilov

13.07.2025 11:59

administrator   ~0017057

From https://bugs.thedarkmod.com/view.php?id=6546#c17056:

===========================================

Supported blood markers and absence markers.

The list of commits:
  r11002 If spawnarg "les_sample_invisible" = 1, then LightEstimateSystem checks samples with invisible materials as well.
  r11003 CAbsenceMarker now uses the model and transform of its owner (i.e. the missing item).
  r11006 Properly supported blood markers in Light Estimate System.
  r11007 Minor fix for debug visualization.
  r17335 Properly configured absence marker to be invisible but included in LES + added default box model.
  r17340 Updated spawnargs for atdm:blood_marker for proper handling in LES.

With absence marker, I managed to solve the problem "the easy way".
When absence marker is created, I set its model to the model of the entity that disappeared.
Of course, the marker should be invisible, so set "invisible" skin in entityDef, which replaces all material with nodraw.
But since LES normally ignore samples from invisible materials, I also added "les_sample_invisible" spawnarg so that it makes an exception this time.

So the absence marker simply retains the samples of the model.
This works OK most of the time, although sometimes some of these samples are permanently unlit because they are inside solids.
For example, the paintings in Scroll of Remembrance partially overlap with their frames.
So when player takes a painting, some of its samples end up inside the frame... and thus they are completely unlit because they are considered shadowed by the frame.
As the result, light value decreases, which makes it harder for a guard to notice the absence.

The blood marker was much harder to support, because its geometry is just a decal on other models (which is reapplied regularly).
I had to implement the concept of "explicit model sampling", which one can set for an entity to override the sampling taken from model automatically.
Implementing this concept was hell of a ride. I created three prototypes: making auxilliary rendermodel to be sampled, passing explicit sampling but storing it inside LES, passing explicit sampling and storing it inside entity itself. The last one looks the most sane, so I sticked to it.
The explicit sampling is an inherent part of the entity state, so it is saved/restored in savegames... although it's not that important for blood markers, since they recreate themselves 2 times per second.

So when the blood marker code applies a decal, it also generates a grid of sample points on the decal surfaces (hopefully a bit above the obstacles) and set it as override.
Sadly, the entity still has to have some "rendermodel", even if it's invisible and LES ignores it too.
That's because there is LightQuerySystem --- the counterpart which actually computes lighting inside renderer frontend.
And this system reads entity transform from renderentity. And if a game entity has no model, it does not create a renderentity!

===========================================

Issue History

Date Modified Username Field Change
23.05.2025 09:18 Jnon New Issue
23.05.2025 09:18 Jnon Tag Attached: 2.12
23.05.2025 09:18 Jnon Tag Attached: 2.13
23.05.2025 09:18 Jnon Tag Attached: absence_alert_level
23.05.2025 09:18 Jnon Tag Attached: absence_noticeability
23.05.2025 09:18 Jnon File Added: absence_notice_test.zip
23.05.2025 09:19 Jnon Note Added: 0017030
15.06.2025 10:15 stgatilov Note Added: 0017040
16.06.2025 11:09 Jnon Note Added: 0017041
21.06.2025 12:50 stgatilov Relationship added related to 0006546
13.07.2025 11:59 stgatilov Assigned To => stgatilov
13.07.2025 11:59 stgatilov Status new => assigned
13.07.2025 11:59 stgatilov Note Added: 0017057
13.07.2025 12:00 stgatilov Status assigned => new
13.07.2025 12:00 stgatilov Status new => feedback