Making a Game With Discord's Bot API
HTML-код
- Опубликовано: 1 июн 2024
- I challenged myself to make a game using Discord's Bot API in 24 hours. I ended up creating a clone of Sokoban, a puzzle game where you push boxes around to get them to certain locations, that is played entirely through a Discord bot!
Update: Sokobot is now hosted online, 24/7! You can find the invite link below. I also added a lot of your suggestions to the bot- you can check out the update trailer here: • Sokobot v.1.1 Trailer ...
Add it to your server through top.gg: top.gg/bot/713635251703906336
→ Source code: github.com/PolyMarsDev/Sokobot
Twitter: / polymarsyt
--Chapters--
0:00 Intro
1:35 Discord Bot Basics
2:18 Adapting the Game for Discord
3:08 First Test + Bugfixes
3:48 Improving Controls
6:43 Improving Visuals
8:01 Simultaneous Games
9:07 Conclusion
--Resources/libraries used--
JDA (Java Discord API)
github.com/DV8FromTheWorld/JDA
Making a Basic Discord Bot with Java - Oliy Barrett
/ making-a-basic-discord...
Code a Discord Bot in Java with Discord JDA! (Episode 1: Commands & Embeds) - techtoolbox
• Code a Discord Bot in ...
--Music--
"Tyrant" - Kevin Macleod (incompetech.com)
"Bit Quest" - Kevin Macleod (incompetech.com)
"Getting it Done" - Kevin Macleod (incompetech.com)
"Sneaky Snitch" - Kevin Macleod (incompetech.com)
"8-Bit Dungeon Level" - Kevin Macleod (incompetech.com)
"Amazing Plan" - Kevin Macleod (incompetech.com)
"Robobozo" - Kevin Macleod (incompetech.com)
I spent the past week creating an update to Sokobot that implements most of your suggestions like editing messages! You can check out the trailer here to see the changes: ruclips.net/video/xp8S2uZI8jM/видео.html
And Sokobot is now hosted online, so you can use this link to add it to your server: top.gg/bot/713635251703906336
Thanks for all the feedback!
how do i change prefix?
Hey polymars when i tried to do play it would just delete the message and do nothing
i have a good idea, make a bot to beat this game
Can you release the game that you made for your class? I would love to play.
For some reason it isn't working
-Are you a game developer?
-Yes
-What is your engine?
-discord
lol
:p
edit: thks for all the likes 2nd most liked comment in my account
Hotel?
Trivago
l͓̽o͓̽l͓̽
Eu li e vc leu?
Everybody gangsta til the walls develop emotions
Nice
😳
the Kyles don't give a sh*t they shall keep on punching the drywall
😳😳😳😳😳😳😳😳😳
😳 😳
😳 🟧 ❎ 😳
😳 😳
😳 😳
😳😳😳😳😳😳😳😳😳
monki
gf: "You don't even care, I feel like I'm talking to a wall!"
the wall: 😳
I know what to do but i don't know if i have the strength to do it
Modern things needs modern answers
@@Sufiley solutions
@@Sufiley Modern problems, call for modern solutions.
I didn’t understand until I finished the video-
Him: *"I give my self 24 hours so im in deadline..."*
Dani: *Finally a worthy opponent*
YEAAHHH A DANI FANN
"Its not a game dev video without an arbitrary deadline" 💯
I scrolled and he said that right as this comment showed up
monki
rammamia
@@TSwany i was about to say that
Great! Now we can talk about games and play them in the same program! +1 for efficiency
Haha yeah! Love your videos by the way, keep up the great work :)
@@PolyMars can you host it online now?
Test Test good grief i don't have a discord account and i don't want to make it anyway
Upgrade +1 efficiency
*Unreal Discord*
They now partnered up
this video's intro hits hard now.
a way to tackle the issue of reactions being added slowly would've been to have the bot edit the message with the moved character instead of sending another one, also would've stopped spam.
i was thinking this exact thing
You should edit the message instead of sending a new one each time. This also fixes the reaction 'slowness' issue!
In addition, discord (recently?) added the ability to delete user reactions so after you make a move it could simply delete your reaction
Eneg you can also track un-reactions to messages too so you don’t need to wait for the bot to delete the reaction for you.
@@eneg_ not recently, u coulda gone to "Reactions" and there delete it
@@hershes You have any idea how to do this in discord.js? Because it would solve a huge problem for me lol
This is the BIG brain suggestion
can't believe I got a shoutout
Lel
I’m Blue
Idot >:(((((((((
I’m Blue fr
Dream go back to Minecraft >:c
Embedded
Recently found your channel, currently doing discord bots with python, and your use of hashmaps was exactly what I was looking for to allow multiple users to use my oracle bot, thanks!
I’m ready for the “speeding running 100 levels of sokobot” videos
So, when is the discord engine comming?
Also instead sending more messages, try editing them so it looks smooth
I can’t believe I didn’t think of that at the time! Midway through editing the video someone suggested the same thing, so I’ll definitely implement that next time I update the bot :)
@@PolyMars ayyy!
Wouldn't the original get buried if you continue to type? Also you can only react once emote per message
@@waterflame321 remove your emote and click again AKA double click.
And maybe a button to resend the message
@@waterflame321 but there is a way to make it i have seen it
Finally a RUclips that’s background music isn’t louder THAN THEIR FREAKING VOICE
Me who I dont understand a single thing out of his script: Intresting
Same
but... it literally explains itself
@@Fafr interesting
"I dislike Unity's game engine."
*"Dani, and the entire Norwegian fanbase has ordered your termination."*
0:20
@@nac9880 r/woosh
the bot always deletes: left, right, up, down, w, a, s, d; even if the game is stopped...
Oops, I kind of overlooked that... thanks for letting me know! It'll be fixed in the next update :)
pog
@@PolyMars aighto
@@PolyMars it also seems responding to @Sokobot even if there's other text in the message
@@PolyMars why not edit the message instead of sending a new one each time? This is less resource-intensive because you don't need to add 5 reactions each time.
4:43 everyone gangsta until the pings dont end after you pause the video
Reeeeeererere
😳😳😳
:flushed:
*everybody still gangsta till it's stil there even when the volume is mininum 0*
@@sonetagu1337 m&m*
Great work! Your channel is so underrated!
Got this bot for the discord between me and some friends! The bot is really fun to use!!! Keep up the good work
5:37 Edit the message containing the display instead of sending a new one, then cancel the reaction added by the user. That will keep all the reactions, while updating the display
thas some big brain action
I was also thinking that
@@TheLemonMasterYT it‘s literally the same with Java in this case, editing messages and removing reactions is as simple as sending a message
@@TheLemonMasterYT disgusting python*
This. It would be WAY less spammy and easier on multiple players as well.
Dani be like: I made a game using UNITYS PARTICLE SYSTEM
lol this guy is inspired by dani
There is already a youtuber that did that
@@maxmelee2102 WHAT LOL
asimo gaming yeah his name is Zyger on yt
People need to stop spamming Dani on other devs videos
I'm literally a Discord bot dev, and I use an obscure language BDScript, but this video is great at showing the challenges you face while working on a bot.
Can we just talk about he fact that PolyMars just predicted Unity's future?....
He could edit the message instead of sending a new one
If it's possible to remove reactions from a message, it's definely possible to run the game in a single updating message
@@okinawadreaming It is possible. You can remove other peoples reactions or just the bots reaction. It's a pretty cool feature I use for assigning roles and ensuring that the max reactions aren't reached on the message.
8:56 Yup, as a game developer, I can confirm... that's game devs in a nutshell XD
Lol, hello there.
confirm what
Todd Howard, is that you?
i found you on a youtube video btw i still hate you from gamejolt
@@Temmie4Life and you still haven't explained why.
"unity as a game engine is going downhill" That aged well.
That is incredible! Good job!
I don't know anything about programming, but watching people do stuff I don't understand is fun
lol same
not me xD!!
Same
try learning it, it's fun and maybe practical.
@@theblinkingbrownie4654 I'd say it's practical and maybe fun. It's definitely practical, but most people don't end up enjoying it
Yanderedev has made getting banned from his Discord server a game already, you're too late
Nice joke bro
lmao
Bruh
??im confused
@@dafnir1618 just search up Yanderedev discord ban speedrun
Moral: if anything has a developer api, polymars will make a game with it.
woah i tried out this bot before even knowing you're the one that made it, great job on the bot man
Poly: *Shows Unity and Unreal*
Me: There’s another
Godot!
godot
Unreal discord engine.
no Sympathy required.
SCRATCH!
@@j.r.7339 Get that sh*t outa here!
I made a text-based MMORPG in discord years ago, and it's still going with a big active community, google "rfck endless war."
It's a post-apocalypse slime-centric gang warfare simulation, with PvE and PvP combat, fishing, slimeoid pet battles, and a traversable world with territory capture mechanics. I believe it's the most complete actual game in discord
invite
@@spheghetilover discord.gg mtSRXek
@@luznoceda5322 no
Nice
Wow
Didn't know u made this im impressed and liked the bot and didn't know u made this
Hey man, great video!
10:17 mom I'm on tv :D
I saw it
_tv_
@@irian3x3 I am actually watching this video on my tv browser
Wait WHAT
I couldn't see your name :/
PolyMars : **Says unity**
Dani : **Apears behind him** hey you know that unity has MANY PARTICLE SYSTEMS AND THEY ARE VERRY COOL. . .
*K A R L S O N V I B E*
UNITYS PARTICLE SYSTEM
U N I T Y S P A R T I C A L S Y S T E M
before i use unity's particle system i'd like to thank our sponsor unity's particle system
Yes Dani
no idea whats going on but i enjoyed this a lot, i cant believe i didnt get distracted by something else , because i get distracted very easily. Nice video!! You are very Talented!
i had question for u why bot is offline all day i added it commands dont work pls help ;-;
@@gmereqpl oh- uh idk rly.. i didnt make the bot so yeah
Poggers! Will be downloading/inviteing soon!
Give programmers any sort of API, and they shall make your software their own, right? Discord is now a game engine, what the hell? :D Well done!
there are many other insane game bots, which is another reason why discord is netter than skype
@@aguywhosaguy Agreed. You've reminded me of the times when Skype had actual games in it. For instance, there was a "hangman" game which you could play together with someone over Skype. Not sure if it still exists.
Currently making a game bot myself lol
Not only did the walls sometimes become the flushed emoji, but the player became the wall
Love this type of video, Can you make more vids like this?
I'm having issues with level 4, theres four boxes and they form a square, it's literally impossible to move any, pLs HeLp
Oh yeah, I guess I missed a few edge cases when spawning blocks. The GitHub repository has been updated with a fix!
hi weegee
Wait, this is weegeepie?
woah woah why are you here
E
1). Why am I getting this recommended now, I love this kind of stuff
2). Why does this man not have 100k?
E
does now
Great video keep it up!
I don’t know anything about coding but this is very entertaining and interesting
I Just discovered a poly version of me
Cool
Epic
Cool
Cool
Link for him:ruclips.net/video/8Qt-lmtnp84/видео.html
I remember my friend made Minesweeper with this!
Thats cool
You can go further. There is node js module named "canvas" (as in web) and there is a node js discord module. You can draw picture on canvas and send it player. I used this method when I wrote text stylizer.
Hey @PolyMars , discord added "Buttons" so you can use that instead of reaction controlls, if you do this you are i think the first one that ever did it :D
Can we just talk about how underrated this guy is?
nO
jk
Exactly he is just a low sub count dani
Ayy you have 22K subscribers but no tick mark after your name...why? :/
It’s 100k to get the check mark :/
I was here before 800
are we just going to ignore how much the editing makes this video entertaining and just focus how good this man's coding skills are?
fr this deserves more attention no cap
I just love how the sound track for pocket ants from the mobile play app is playing in the background
Thanks, i have so much fun using sokobot!
He's making everyone in the comments sound stupid
Me who work on my second game 😐
@@the-voidwalker second game doesnt make the first any good
@@neffy184 ik but im making games for my self then if I think game has good potential I work on it for more I have like 4 games I try to make but its easier to make so platform game and im trying to add enemies
@@the-voidwalker uP
What if we 😳😳😳
Pushed boxes to X's 😳
JK 😂😂
Unless? 😳
😳
this made me laugh so hard it sounded like i was murdering sr. pelo
Pls pls help me pls beg me to stop ✋ I wanna play this game its so epic tho
that’s a big funi
Wait I don’t get it, could u explain to me?
ur so underrated lmao keep up the good work!
This is absolutely amazing :joy:
So basically before fixing the "everyone can play" issue, you had Discord plays Sokoban... That's something you can probably expand on with other simple games
I learned programming for the sole purpose of understanding what was written on those dev vlogs walls of code 😂
Is it fun? Because if it is, i'm gonna learn it too >:D
It's so cool to be able to create a game- ;-;
Clara 1707Blox it can be frustrating at first but once u get the hang of it it’ll be easy. Also it feels good when ur code runs exactly how u want it to be.
aged like fine wine
I loved this bruh
U rocked
When you click on a random video that looks cool, find out the person is cool, go to sub, and find out they don't have many subs....
Definitely should have more
"Hashmaps are so OP" - truer shit has never been said
The intro and the ant colony sound is very good
just noticed that we got the same keyboard, and, just wow. this is amazing
For the reactions issue, there's a pretty easy fix. instead of sending multiple messages, have it edit a single message for the game each time it updates and then remove the user's reaction so they can quickly add it back. hope this helps! you can also have it delete the user's message that tells it to move so that it's a single message and it doesn't clutter up chats
Underrated!
I saw you on reddit, and thought i would check the video out, and its also amazing!
Just added this to my server...I LOVE ITTTT
This game looks really fun!
This is underrated af.
Agreed,
yeah but not everyone understands coding sadly
Sayto its hard to understand but its fun to listen to! :D
this channel*
Me: Hears PolyMars hit 1,000 in June. Looks at sub count in August and sees he's at 31.2K
That's crazy growth. Congrats on that many Subs!
@@luznoceda5322 OMG?? He went up like 4k in 6 days??
This game is AWESOME!!
Make another one
You already hit that 100k in stead of 1k:)
It will be amazing if someone does chess like this. Playing chess in a discord interface is my long term dream lol.
there already are several chess bots like this
I love how you used 😳 as the character!
😳
@@PolyMars 😳when is the editing message update coming doe?
😳 ruclips.net/video/xp8S2uZI8jM/видео.html
@@PolyMars cool, thanks!
:flushed:
amazing work!
Just providing a suggestion here :) -- Will editing the embed message after each reaction add, then keep listening to the user's reaction add event until they finish the game or timeout be better? So then it won't have to send a new message and wait for it to add those 5 emojis again and again. And if the user wants to make the same move, they can simply undo the reaction and reaction add again to trigger the event.
I played this on my grandma's old phone back then,
Was actually interesting.
Dude I just found his channel this dude is so damn smart-
Edit: u just got a new subscriber *I'm gonna enjoy this channel*
really good idea, Iliked your vids you have arened another sub good work
For the reactions wich add slowly, I think you can try to replace the ".queue()" at the end of line of the add reaction method by ".complete()", ".complete()" have more priority than ".queue()"
You should just edit the message, the reactions will stay.
Then there would be a problem with going twice in the same direction
@@di5963 uh how
@@TommyW since the reactions stay, when you click on the same reaction the number will go down instead of up
@@di5963 You double click it.
@@di5963 you can make it so that when the reaction is updated by the account its mapped to, the bot will work. You don't need to add the reaction.
4:08 *and thats how the coronavirus started*
0:46 Thanks for the message thats really sweet :D
okay this game is awesome thank you
For the reaction commands a “fix” would be editing the message instead of sending a new one. This will keep the reactions. Then after each click or reaction then removing that reaction.
Other: unity
Poly: *d i s c o r d*
Extremely Pog! Underrated
Lol the intro on this hittin
Saw this on reddit. Nice work man!
scratch < unreal < godot < unity < discord
This seems like a nice video.
I’m also starting in AP Computer Science.
8:17 - I happened to notice you're not taking advantage of the diamond operator introduced way back in JDK 7.
That is rather than creating generic instances like this, as you're currently doing:
HashMap games = new HashMap();
Why not let Java imply the type using diamond operator, which is some situations could even save you from capture related issues? It pretty much looks like this:
HashMap games = new HashMap();
Other than that, really great video, you just gained a sub. Will definitely check out your other content and I look forward to what you'll bring in the future.
You can edit the current embed instead of sending a new one every time you make a move. I think that'd look much cleaner.
That would also eliminate the issue of it needing to send new reacts it should instead remove the users old react when it updates.
Wow this amazing this inspired me to start coding my own bot thanks a bunch 💖
Scratch: *exists*
PolyMars: i’ll pretend i didn’t see that
My friend put ur bot in like yesterday and it is now the most popular bot in his server XD