demofile-net
demofile-net copied to clipboard
Projectiles getting immediately deactivated in POV demos
Research
- [X] I've already searched and I could not find an existing issue or discussion about this issue.
Description
In POV demos, when a projectile is thrown, it gets immediately deactivated (IsActive = false) and his position doesn't update anymore.
Code to reproduce
using DemoFile;
using DemoFile.Game.Cs;
using System.Diagnostics;
internal class Program
{
public static async Task Main(string[] args)
{
var path = "pov.dem";
var sw = Stopwatch.StartNew();
var demo = new CsDemoParser();
List<CBaseCSGrenadeProjectile> projectiles = new();
demo.EntityEvents.CBaseCSGrenadeProjectile.Create += e =>
{
projectiles.Add(e);
};
demo.EntityEvents.CBaseCSGrenadeProjectile.Delete += e =>
{
projectiles.Remove(e);
};
var reader = DemoFileReader.Create(demo, File.OpenRead(path));
await reader.StartReadingAsync(CancellationToken.None);
while (await reader.MoveNextAsync(CancellationToken.None))
{
//projectiles.RemoveAll(e => !e.IsActive);
int numActive = projectiles.Count(e => e.IsActive);
var projectile = projectiles.FirstOrDefault(e => e.IsActive);
//if (projectile == null)
// continue;
//if (demo.CurrentDemoTick.Value % 100 != 0) // rate-limit
// continue;
Console.WriteLine($"[{demo.CurrentDemoTick.Value / 64f:F4}] {numActive} {projectile?.EntityHandle.Value} {projectile?.Origin} {projectile?.Rotation}");
}
Console.WriteLine($"Finished in {sw.Elapsed.TotalSeconds:N3} seconds");
}
}
Affected demos
all POV demos
This also happens for weapon (CCSWeaponBase) entities. They seem to be randomly deactivated, even those that are held by demo recording player. It probably happens for other entities aswell, but I haven't checked them.