Repro: observed with the (TSB) "Ideal" class drone's main weapon

xml
BUG_60fps_hitscan.xml
wolfy 23 Jul 2025:

Also seen in VotG with both hitscan beams and some particle explosions

wolfy 27 Jul 2025:

Attached a reproduction mod for the TSB jathira weapon. Note the bug only happens when the ship misses hitting anything, otherwise the beam 'hits' the target and stops traveling

giantcabbage 28 Jul 2025:

It looks like something in the initial setup is now using the wrong time step.

At 60 fps, normal speed, range of weapon appears to be doubled compared to 30 fps

  • If we hit a target in the extended range then beam stops at target
  • If we hit a target within normal range, then beam continues through to full extent of normal range

At 60 fps, fast speed (autopilot), range returns to normal

In slow motion (invoke etc): range is increased 4x? beam is flickering (as firing can only occur on behavior tick)

I suspect:

  • speed is set so the beam will travel the full range in one frame
  • lifetime is one tick (i.e. two frames at 60 fps)
giantcabbage 2 Aug 2025:

Looking at the implementation continuousBeam (i.e. hitscan) weapons are in fact very long projectiles:

  • rendered as a line between head and tail segments
  • segments move up to a maximum speed of 10x light speed
  • movement is all special case code with movement vDeltaPos (vel * 1 tick) calculated in AddContinuousBeam, so does not work if frame rate is not 1 per tick
  • if the beam hits anything then the head position is fixed and we stop updating the segment position

NOTE - This can cause artifacts in the beam direction even in 1.9. To reproduce fly past a target, and fire perpendicular to direction of travel. When the beam does not hit it will be rendered correctly in the direction the ship faces. However, when it does hit the target the beam will be deflected to a different angle as the hit location is calculated before the movement update.

Test weapon uses lifetime=1 so at 30 fps in v1.9 this appears to be a stationary, continuous beam from ship position to pos + velocity * 1_tick

But VotG does include examples with longer lifetimes, some with speeds lower than 10x light speed. These are rendered as long, fast moving projectiles in 1.9

Changing the physics update to match a standard projectile (pos += vel * seconds) improves most of the VotG weapons (in that they appear to behave more like the v1.9 behavior) but:

  • tail position at t=0 can be upto beam length behind ship
  • hit detection is still assuming beam moves vDeltaPos each frame, so beam can still hit beyond the expected maximum range

With the Test weapon (lifetime=1) at 60 fps the visual effect is:

  • beam is continuous for first half, but flickers for second half
  • tail starts behind ship, flickers
  • in slow motion you can see the projectile moving

lifetime=1 weapons may need to be a special case, but to start with I think we need to fix the remaining issues with the lifetime > 1 continuousBeams