Browser Extension Vote-Counter (early demo)

This forum is for discussion related to the game.
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #25 (ISO) » Mon Sep 18, 2023 1:55 am

Post by JacksonVirgo »

I wanted to work on something that didn't need you to add aliases for abbreviations or other things like this, and I want it reliable so I wanted to make sure to really put effort into fine-tuning, of which I don't really have time for rn
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10721
Joined: April 28, 2011
Pronoun: he/they

Post Post #26 (ISO) » Mon Sep 18, 2023 6:09 am

Post by Psyche »

ok great!
i think i want to contribute along those lines if you're open, as i've done a lot of the legwork already in my various abandoned projects.
i'm willing to make sure it's in the right language and style too.
i think all i'd need to set things up is the initial implementation for the part of the code that parses votes
id implement a measure of parsing performance based on ability to predict lim outcomes across past games, setting up an efficient way to consider alternative parsers
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #27 (ISO) » Mon Sep 18, 2023 6:20 am

Post by JacksonVirgo »

In post 26, Psyche wrote: ok great!
i think i want to contribute along those lines if you're open, as i've done a lot of the legwork already in my various abandoned projects.
i'm willing to make sure it's in the right language and style too.
i think all i'd need to set things up is the initial implementation for the part of the code that parses votes
Of course :D
It's better to not reinvent the wheel after all

To be super clear I'm working in Typescript and the place I'm using the library is "/src/app/votecount.ts" line 123.

If you have any questions let me know.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #28 (ISO) » Mon Sep 18, 2023 6:23 am

Post by JacksonVirgo »

It's literally just a library I'm calling though so if you want the implementation they used, here is the JS file
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10721
Joined: April 28, 2011
Pronoun: he/they

Post Post #29 (ISO) » Mon Sep 18, 2023 6:48 am

Post by Psyche »

thanks. will be somewhat slow-going bc of what i'll have to learn but i'm legit happy for the excuse
User avatar
RH9
RH9
he/him
Mafia Scum
User avatar
User avatar
RH9
he/him
Mafia Scum
Mafia Scum
Posts: 2907
Joined: November 15, 2019
Pronoun: he/him
Location: Epping, New South Wales, Australia

Post Post #30 (ISO) » Mon Sep 18, 2023 11:09 am

Post by RH9 »

