Open egeriis opened 5 years ago
We should discuss this.
Should we upload demos to S3 (or can we utilize some localstorage?). This PR is working on the upload-component.
Also, should we roll our own parser? I've found some libs which could be interesting.
Lastly, @steffenagger you might be interested in this issue.
Some more research: It looks like saul/demofile is our best bet if we want to utilize something already written in Node. Alternative theres: node-CSGODemoReader also written in Node and demoinfocs-golang written in Go.
This project (csgo-demo-visualizer) is a great project were he utilizes saul/demofile as well, however have a paragraph saying:
The demo-files need to be parsed first. Parsing is currently done using saul/demofile. The parser is in another project (due to errors when using demofile in combination with React). The parser parses the replay-file and creates a JSON-file for each visualization.
I have not yet tried, but will properly soon start a branch were we can work on it together.
already written in Node
We want browser compatible JS so we don't need a server imo.
There's also a Rust project (can compile into WASM—likely requires some patching tho): miedzinski/demoinfogo
Personally I'm not worth much in Rust, I was thinking an Electron app, where we can utilize the file system & maybe some WebRTC for multi-viewer purpose (at a later stage)?
https://github.com/saul/demofile claims it's Browserify-able... and links to a 6.3MB js bundle. No idea how that works.
Just to get my hands dirty, I gave it a shot to write my own DEM parser yesterday. Turned out to be a real hustle, and really difficult to find your way around the format. Mostly because it is h̷͇͔̗͚͓̀̈̀̉̆ͅő̶͔̱̮̳͖̈̽͊̎̇͝r̷̡̡̲̗͕͇̥͉̈́̈́̾̽̅̀͂͋̈̚ͅr̴̦̟̾͜ͅi̸̤͓͙͖̜̣͗̈́̔̾͂b̷̛̯͈̀̄̂͒́͛̅́̋ļ̵̪͌͆̐̌y̶͙̩̺̯̠̒ͅ documented.
I kept peeking at saul/demofile
to see how it was solved there, and I realized that the solution he's made it very thorough and well written. Although I have some gripes with some magic number, and the obvious, that it doesn't parse some DEM files. I think though, it's solvable through a PR or the existing discussion @casperstorm has opened.
What is left to be answered with regards to using saul/demofile
is related to what you, @steffenagger, point out. How can we use this lib in the browser, and how can we use it without having to include a 6.3M bundle. I'm assuming it's possible to just include it as part of our build pipeline, but it requires a proof of concept to get that answered.
Parse DEM files to TBD intermediate format.