timotheeg / nestrischamps

A web-based OCR and restreamer system for NES Classic Tetris players
MIT License
45 stars 11 forks source link

Seekable replays and StackRabbit integration #112

Closed timotheeg closed 2 years ago

timotheeg commented 2 years ago

After months of procrastination, I finally have refactored the Game class to record stats as the game progress instead of just keeping the running stats for the playhead.

This change enables game replays to be seekable. This has been a long-requested feature! This was quite painful to track data for score events and piece events in a memory efficient ways.

I've implemented native controls in the classic and das_trainer controller for now, and I threw in a simple integration with Stack Rabbit. When reviewing a game, you can ask Stack Rabbit what placement it would have made and then check if you did that. Basically it's a StackRabbit coach for your personal game reviews!

Replay UI is rather crude, but it works well enough for my own needs for now. SnapShot below:

image

This needs more review testing. I'm opening the PR to look at the changeset before I push it, and I'll reach out to @GregoryCannon to inform him about potentially new API traffic coming in. NestrisChamps is not a very high traffic site, and the implementation I did requires a human click for each query to StackRabbit, so hopefully the load will be very low.

Still TODO: