Flamethrower Mojo Investigation: Part 4 of 4 @sigsegv-mvm
Flamethrower Mojo Investigation: Part 4 of 4  @sigsegv-mvm
Uploaded July 2016 | Updated November 2026, 23 hours ago
Part 4 shows a non-flame-related hitreg bug with the same root cause. Server-side clock correction can cause close-range crossbow bolts aimed at teammates to miss them completely. Shots against enemies don't suffer from the problem. (Read on for why.)

Timestamps:
0:05 Clip 1: no clock correction: CollideWithTeammatesThink consistently occurs immediately after firing
0:28 Clip 2: with clock correction: CollideWithTeammatesThink becomes inconsistent and is frequently very, very late
1:03 Clip 3: point-blank crossbow tests with a teammate
1:48 Clip 4: point-blank crossbow tests with an enemy

Q: What is CollideWithTeammatesThink?
A: Projectiles use CollideWithTeammatesThink as a timer. You know how rockets or grenades will pass through teammates if fired from close range, but will actually hit teammates from long range? That's controlled by this. When the projectile spawns, it sets the CollideWithTeammatesThink to occur in the future, after a certain number of milliseconds. Prior to the Think, the projectile will ignore teammate collisions; after the Think, the projectile will not ignore them.

Q: So why does the crossbow have trouble hitting close-range teammates?
A: CTFProjectile_HealingBolt::GetCollideWithTeammatesDelay returns 0.0, which means that crossbow projectiles should be able to collide with teammates right away, instead of having an initial delay where they won't hit teammates like other projectiles. What this actually means is that when the projectile spawns, it requests that the CollideWithTeammatesThink occur at the current time + 0.0 seconds. But because of server-side clock correction, the "current time" it's seeing may actually be in the future. So in actuality, CollideWithTeammatesThink doesn't happen until tens of milliseconds after the bolt is fired; as a result, the bolt ignores teammate collisions for that initial interval. And ignoring teammate collisions means that the bolt won't detect if it hits a teammate and should apply healing.

Q: Why is hit registration against enemies unaffected?
A: Projectiles always detect hits against enemies, no matter what. It's only hit detection against teammates that critically depends on the timing of when a Think (specifically CollideWithTeammatesThink) happens.

Q: How is this different from the flame situation?
A: Unlike flame entities, crossbow bolts don't do basic stuff like hit detection in a Think routine; they let the game engine do it the normal way, for the most part, and so it's not as if the projectile is completely non-functional if it's not thinking. But since projectiles do use a Think as a timer to change their "should I collide with teammates" flag, they are still affected by the underlying clock-correction issue, just in a different way.

Q: Why does this matter? What was the point of showing crossbow stuff in a video series ostensibly about Flamethrower Mojo?
A: The point is to demonstrate that the underlying issue behind Flamethrower Mojo has the potential to be screwing up all sorts of other things, many of which we probably aren't even aware of. The actual core problem is this: many entities (primarily weapon entities) are simulated on the server in a player's clock-corrected context; and these entities often spawn other entities (e.g. projectiles); and when these other entities are spawned, they set up various things (timestamps, SetNextThink times, etc) based on the clock-corrected value of gpGlobals->curtime. Then, when these secondary entities are themselves simulated, they are no longer in a clock-corrected context, and so any time-based logic (be it Think times or timestamp comparisons or whatever else) will fundamentally be "off" by a non-insignificant time interval.

Q: That sounds like a pretty wide-reaching problem. Are there ways to fix this?
A: Yes, I've come up with some potentially workable solutions, and I've emailed what I've come up with to Valve (along with all the other information about the problem). They may also find their own ways to work around it beyond what I was able to suggest. So don't get the impression that this is a huge, fundamentally unfixable problem. It can be solved. Most likely, none of the developers ever really considered this particular set of circumstances when implementing clock correction for player simulation.
Flamethrower Mojo Investigation: Part 4 of 4Why its occasionally possible to outright kill Sentry BustersServer mod: custom engiebot AI behavior for WranglerMedic bot shields screw up bot pathingLazy engiebotsMod: enable bots to use Wrap Assassin alt-firePyro, get on the tank! IIThat pyro healing debuff thing added in MYM is very screwed upAttribute class airblast_dashesBugginess involving abandoned MvM engiebot buildingsServer mod: new/wacky canteen effectsFeign death ragdolls shriveling up: reliably reproduced
sigsegv |

"Flamethrower Mojo" Investigation: Part 4 of 4

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER