At the moment, I've got a system in place where I record a gamepad state in a struct and store this in a list of states to record the input for the duration of a videogame. The full state of the pad takes up 192bits per frame but this is a little wasteful. For example, if the analog triggers on the pad aren't being pressed they still take 32bits up, each, in storage. So obviously I'm looking to save some space.
I had tried setting this to NULL but it appears to have no effect on the size of the binary file that the system saves at the end of the match.
What alternatives are available in a situation where you only need to record or save certain values but retain the integrity of a data structure?
EDIT:
I think I've found a solution; of sorts. Earlier I tried setting values to NULL by overriding the standard float with System.Nullable in the struct. My idea is that setting this to a NULL value in the struct will serialize much smaller. I'm under the impression that NULL is recorded as 4bits. It might be more, it probably is. Anyway, the code I had earlier had a rather glaringly obvious fault so I've gone back and fixed it again. Now I'm getting much much smaller replays and the accuracy seems to be just as good so I'm going to assume that the NULL trickery is doing something properly.
Not in a struct, I think. You may need a bit more complicated protocol.
For example (very rough and not thought through) (WHAT 3xough):
The first byte contains the state of 8 buttons, one bit for each button. If a bit for a button is set to 1 the client (I call it the client for now) expects more specific data for that button, like direction and such, in a specific order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With