Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting information about recording #14

Closed
Alexejhero opened this issue Mar 23, 2023 · 5 comments · Fixed by #34
Closed

Requesting information about recording #14

Alexejhero opened this issue Mar 23, 2023 · 5 comments · Fixed by #34

Comments

@Alexejhero
Copy link
Collaborator

The Recorder class takes the current game state and serializes it. How do you plan on using the information obtained from it? (I assume for training?)

It would be useful to know the purpose of this class, as well as the design process behind it, so we can maybe add more fields to the frame if they are relevant.

@js6pak
Copy link
Contributor

js6pak commented Mar 23, 2023

Is there really no more efficient way than saving everything every frame?
We might also want to use a simple custom binary format instead JSON.

@JohnyDaison
Copy link
Contributor

JohnyDaison commented Mar 23, 2023

Well, if you wanted to optimize, you could only save the values which changed since last frame. That would reduce the file size, but Vedal would need an unpacking script on his end to get back to original data for training.

@Vedal987
Copy link
Member

The plan is to use this data for training the neural network yes, I made a rough draft on stream of what the inputs/outputs of the network might look like (weird formatting but inputs on the left and outputs on the right):
image
We don't want to limit ourselves to just this data though in case we want to change something later on and don't want everyone to have to rerecord data.

Once we have this implemented, the idea is that viewers will use this plugin to record their gameplay to crowd source data to train Neuro with.

As for how to store this data, I agree we should probably use a more efficient binary store instead of JSON, would be nice if it is easily loadable into Python too since that's what the data will be read in.

@ScrubN
Copy link
Contributor

ScrubN commented Mar 24, 2023

Once we have this implemented, the idea is that viewers will use this plugin to record their gameplay to crowd source data to train Neuro with.

As for how to store this data, I agree we should probably use a more efficient binary store instead of JSON, would be nice if it is easily loadable into Python too since that's what the data will be read in.

https://msgpack.org/MessagePack could be a good open alternative to JSON. It has implementation in a stupidly wide amount of languages including Python and C#. In addition to that, we could implement a button or something to automatically pack many sessions into a single GZip file to further reduce file sizes.

Here is a C# implementation that advertises Unity and seems is still being maintained: https://github.com/neuecc/MessagePack-CSharp
As for Python, here is an implementation that advertises Python3, since the official MsgPack python lib only advertises Python2: https://github.com/vsergeev/u-msgpack-python

image
The msgpack website reports this sample data to be 31% smaller as MsgPack instead of JSON, which after looking at the protocol specification is an over-estimate due to the website JavaScript interpreting the float32s as float64.


Otherwise we could just use BSON, which in theory would be slightly larger than MsgPack. Seeing as we know our specific types work in MsgPack, as long as we don't have more than 4,294,967,295 frames in one array (397.7 hours@50 frames/sec) then MsgPack seems like the superior option.

@JohnyDaison
Copy link
Contributor

The website link is dead now, seems to have moved here: https://msgpack.org/

@Alexejhero Alexejhero mentioned this issue Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants