129
me and rule (lemmy.blahaj.zone)
submitted 1 year ago by Anangrierterrarian to c/196
you are viewing a single comment's thread
view the rest of the comments
[-] AVincentInSpace@pawb.social 2 points 1 year ago

Oh my God, I hate mental illness deniers. I sometimes wonder -- do they tell people with asthma to "just breathe"? So sorry that happened to you. Hope you can get out from her making her medical decisions soon.

Anyway, yeah, the database search was definitely a more complicated way to do this! This is actually my second e621 bot for Discord -- my first one was written in Python and used the traditional API approach. After Discord added slash commands and deprecated the old message based command system, and Discordpy didn't add support for making slash commands for like a year, and when they did it was buggy and it took a whole day for slash commands I added/changed to show up in Discord, plus I ended up having to rewrite/rearchitect most of my code anyway to accommodate things that one command system could do that the other couldn't... I eventually decided it wasn't worth the effort to continue maintaining it, so I put the project on hold and decided if I was going to do this, I was going to do it right. Nothing came of it for a few years until I discovered the database export section on e621.net, whipped up a quick script in Rust to search through it with my fancy pants search features, saw how well that worked and how fun it was to use, and thought "hey, I should turn this into a Discord bot!" It took another While(tm) for me to find the time and motivation, but I did. I ended up rewriting my previous bot completely from scratch in Rust, just like all the memes say. It was a lot more fun than it sounds. (Side note, the Rust programming language is fantastic. It's a bit hard to learn, but the developer experience is second to none and the performance really is as good as they say. I could gush for half an hour.)

Doing the searches using the database dump was a lot harder than just using the API, for sure, but I'm super glad I did. I learned a ton about high performance code (I spent a few days thinking of ways to optimize the search, and by the end, using a modified linear search and a library that adds parallel map/reduce similar to Java's Streams, I was able to search through the entire database of ~4 million posts, averaging ~50 tags each, in one fifteenth of a second across all cores of my laptop (6900HX) -- try that in Java!) and the end product is so much better than the original that I don't see myself going back. Just as soon as Rust gets a proper GUI library I'm going to turn it into a standalone client. Or maybe a webapp.

Do hit me up though if you need any help with Discordpy or py-cord. Admittedly I haven't worked with those particular libraries in a while, but I still might be of help -- I do know a fair bit of Python (it was my language of choice for 8 years before I started learning Rust), and I'm extremely familiar with the Discord API. Also, if Discordpy's cog system works anything like how I remember (and last I checked, it did, even after the slash command rework), I'll probably be able to help with the plugin issue you were having.

As for automatically selecting a weapon based on the distance from the mouse cursor to the player character, I think that's a very cool system! It feels a bit risky though; it could work well if done right, but would be a bit counterintuitive and could easily lead to picking a weapon the player didn't expect/didn't want if an enemy was just on the edge of the weapon switch boundary. I think putting faint concentric circles around the player showing the boundaries, or having the mouse cursor change appearance based on which weapon was auto-selected, to let the player know what's going to happen when they press Fire, would give a better sense of control. If you're already planning on having the player sprite change based on what weapon is out I'd recommend making the cursor change too. Having the same information in multiple places so you don't have to move your eyes as much could really help (at least to me -- this is your game, after all!). I would also (if you can think of a graceful way to do it) add a way to override the auto selection so you can say "I don't care how close that horde of zombies is, I want to launch a grenade at them." Here are a few ways I just now thought of that you could potentially do that, neither of which are really ideal (feel free to contribute your own):

  • Only auto switch one of the mouse buttons, and keep mouse2 always set to the same projectile
  • Make the mouse wheel or number keys or somesuch switch weapons but bind mouse3 to be "return to auto switch"

If it's an auto-fire type game, the system you described could work well as is, but I'd definitely add different fire sounds/bullet colors to the three weapons if you haven't already.

[-] Anangrierterrarian 3 points 1 year ago

well what can i do? gotta deal with her for at least 2 more years. Thats soon(tee emm) enough.

Mhm rust interesting. Ive heard a lot of good things about it but never decided to switch from python to it because it sounded a lot harder than py. Might be worth to learn it for silly little things. Wow that is a very fast search speed. You must be really good at programming!

Thanks for offering your help, but i think ill be fine on my own. I did end up getting it working last night(best way to spend my halloween night am i righte) so turns out maybe all i needed to do was wipe my old pc clean a third time. my old pc went through a whole lotta piracy and fucked installs. I think there were at least 3 asesprite failed installs before i figured out libresprite is literally the same but without the hastle of fucking with the command prompt lol.

Thank you! Yes i tought about literal edge cases, i havent implemented it yet but i was thinking about delaying for just a few frames the actual weapon switch, so an undesired weapon switch wouldnt happen as often. I had thought about changing the cursor to the corresponding weapon, but the idea of faint circle lines to show boundaries better would also work, if not better than the cursor idea. Maybe ill combine the 2? I dunno i feel like with both there would be too much clutter on screen. Maybe (if i figure out how) a settings toggle for either one, both or none would be the best choice. But then again like 6 or so people will actually see this completed when(if) i finish it.

Mhm those are some interesting ideas. I think ill do something with the mouse2 down the line, just havent thought what exactly. Maybe something like rechargable skills to give you the edge when you need it, but i feel like it would get too big and i never end up actually finishing it. The game is not autofire btw, reasons i dont really like vampire survivors and clones of it is exactly the autofire and just how little the player matters. The game practically plays itself after a bit and i dont really see the point in that. Makes me wonder why i spent so much time playing tower defense games lol.Oh also i figured out how the preload/load functions in godot work(not as in how the actually work in engine im not that good to reverse engieneer an entire engine) so i actually made the very basics for the game (incredible progress ik). Only thing missing before its somewhat playable is enemy AI but that will have to wait a good week.

Oh lastly i checked out how to ADHD's videos as i said i would and... yeah im starting to think i might actually have it. As i said tho wont get a real diagnosis until im out of this hellhole, and maybe out of italy completely too. God i hate this place.

this post was submitted on 27 Oct 2023
129 points (100.0% liked)

196

16574 readers
1790 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS