saul / demofile-net

Blazing fast cross-platform demo parser library for Counter-Strike 2 and Valve's Deadlock, written in C#.
MIT License
111 stars 10 forks source link

Add support for reading from HTTP broadcast streams #93

Closed saul closed 2 months ago

saul commented 2 months ago

Closes #53

saul commented 2 months ago

@in0finite I'd be keen for you to try this out and see how it works for your use case.

One problem I had that I haven't fully resolved yet, is that DemoFile.Example.HttpBroadcast seems to churn through data faster than the data is received from the server. Sure it's a silly mistake somewhere but just a heads up.

in0finite commented 2 months ago

@saul How do you test this now that there are no official CSTV+ servers ? I found this project which is "CSTV+ ingest" server, and also this explanation from tournament organizer, but that's all.

saul commented 2 months ago

@saul How do you test this now that there are no official CSTV+ servers ? I found this project which is "CSTV+ ingest" server, and also this explanation from tournament organizer, but that's all.

I've been using Deadlock streams: main menu > Watch > pick any game, then read the http://dist1-ord1.steamcontent.com/tv/xxxxx in the console.

in0finite commented 2 months ago

I tested it using this approach:

start CSTV+ ingest server:

git clone https://github.com/FlowingSPDG/gotv-plus-go cd gotv-plus-go go run ./examples/inmemory/fiber/main.go -port 8080 -auth gopher

start CS server:

launch CS type in Console:

tv_enable 1
tv_broadcast_url "http://127.0.0.1:8080/gotv"
tv_broadcast_origin_auth "gopher"
tv_broadcast 1

Play => Practice => Competitive => (optionally enable Infinite warmup) => Start

test parser:

you will see similar line in Console: [HLTV Broadcast] Broadcast[0] Recording started at http://127.0.0.1:8080/gotv/s58401682302641926t4945538495

by starting the parser using that URL, following error appears:

System.NotSupportedException: 'Unrecognised serializer field: m_ProviderType'
    DemoFile.Sdk.CEntityInstance<TGameParser>.CreateFieldDecoder(DemoFile.SerializableField, DemoFile.Sdk.DecoderSet) in EngineSchema.cs
    DemoFile.Sdk.CBaseEntity.CreateFieldDecoder(DemoFile.SerializableField, DemoFile.Sdk.DecoderSet) in Schema.cs
    DemoFile.Sdk.CBaseModelEntity.CreateFieldDecoder(DemoFile.SerializableField, DemoFile.Sdk.DecoderSet) in Schema.cs
    DemoFile.Sdk.CBaseAnimGraph.CreateFieldDecoder(DemoFile.SerializableField, DemoFile.Sdk.DecoderSet) in Schema.cs
    DemoFile.Sdk.CBasePlayerWeapon.CreateFieldDecoder(DemoFile.SerializableField, DemoFile.Sdk.DecoderSet) in Schema.cs
    DemoFile.Sdk.DecoderSet.CreateDecoder.AnonymousMethod__1(DemoFile.SerializableField) in DecoderSet.cs
    [External Code]
    DemoFile.Sdk.DecoderSet.CreateDecoder<T>(DemoFile.SerializerKey) in DecoderSet.cs
    DemoFile.Sdk.DecoderSet.GetDecoder<T>(DemoFile.SerializerKey) in DecoderSet.cs
    DemoFile.Sdk.DeadlockDecoderSet.TryGetDecoderByName(string, out System.Type, out DemoFile.Sdk.SendNodeDecoder<object>) in Schema.cs
    ...
    [Call Stack Truncated]
github-actions[bot] commented 2 months ago

BenchmarkDotNet v0.13.9+228a464e8be6c580ad9408e98f18813f6407fb5a, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.401
  [Host]     : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
  Job-UYUHJZ : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2

InvocationCount=1  MaxIterationCount=16  UnrollFactor=1  
WarmupCount=1  
Method Job BuildConfiguration Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
ParseDemo Job-EZBJWY Baseline NA NA NA ? ? NA NA NA ?
ParseDemo Job-UYUHJZ Default 2.246 s 0.0066 s 0.0055 s ? ? 5000.0000 1000.0000 516 MB ?
ParseDemoParallel Job-EZBJWY Baseline NA NA NA ? ? NA NA NA ?
ParseDemoParallel Job-UYUHJZ Default 1.183 s 0.0286 s 0.0268 s ? ? 6000.0000 1000.0000 558.48 MB ?

Benchmarks with issues: DemoParserBenchmark.ParseDemo: Job-EZBJWY(BuildConfiguration=Baseline, InvocationCount=1, MaxIterationCount=16, UnrollFactor=1, WarmupCount=1) DemoParserBenchmark.ParseDemoParallel: Job-EZBJWY(BuildConfiguration=Baseline, InvocationCount=1, MaxIterationCount=16, UnrollFactor=1, WarmupCount=1)