Skip to content

Urpagin/Discraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discraft

Playing Minecraft through Discord!

Important

This project is almost finished. I just need the determination to wire up the last bits and debug the tricky bugs.

💡 The Original Idea

I wondered: would it be possible to play Minecraft through Discord? That would require some knowledge of asynchronous programming, wouldn't it? And it is quite funny, isn't it?

I first tried to implement it in C++. I hit problems at the very end when I tried to mix Asio, asynchronous programming, class inheritance, and multithreading. I had written absolute spaghetti code riddled with memory leaks.

⚙️ How It Works

Below is a diagram explaining how the components interact with one another.

discraft_diagram

APP is the program.

Note: Each side of the app (client and server) controls one Discord bot.

🧠 The Logic

  • Listen for TCP packets coming from the Minecraft client.

    • Convert TCP packets into text suitable for Discord.

      • Send the text to Discord.
  • Listen for Discord messages.

    • Parse the Discord messages into bytes.

      • Send the bytes through the socket to the Minecraft client.

The only difference between the client side and the server side is the order of events. On the server side, we first listen for a Discord message. On the client side, we first wait for the Minecraft server to connect.