Programming Pokemon Showdown replay annotator

Hello everyone,
I wrote a small applet in python that can allow the user to annotate PS replays.
UPDATE: it now lives in a web-app here. The format for the annotations have also changed slightly.

Screenshot (32).png


It will take a .txt file and a .html file of a downloaded replay.
It will take a .txt file now! The link to the replay just has to be on one of the lines.

gameurl#https://replay.pokemonshowdown.com/gen8doublesou-1242164885
annotator#iwayasu
nochat#1
notime#1
0#team preview (before leads)
0*# team preview (after leads)
1#turn 1 early
1*#turn 1 late
Screenshot (45).png
Screenshot (36).png

Format for annotations file:

  1. gameurl: the url of the ps replay. CAUTION: get rid of any '/' at the back of it because the program uses the '<url>.json' version of the replay.
  2. nochat: 1 or 0, all chat and join and leave messages will be deleted from/left in the replay. Can be omitted, defaults to 1.
  3. notime: 1 or 0, all player time remaining messages will be deleted from/left in the replay. Can be omitted, defaults to 1.
  4. annotator: annotations show up as a chat message sent by 'ANNOTATION by <annotator>'. Can be omitted, defaults to 'unknown user'.
  5. # is used to break between turn number and annotation, so don't use it in the message body
  6. turn 0 refers to team preview
  7. annotations appear right after the turn counter
  8. an asterisk (*) behind the turn number makes the annotation appear late. It will instead appear right before the next turn's counter (see image).
  9. The program is now much safer with bad inputs but still not foolproof. WARNING: the program does not except errors right now, so if the input has styling mistakes, it might throw an error. Just check it carefully.
How to use:
  1. write your annotations file on your computer with notepad or something.
  2. paste it in the big white box and click the only button on the page.
    Screenshot (42).png
  3. Wait what could be a very long time (over 2 mins if you have bad internet).
  4. You'll probably see a GitHub 404 page.
    Screenshot (43).png
  5. Change the number for '?ver=1' to any number. Its at the end of the url (e.g. iwas-alt.github.io/......6aa.html?ver=1). I know how dumb this sounds but basically this forces GitHub to update itself. It may take a few times just keep trying 2, 3, 4 etc (it should load by 4).
    Screenshot (44).png
  6. You can now share the link. If you want to download it for safekeeping, just press ctrl+s or right click anywhere on the page and click save as. You'll get a html file.

NEW FEATURE: Adding annotations to an annotated game (suggested by Qwello :D)
The app now takes 'iwas-alt.github.io/ps_game_bank/' links for 'gameurl' They stack!
This one works in a slightly different way and hasn't been updated yet.

How to run the program:
  1. download ps_replay_editor.py as attached in this post and place it in the same directory as your html replay and text file of annotations.
  2. install some version of python 3.
  3. install beautifulsoup (it is a dependency for interacting with html). You can type 'pip install beautifulsoup4' into the command prompt.
  4. launch cmd from the directory your stuff is in/navigate to that directory in cmd.

Screenshot (38).png

(I usually just type cmd into the nav bar and press enter)
-type 'python ps_replay_editor.py --note "<note txt>" --game "<game html>"'. <game html> and <note txt> should be the name of your game and note files respectively.
-In my case I will type 'python ps_replay_editor.py --note "note.txt" --game "game.html"'. Don't forget to put quotation marks (") around the file names.

Screenshot (39).png

(successful execution should look like this. A new annotated_<html name>.html file will be generated in the dirctory.)

Styling:
-I suggest using either only early or late and sticking to it in one replay (IMO early looks better)
-only mix both if there is a specific reason to (e.g. an educational resource in a question/answer format)

Content guidlines/ideas (inspiration from chess):
  1. annotations can be any length, really
  2. they can be of any style (humorous, dry, personal etc.)
  3. they usually appear on key turns
  4. they can explain another line of play that was not chosen and the rationale/implications of it
  5. call out amazing/questionable plays and explain the reasons
  6. the gold standard would prabably be a BKC video in text form >_<

Sorry if something similar already exist. I tried looking around but couldn't find anything. I made this because I was trying to study mons on my own by watching some tournament games. Even though I tried really hard to pause the replay quiz myself every single turn and attempt to understand each player's thought process, there were still some decisions that I couldn't fully understand. To get the help I need, my best options were to sign up for battling 101 or just hang around PS chatrooms and ask for help. I think annotated games will fill in a gap in smogon's resources. Battling 101 is amazing but its not accessible to everyone (e.g. irregular schedule, shyness etc). The pokemon analysis writeups do not teaching piloting as much as teambuilding, and piloting guides tend to be more general advice. I think a lot of the playerbase trying to improve can greatly benefit from the chance to play over annotated master games (kind of like in chess where this is super common). This will especially helpful for less popular tiers like DOU (which I play) since there are zero DOU content creators on YT (that I know of) so its really hard to find a pro explaining their turn-by-turn thought process. I present this tool mostly as a proof-of-concept. I would love if in the future there are programs set up encouraging tournament players to perhaps annotate one or two of their own/each others games after the tournament. It would also be awesome if there is some centralised bank where players can upload annotated replays and good efforts can be upvoted or something. I think something like this can be absorbed under Battling 101 or be its own initiative with an associated badge as an incentive because I sincerely think such a resource will be very useful.

Any feedback is welcomed :D
Feel free to suggest new features or remix it on your own and post it
I'm new to smogon and this is my first post so please go easy on me >_<

I've also started a thread in DOU about it so drop by if that sounds interesting :D

More screenshots for reference (I think its a random DWCOP game):
Screenshot (31).png
Screenshot (34).png
 

Attachments

Last edited:
I've made a massive update to it. Some small bugs/qol and the program now lives in a web app on heroku! There is no longer any downloading or python knowledge required to make it work! Check out the updated OP for more :D
 
Heyo! I recently saw someone use this tool to annotate a natdex ag game. Thats super cool :D. However, they took many tries and each time a new file is created and added to the github repo. Its not a big deal and github pages has basically infinite storage, but it looks kinda messy. Therefore, if anyone uses this to link a game on to the forums, please pm me/leave a message on my wall the url of the annotated game you link, so when I periodically clean the github repo out I don't accidentally break your link.
Y'all can see every game uploaded here btw https://iwas-alt.github.io/ps_game_bank/
If anyone wants a game deleted from the bank, pm me or propose a pull request (but I don't check it too often so its better you pm me too).

Every new annotated game has a random 8 char hexcode appended to it to prevent conflicts, instead of replacing the previous file. Theoretically this allows for someone to annotate the same game twice, but it also generates trash files. I don't really feel like redoing it right now since its not getting too much traffic such that manually cleaning it is unmanageable and it still functions perfectly as is.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top