Saturday, February 13, 2021

Discord Bot Creation

I usually only make blog posts about art here, but since I'm not making a ton of blog posts anymore, I decided to switch things up! This might mean more frequent blog posts about various processes, even if they're not solely art-related. But this is going to be a rather lengthy text post.

tldr; I used to use mIRC commands to make my characters talk, but now I'm learning how to implement that into Discord through creating my own bot.

Here's the difference:


Discord has been the main platform that I use for communication for the past few years, not too long after it was released. And in the past year, I've started to finally learn how to code, mostly in JavaScript. So creating a Discord bot is something I've been interested in for awhile.

So I'm going to talk a little bit about how I got here and where I started actually, when it comes to programming.

The Origin: mIRC

Back in 2002, I came across Pojo's DBZ website (which I guess still exists?) and entered into their chatroom. From there, I learned what chatrooms were and quickly made some cool friends on there, (some of which I still talk to this day!) and downloaded mIRC, since it was an easier way to access more servers than what was just on that website. And once the main server I used went down, I had to figure out ways to keep in touch with these friends, most of which I only had access to their IRC username, and no other form of contact with them.

But with mIRC at my disposal, I started to learn very basic programming commands, just by poking around in the Alias files or various other areas. I downloaded some bots to play fancy games and a lot of the friends I met on there were programmers or had some knowledge in the field, and were able to answer some of my questions.


Eventually, in 2006, my brother and I decided to go on a server where we would make our characters talk, much like we used to do when we played with action figures as kids. Some servers would ban your IP address if you had multiple accounts logged in at once, so we were really pushing it just by having the two of us log in on the same IP address. So we wondered... how can we make multiple characters talk without having to type and format their text every single time? Well, poking around in the alias files, our questions were answered.

Alias Files in mIRC

mIRC has some default commands programmed like opping someone or kicking someone from a channel. So I ended up copying some of that code and realizing that I could use the same command used to op a user to type /characterName and print something.



Eventually, I modified the kick command to create a pop-up window to allow the user to type in a text instead of a reason for kicking them. So with all of that, I knew how to type /characterName and have it print out text that the user typed!


Eventures

So this is what led to my current writing style, actually (which I call writing Eventures). I join a server and type commands for my characters to speak, and it prints out nicely with their text colors and everything. I save out the logs and view them in Patchou IRC Log Viewer whenever I want to view them as if it's on mIRC. We're probably the only ones on the planet that write our story fully this way, but it's really the only way I can get in the zone!

Transition to Discord

mIRC had been my main communication platform until 2011, when I slowly started to use newer social media platforms to communicate with people I knew in real life. Because let's face it, none of my real-life friends had ever heard of IRC or wanted to use it, but I did still use it to communicate with my online friends. I was constantly trying to find something that felt as much like home as mIRC did, but nothing really did. My college friends used Facebook Messenger and Skype to communicate for years, and looking back at it, I can't imagine using either of those to keep in touch with people now.

Finally, Discord came around and it had a lot of similar features to mIRC, which made me really like how it functioned, and it started to feel like a home, just like how mIRC has always felt. And when I got a smartphone, I got spoiled being able to talk to my friends on mobile and PC (which mIRC was unfortunately lacking). Even my online IRC friends moved to Discord so I can still keep in touch with them there. Discord was still missing a bit of customization though. I couldn't just pop open the Alias files and type my own commands easily like mIRC did, and I couldn't change the color of text.

For years I had been wishing that Discord would add something like this. So finally I decided to research bots and see what I could do with them. While it ended up being much more complicated than one line of code like mIRC had, it's getting closer to what I was hoping for. And now that I understand programming a bit more, I'm capable of making a bot myself that does close to what mIRC could accomplish.

The Discord Bot

I started by watching Drew Conley's tutorial video on how to set up Discord.js. I learned a bunch of the basics like using VS Code's terminal to have the bot join the server and sending messages to the channel. From there, I knew enough to start experimenting on my own.

