Vanilagy / MarbleBlast

A web port of Marble Blast Gold and Marble Blast Platinum.
https://marbleblast.vaniverse.io
MIT License
131 stars 18 forks source link

Enable world record replays to be viewed and downloaded in-game #17

Closed thearst3rd closed 2 years ago

thearst3rd commented 2 years ago

Hi Vani! This is something I've thought would be neat for a while, and I figured I'd take a stab at navigating the mbweb codebase and implementing it. If it's not something you want in the game, feel free to decline this PR and I won't be offended :) Also, I'm not really much of a web developer so I had to stumble around a few things as you can probably tell from the code.

This pull request enables world record wrecs to be played/downloaded/rendered in game by exposing an api endpoint which sends encoded wrec files to the client. See this quick demo:

https://youtu.be/ip3ZoYI07kk

Since PQ has this functionality, I've gotten used to being able to check out top scores and I thought it'd be fitting for mbweb to support it as well.

Some design considerations:

Some implementation considerations:

Anyways, this was a fun project I whipped together in the last few hours. I feel like the mbweb community would enjoy this feature given how active it is and how often new records are set, and regardless of if you want to merge this, thanks for all your hard work on Marble Blast Web!

Vanilagy commented 2 years ago

Looks mostly good to me, actually. I'll fix up some small things to get rid of the base64 stuff and maybe clean up the code a bit, but this is mostly great work! Thanks for the PR.