Modbot to Help You Run Games: Now With A Votecounter Demo!
- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- yessiree
-
yessiree heMafia Scum
- yessiree
he- Mafia Scum
- Mafia Scum
- Posts: 4386
- Joined: June 6, 2013
- Pronoun: he
have you considered Node.js? there is a built in http-server module that launches a local serverIn post 49, Psyche wrote:after a bit of research, i think the solution here is to give clients an application that starts a private, local server (like a pyinstaller-packaged flask app)
that delivers our html/css/js/etc-based user interface in their browser at http://localhost:.../
and talks w/ the interface to execute whatever python functions the clients need for their goals
then you can use w/e js framework to hit your python endpoints- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
Node.js would probabaly have to replace the entirety of the Modbot code with js or suffer unnecessary complexity. Flask would probabaly handle this better since it's for python.
On second thought, electron may have the same issue as node.js, but I honestly don't know enough about it to say for sure.
Prodbot will probabaly have to wait till next week. I had an issue with my license plates being stolen this weekend.Last edited by Flubbernugget on Sun May 06, 2018 8:22 am, edited 2 times in total.- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
- yessiree
-
yessiree heMafia Scum
- yessiree
he- Mafia Scum
- Mafia Scum
- Posts: 4386
- Joined: June 6, 2013
- Pronoun: he
node.js would only be hosting the web app that has the UI, not the main app
the python code base stays as is, the only change that's needed is to expose the current methods as endpoints so the clients can access them with XHR requests; there are a couple ways of doing that (the endpoints package comes to mind)- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
If the python has to expose xhr requests (which is ultimately just http), it would be just as capable of hosting a gui front end?
Psyche, what is your motivation for wanting the gui to be web oriented? I get that you don't want to reinvent the wheel, but there's a lot of batteries included python options in this regard (kivy comes to mind).- yessiree
-
yessiree heMafia Scum
- yessiree
he- Mafia Scum
- Mafia Scum
- Posts: 4386
- Joined: June 6, 2013
- Pronoun: he
- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
biggest motivation is to make it easy to produce a user interface that looks good and works well across all platforms and is easy to change and improve going forward without thinking about the underlying functionality
in my experience, it’s just harder to make a whole new interface than to use what modern web browsers already provide us
maybe i’m wrong though
remain open to other ideas
and ofc even if i do stick to this approach, if someone wants to do it differently, our API will help them do that too- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
ok ive tried a few things and thought some more and i think i will stick to flask rather than electron or stuff like it
the reason i was going to try to use electron or eel or whatever is because i thought it would result in a smaller app that would be easier to distribute in return for giving up the flexibility i like about flask (scale it into an external-facing server in you want!)
however, it seems that a packaged electron/python helloworld app takes about as much space as a packaged flask app, so in my mind i'm thinking "why give up functionality?"
if we make this in flask, and make it right, then users will have their client-side app they can use for their own purposes,
and also have the option of deploying it online such that their modbot instance can be accessible from anywhere as long as your main computer stays online
the biggest application of this possibility is that it would open the door to helping people mod games from their phones or other web-connected devices that aren't their "main" computer: as long as you'll be it's only user, it's easy and free to make a flask app web-accessible - an example: http://flask.pocoo.org/snippets/89/
beyond that, if someonedoesdecide to maintain a persistent server for mods across the site to use modbot on, then an flask app will easily scale into that role just through configurational changes, while an electron app might not (or at least i don't know to do that)- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
i want to quickly belt something out to test my ideas about a clientside app
i think to start i'll make a pagetopping bot
an app that stalks the input thread for opportunities to pagetop it
it's really simpke to make botwise (simplest approach would maybe be to just have donbot periodically check the number of posts in the thread, and if it's numberPosts % 25 == 0, post) so i can focus on the problem of making a client-side tool. At the same time, though, a bot to automatically reserve pagetops is a legitimately useful modding tool. Later, it can seamlessly scale into the votecount pagetopping bot that is this project's current medium term goal.
I'm planning to set it up with an index page that lists currently implemented modding tools, so that appending a new tool to the app is as simple as setting up another page.
This will all be really barebones at first, and improvements, at least by me, will focus on ease-of-use over beauty, etc.- yessiree
-
yessiree heMafia Scum
- yessiree
he- Mafia Scum
- Mafia Scum
- Posts: 4386
- Joined: June 6, 2013
- Pronoun: he
I have some ideas about a way to get all the most recent votes from living players
1. get a list of living players (most likely from config or a mod post)
2. get the ISO of all living players (through the activity overview screen), run these requests asynchronously, sort by timestamps in DESC order
3. parse the content and get the most recent vote/unvote, return the post #
4. wait for all the ISO requests to finish
5. compile the results- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
pagetopper interface is done and doesn't look bad at all (though it does look plain!)
i've even tested temporarily exposing the app to the internet using the snippet described here: http://flask.pocoo.org/snippets/89/
enabling me to configure, start, and stop the pagetopper from the web browser on my phone
i still need to try packaging this app and ensuring the resulting exe is not too big and works on both mac and windows oses but - this all seems to be working out!
Here’s what it looks like on my phone: https://imgur.com/a/FlMk2XZ
I suppose I really need to leverage default values if I want this to truly be easy to use on mobile. Maybe let the user specify that stuff when they first start the server.- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
So, yeah. I'm pretty satisfied gonna design the entire modbot around that simple interface. Will push all the parts to github when I feel like it.
Now that I have the pagetopper and the interface done, all I need to do is make the pagetopper pagetop with votecounts instead of genericly specified posts.
...and several other things- yessiree
-
yessiree heMafia Scum
- yessiree
he- Mafia Scum
- Mafia Scum
- Posts: 4386
- Joined: June 6, 2013
- Pronoun: he
I finished the prototype for this. PR on githubIn post 62, yessiree wrote:I have some ideas about a way to get all the most recent votes from living players
1. get a list of living players (most likely from config or a mod post)
2. get the ISO of all living players (through the activity overview screen), run these requests asynchronously, sort by timestamps in DESC order
3. parse the content and get the most recent vote/unvote, return the post #
4. wait for all the ISO requests to finish
5. compile the results- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
cool
the async thing is really interesting; i hadn't learned how to do that yet
also really like your use of the activity overview screen, as calling "getUserID" for each person would've been a bit more expensive;
i may split that into a separate donbot function if you haven't already, as it'll definitely be useful for a lot of different purposes- yessiree
-
yessiree heMafia Scum
- yessiree
he- Mafia Scum
- Mafia Scum
- Posts: 4386
- Joined: June 6, 2013
- Pronoun: he
we get a little boost in performance if we run code in parallel (ie. if we're getting the user id for 10 users, we can send out 10 separate requests simultaneously then wait for all to finish, VS sending one, wait for response, send next one, wait for response etc...)
for python people either go with asyncio or gevent- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
Looked through the PR's. Cool stuff!
What's the difference between gevent and asyncio? I know what a coroutine is, but don't have much experience with either library.
Also, any naming conventions in mind? I'm used to class names being nouns.
Prodpot PR up sometime before tonight!! Just got the code done. Tested it (only for one post with a prod deadline of zero days). Need to figure out the jupyter doc thing, and actually write docs next.- Psyche
-
Psyche he/theySurvivor
- Psyche
he/they- Survivor
- Survivor
- Posts: 10574
- Joined: April 28, 2011
- Pronoun: he/they
- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
- Psyche
-
Psyche he/theySurvivor
- Psyche
- Flubbernugget
-
Flubbernugget Survivor
- Flubbernugget
- Survivor
- Survivor
- Posts: 11751
- Joined: June 26, 2014
- Flubbernugget
Copyright © MafiaScum. All rights reserved.
- Flubbernugget
- Flubbernugget
- Psyche
- Flubbernugget
- yessiree
- Psyche
- yessiree
- Psyche
- Psyche
- Psyche
- yessiree
- Psyche
- Psyche
- Psyche
- Flubbernugget
- Psyche
- yessiree
- Flubbernugget
- yessiree
- Flubbernugget
- Flubbernugget
- yessiree