In post 16, JacksonVirgo wrote:
Update v0.0.3 Changelog:
Download Link
  • The wagon formatting will now have the larger wagons at the top.
  • No-Elimination now is implemented with unique majority mech. 50% of living players is needed rather than a flat majority.
  • I've implemented new game definition settings, allowing to disable specific functionality. Currently only can disable no-elim but can easily be extended or copied into a way to add special/unique functionality that isn't usually used.
  • Now has manifest v2 support (so now you can run it in Firefox, although the styling in firefox is kinda wacky cuz I haven't focused on designing for it yet)
Spoiler: Technical Changelog
Putting this in a spoiler as chances are, not everybody cares about this side of it.
  • Added README to the repository so anyone and their mother can know how to compile this for themselves (unless I worded it like I usually do, which is probably the case :D)
  • Changed the folder structure to make it clear what files are background scripts vs main scripts.
  • Added ESLint so I can avoid shooting myself in the foot later
I might try this out the next time I mod something.
GTKAS: 2022, 2024

v/la every weekend

indefinite hiatus from mafia solo
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #31 (ISO) » Tue Sep 19, 2023 9:45 am

Post by JacksonVirgo »

I'm not sure how reliably this thread is getting checked, if nobody that can answer this answers it I'll ask the right people directly but is it permitted/okay to add a form of analytics to the tool, it would be to focus on being able to identify and fix bugs, and also to know what feature gets used the most etc (to see what should be focused on).

The stuff logged would be
  • The thread the VC was requested for
  • The VC settings that was requested
  • The user who used the tool
  • Time when the tool was used and the time it took to process everything
Stuff like this.
The VC settings/thread is to be able to replicate the issue when errors pop up.
The time and user is just nice information to have but not super important
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #32 (ISO) » Tue Sep 19, 2023 9:45 am

Post by JacksonVirgo »

In post 29, Psyche wrote: thanks. will be somewhat slow-going bc of what i'll have to learn but i'm legit happy for the excuse
Anything is better than nothing, I'm happy to answer whatever question or help in whatever way I can. I'd love any help I can get :D
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #33 (ISO) » Tue Sep 19, 2023 9:54 am

Post by JacksonVirgo »

I'll give you the general rundown of the current workflow I'm using.

The "/src" directory is the root folder as per usual.
The "/src/app" is for content scripts, the scripts that will be run on the site itself.
The "/src/background" is for background scripts. So the code that does a lot of the heavy work like data fetching.
The "/src/types" contains global types and validators. I use Zod, which is not too difficult to understand but I might reword the variables to make it extra clear for you.
The "/src/utils" contains globally used utilities as per the name.

The main.css is what gets injected into the site itself. Might be worth renaming to "injected.css" or something.
I use JQuery (really hurts me) to edit the sites DOM and I use Cheerio (which is like a backend JQuery) to fetch the data so the logic is all the same pretty much.
Using JQuery to create large UI elements is actually cursed but I don't really know how to fix this outside of possibly using iframes but I think they're deprecated? Not sure
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #34 (ISO) » Tue Sep 19, 2023 9:55 am

Post by JacksonVirgo »

Turns out, iframes are not deprecated and might be worth looking into. Not sure
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Ircher
Ircher
He / Him / His
What A Grand Idea
User avatar
User avatar
Ircher
He / Him / His
What A Grand Idea
What A Grand Idea
Posts: 15190
Joined: November 9, 2015
Pronoun: He / Him / His
Location: CST/CDT

Post Post #35 (ISO) » Tue Sep 19, 2023 10:58 am

Post by Ircher »

Can we make a version that works on mobile?
Links: User Page | GTKAS
Do you have questions, ideas, or feedback for the Scummies? Please pm me!
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #36 (ISO) » Tue Sep 19, 2023 11:00 am

Post by JacksonVirgo »

I'm not actually sure, but I'll look into it for sure
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #37 (ISO) » Wed Sep 20, 2023 5:14 am

Post by Thestatusquo »

Jquery is definitely the best way.

What are you having difficulty with?
tout comprendre c'est tout pardonner
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #38 (ISO) » Wed Sep 20, 2023 5:17 am

Post by JacksonVirgo »

In post 37, Thestatusquo wrote: Jquery is definitely the best way.

What are you having difficulty with?
It's not difficult as much as it's incredibly funky to create more complex UI elements using it.
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #39 (ISO) » Wed Sep 20, 2023 5:43 am

Post by Thestatusquo »

Can't you just create a template file and then pass it in as a parameter?
tout comprendre c'est tout pardonner
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #40 (ISO) » Wed Sep 20, 2023 5:44 am

Post by JacksonVirgo »

In post 39, Thestatusquo wrote: Can't you just create a template file and then pass it in as a parameter?
I didn't know that was an option
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #41 (ISO) » Wed Sep 20, 2023 5:45 am

Post by JacksonVirgo »

Oh, no I did know that was an option. I just didn't think of that
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #42 (ISO) » Wed Sep 20, 2023 7:12 am

Post by JacksonVirgo »

Yo it works so nicely, thanks for that. What a legend
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #43 (ISO) » Wed Sep 20, 2023 7:36 am

Post by Thestatusquo »

Welcome to my job lmao.
tout comprendre c'est tout pardonner
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #44 (ISO) » Thu Sep 21, 2023 2:01 am

Post by JacksonVirgo »

This is generally the form design I'm going with. I've still only got the upload input and the two post inputs but I'll flesh it out so that everything needed is there.
Uploading the yaml file is planned to auto-fill the form with all the appropriate data.
It's also an idea to store the data for each thread onto disk so that if you do fill out the form once, on new pages it should be filled by default. Maybe an option to export the form to yaml is an idea.

Image

I want to add member verification to the tool too. So I can verify if a user actually exists with a given name or if you made a typo or something etc. Are usernames case-insensitive when it comes to making it unique? Can a JacksonVirgo and a jacksonvirgo both exist as two accounts?

Either way, the verification method I found is using the member list such as the following link and I can do a quick scrape to verify it but maybe that's a little intense to have for the server? Cuz that's like X fetches for X users and then the game fetching itself. Unsure
memberlist.php?username=JacksonVirgo
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #45 (ISO) » Sun Sep 24, 2023 3:23 pm

Post by JacksonVirgo »

In post 26, Psyche wrote: i think i want to contribute along those lines if you're open, as i've done a lot of the legwork already in my various abandoned projects.
I am curious what you've got, I recall you saying that you do some funky stuff regarding this (from osuka's thread I believe). If you have time I'd love to see how you did it
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10721
Joined: April 28, 2011
Pronoun: he/they

Post Post #46 (ISO) » Sun Sep 24, 2023 4:43 pm

Post by Psyche »

The broad idea behind the validation framework is to bootstrap evaluation of votecounters using info recorded in the site's various game archives.
The game archives tracks for a lot of games who was eliminated each day, and eliminations (usually) depend on votes.
Therefore a good votecounter, given each thread mentioned in the archive and a post number initiating each day, should be able to reliably predict who was eliminated those days.
Not necessarily all of them -- mods can make weird calls or flat-out mistakes, PRs and other shenanigans can mess with hammer conditions, and aliases (like alt or irl names) might have nothing to do with a slot's username.
But still, most of them.

So what I did was take archive data, scrape applicable games, and set my votecounter to predict D1 outcomes across all of them.
Wherever there were errors, I checked them out. I ignored errors that could not be addressed with a fix to my votecounter, and tabulated -- and eventually fixed -- errors that potentially could.
Once errors were addressed enough for D1 outcomes, I similarly generated predictions for successive days.
Frequently, I needed to manually annotate D2+ post number start positions when long twilights messed with votecounting, but this also helped identify cases where the votecounter accurately predicted a lim, but thought hammer happened earlier or later than it really did.

So this method wasn't a perfect way of testing and identifying gaps in the votecounter, but it saved a lot of time compared to the hypothetical alternative of manually coding the target of every vote across games on the site and using those as test cases. And remains usable for new votecounter implementations that might be introduced in the future.

The votecounter was a grab-bag of different techniques. The validation technique confirms it works well, but because of the feedback-driven process behind how I made it, it doesn't have some basic principle behind it.
User avatar
DragonEater70
DragonEater70
He/Him
Jack of All Trades
User avatar
User avatar
DragonEater70
He/Him
Jack of All Trades
Jack of All Trades
Posts: 7769
Joined: February 4, 2023
Pronoun: He/Him
Location: UTC+2

Post Post #47 (ISO) » Mon Sep 25, 2023 8:41 am

Post by DragonEater70 »

Can you please explain how to install on Firefox?

It says the add-on is corrupt when I try to "install add-on from file" and install "manifest.json"
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14371
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #48 (ISO) » Mon Sep 25, 2023 9:19 am

Post by Thestatusquo »

You need to use manifest v2 for ff I believe.
tout comprendre c'est tout pardonner
User avatar
JacksonVirgo
JacksonVirgo
they/him
Survivor
User avatar
User avatar
JacksonVirgo
they/him
Survivor
Survivor
Posts: 13224
Joined: October 29, 2019
Pronoun: they/him
Location: ɐılɐɹʇsn∀
Contact:

Post Post #49 (ISO) » Mon Sep 25, 2023 9:22 am

Post by JacksonVirgo »

In post 47, DragonEater70 wrote: Can you please explain how to install on Firefox?

It says the add-on is corrupt when I try to "install add-on from file" and install "manifest.json"
I've found that Firefox is a little weird when it comes to loading unpacked extensions and you need to load it in a different area than traditional extensions for some reason, probably security. You can do so via the following

These will need to be re-installed every time you restart your browser, which is not ideal so I don't recommend outside of testing.
I am going to be working on getting the extension validated by Firefox itself so you can install it properly and without it being temporary, but I haven't looked too far into it so I have no idea if I can or not but:
  1. Download the latest version here.
  2. Extract the .zip file, there should be two folders within called v2 and v3. If not, you downloaded the wrong version.
  3. Open Firefox and in the URL bar enter "about:debugging"
  4. Press the "This Firefox" option on the left-hand side of the screen
  5. Make sure the "Temporary Extensions" drop-down is opened and click the "Load Temporary Add-ons..." button.
  6. You will be prompted with a file explorer, find the manifest.json in the v2 folder and upload that.
  7. You may be prompted with something asking for permissions to access that folder (or maybe folders that it is under, such as Downloads etc)
"Am I a ghost like you, caught between the seams of two intertwining melodies?"


wiki // GTKAS
Post Reply

Return to “Mafia Discussion”