BurnySc2 / sc2-planner

MIT License
48 stars 13 forks source link

Add Python script to parse replays using sc2reader to easily import it on the website #9

Open BurnySc2 opened 4 years ago

BurnySc2 commented 4 years ago

See title.

Python script: reads a SC2 replays which reads the actions (make scv, drop mule, put scv into gas) and converts it to JSON format which can be easily read by typescript on the website.

jtsauls commented 3 years ago

Is the .json format the same as the one exported by "Copy SC2 Bot Instructions"?

Using the spawningtool code mentioned in #1 , this seems relatively straight forward and I could take a stab at it.

I am only confused what "frame" is in that .json. It's around 22-23 x elapsed seconds? Whats the formula for that?

@BurnySc2 Thoughts?

BurnySc2 commented 3 years ago

The formula is time_in_seconds * 22.4 == frames, based on 16 frames per second of the SC2 engine, and because they used the 'faster' mode which multiplies it by 1.4 -> 16 * 1.4 = 22.4.

My goal was to host a separate site (with backend this time) where people could upload their replays and it would spit out a sc2-planner link. I have already started working on it a month ago but have less time recently. I have made the repo public if you want to take a look at it, I'm using ggtracker/sc2reader https://github.com/BurnySc2/sc2-replay-analyser

Now is just the frontend + backend interaction missing for the website (which I would write in React + Typescript + Sanic backend framework) - while the backend uses the sc2-replay-analyser library to parse/analyse replays.

If you purely use the BO instructions from spawning tool, there will be a lot of actions missing - e.g. chronoboost or dropping mules or injects, and sometimes there are weird artifacts in their output (e.g. line with leading comma, sometimes x2).

jtsauls commented 3 years ago

Yeah, that would be a really nice solution with a separate website. Looks like you kind have done all the heavy lifting--I was basically just thinking to write the function sc2planner.create_link. Using sc2reader is definitely the right way to go.

I'll poke around--but don't want to oversell my skills or time. I'm not sure how helpful I can be as I don't have any website experience.

Parsing of the text output from Spawning Tool would definitely be challenging and require assumptions.