I started to research webhooks, and had something working pretty easily where each webhook could be associated with a different character, and it would show their icon and name. This was pretty much exactly what I wanted, aside from the names not having role colors.


But then I found out you're limited to 10 webhooks per server, and I have over 50 characters that I wanted to include in this, so that wasn't going to work. I then started to read through Discord.js documentation to see what I could do, when I came across embeds. I then worked through various stages of how I wanted it to look until I ultimately got to where I'm at now.

This was mostly through just trial and error. I eventually made a webhook for each color, then used embeds, functions, and roles to accomplish what I wanted.




I'm still looking into ways of hosting the bot online so I don't have to run the terminal every time I want to use these commands, but I'm getting there and this was a fun learning experience for the past week!

Thanks for reading through this long process! Not a lot of people know about my origins with mIRC, and it was really what started my interest in programming at the young age of 9-years-old. I probably wouldn't have as much interest in pursuing it further if it wasn't such a big part of my childhood. 

If you want to see more coding process blog posts, let me know, and that might be something I do more of in the future!

Monday, February 1, 2021

Slumbered Apart: Global Game Jam 2021

Over the weekend, my brother and I worked on our 7th Global Game Jam project together! This time was a bit different, since we weren't in the same room together, we worked virtually. It turned out not being all that different since we were screensharing and voice chatting the entire time. We just had to use Google Drive to transfer files instead of a flash drive.

Here's where you can play our game:


This year was also different with everything being online, so the theme "Lost and Found" was announced early in the week, giving us some extra time to brainstorm ideas.


On Tuesday, we brainstormed what the game would be about. Then on Wednesday and Thursday, I drew the walk animations for our two playable characters, Pamchan and Gojo.



Friday was when we started to work on the game more. I figured out some of the basic UI and we started programming the basic mechanics in RPG Maker MZ. This was our first time making a GGJ game in MZ, all the others had been in MV.


Saturday is when we developed most of the game. I started by getting a dialogue system working and some of the beginning story portions.


My brother finished one of the backgrounds, I imported the UI, and he got a system working where objects would be highlighted when going near them.


We continued to program mechanics, finalize art, and work throughout all of Saturday night and into Sunday. I ended up working on story and overall sequence of events more closely with the gameplay than I usually do in these projects, so it was fun.


Towards the end of the night, I helped clean up some of our more sketchy backgrounds.


And then after the last tests, I added the map and the ability for it to fill up areas over time as you explore new places.


And finally, we made the finishing touches and uploaded the final build to itch.io here and the GGJ website here! You can download it for Windows, macOS, or play online in the browser with the itch.io link.


This was the first time where I was able to play through our game and then go back and make small changes afterward. Normally I'm too tired and ready to be done, but this time I was motivated to make small changes and just make it better. There are still some things I would've liked to do to improve it, but I'm happy with how it turned out! And this was definitely the most ambitious project we did for one of these, but we ended up finishing it!


So in conclusion, some of the things that I learned and tried out in this GGJ include:
  • Storing dialogue styles, pictures, and transitions in Common Events so that I could use them like functions, calling them every time a dialogue event happens. I started doing this with my other RPG project for game mechanics, but this was the first time I tried it for showing dialogue, and it made me less hesitant to do transitions and effects.
  • Using player position data! We used this to switch between characters and save their map positions. We also used it for positioning the dialogue bubbles above their heads. I still could've played around with it a bit more to make those positions more precise, but it was a learning experience!
  • Using simple switches to show a map that progressively unlocks each time you visit a new place. This one I actually made fairly easily in the last few minutes before we uploaded the project, it was just something I hadn't thought to do before!
  • Utilizing plugins for allowing everything to be played with the mouse or keyboard. Previously I had always tried to program one or the other, but allowing the player to choose which gameplay style they'd prefer was a great outcome!
Check out our game and let me know what you think in the comments!