skadistats / clarity-examples

Example code for clarity
BSD 3-Clause "New" or "Revised" License
115 stars 38 forks source link

How to skip a specific tick (due to exception?) #63

Open ndorigatti opened 3 months ago

ndorigatti commented 3 months ago

Hello, i'm trying to parse a DEM file for CS2 demo (that i'm able to do with a python dem library), but unable to do in java-clarity.

I can open the file in the clarity java fx desktop app (i can see the data, tick and so on), but when i try to open with my code, it fails.

Basically i need to go to last tick and get scoreboard, but the code as in the example fails:

ControllableRunner.seek method throws an exeption and the runner is closed. I don't understand how to skip the frame that makes the crash (103270 over 165098 ticks). As far as i understand ControllableRunner seek just goes over each tick and does not skip any frame. How can i do it? Using another runner?

ndorigatti commented 3 months ago

i got some info about the exception.

Class Field, row 47: public void ensureArrayEntityStateCapacity(ArrayEntityState state, int capacity) { throw new UnsupportedOperationException(getClass().getSimpleName()); }

it goes here, on the entity rootField: CCSGOViewModel

The state toString is Entry[modifiable=true, size=0] and capacity 1

The class is ValueField, here is the stack trace:

11:05:46.203 [main] INFO xyz.ndorigatti.cs2.Main - tick 103269/165098, synthetic false, had 35 messages Exception in thread "main" java.lang.UnsupportedOperationException: ValueField at skadistats.clarity.io.s2.Field.ensureArrayEntityStateCapacity(Field.java:47) at skadistats.clarity.model.state.NestedArrayEntityState.setValueForFieldPath(NestedArrayEntityState.java:107) at skadistats.clarity.io.FieldChanges.applyTo(FieldChanges.java:20) at skadistats.clarity.processor.entities.Entities.executeEntityCreate(Entities.java:445) at skadistats.clarity.processor.entities.Entities.lambda$queueEntityCreate$4(Entities.java:440) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at skadistats.clarity.processor.entities.Entities.processAndRunPacketEntities(Entities.java:321) at skadistats.clarity.processor.entities.Entities.onPacketEntities(Entities.java:313) at skadistats.clarity.event.AbstractInvocationPoint.invoke(AbstractInvocationPoint.java:86) at skadistats.clarity.event.Event.raise(Event.java:41) at skadistats.clarity.processor.reader.InputSourceProcessor.processEmbedded(InputSourceProcessor.java:245) at skadistats.clarity.event.AbstractInvocationPoint.invoke(AbstractInvocationPoint.java:86) at skadistats.clarity.event.Event.raise(Event.java:41) at skadistats.clarity.processor.reader.InputSourceProcessor.processSource(InputSourceProcessor.java:172) at skadistats.clarity.event.AbstractInvocationPoint.invoke(AbstractInvocationPoint.java:86) at skadistats.clarity.event.Event.raise(Event.java:41) at skadistats.clarity.processor.runner.AbstractFileRunner.initAndRunWith(AbstractFileRunner.java:38) at skadistats.clarity.processor.runner.SimpleRunner.runWith(SimpleRunner.java:33) at xyz.ndorigatti.cs2.Main.doParse(Main.java:116)

spheenik commented 2 months ago

Hey, sorry, I was busy with other things. This looks like the replay is corrupted. Can you provide it?

ndorigatti commented 2 months ago

I created a new issue, and shared the file in the library issues: https://github.com/skadistats/clarity/issues/321 Maybe if I can manage the main issue i don't need to skip ticks?!