MMODiscord: Run your own virtual world on any Discord server

Wed Apr 07 2021

tags: public featured programming build idea exploration hackathon project

Introduction

https://github.com/juxd/discord-spatial-layer Hackathon submission link

For NUS HackNRoll 2021 (a hackathon organised by National University of Singapore) we set out to build a virtual world that can sit on top of any Discord server (working name: MMODiscord). This post will be in two parts: first, I'm going to share what we built, and then I'm going to share The Dream: what it could be, and why we would want it.

What we built and why we built it

In lieu of an actual childhood, I fondly recall hanging out and chatting with my friends in Henesys Market and fishing/cutting trees together in RuneScape's Draynor Village.

There's something uniquely magical about that sort of experience, and I'm pretty sure it's not just the nostalgia talking. They seem to better fulfil the raw and real human need for connection.

While has been solved somewhat by chat/social apps such as MSN Messenger, Telegram, and Discord, I've always felt that they never came close to the fun I had just sitting around in the FM with my friends. Useful as they are, something is missing from these apps.

What is missing? What's that je ne sais quoi? I believe it's spatiality and interactiveness. Hanging out in Maple or RS is especially compelling because it has something more than just chat. You can see your friends in the world and hang out together in a virtual space. I've written about this before. You can express yourself with your movement, fashion choices, skills, facial emotions, and so on.

So we know that game worlds have advantages. They're more spatial, more interactive, more immersive, more compelling. So what if we could get the best of both worlds? What if we had a spatial "layer" that sits on top of the social apps we know and love?

The "spatial layer" we built has the following features:

  • Connects seamlessly to your Discord account
  • Move around and chat
  • Chat appears above your head
  • Use number keys 1-5 to change your mood (corresponds to MapleStory)
  • Available both as a standalone webpage and as a Google Chrome extension (see submitted links)

My thinking:

How to use

We came up with a custom authentication solution:

  • Type !joinspace into the server you'd like to; our bot DMs a secret to the user
  • Navigate to our GitHub Pages link here IF ON FIREFOX type in about:config in the URL bar, and set network.websocket.allowInsecureFromHTTPStotrue`
  • Enter secret into the GitHub Pages link
  • You have now joined the spatial layer and can move around, chat and use emojis.

Technical details

We used a couple of libraries:

  • Discord API for the Discord bot
  • Nengi for the multiplayer networking
  • PixiJS for the rendering engine

We built the server auth flow ourselves. The primary challenge is how to match the Discord user with the person who joins the game, so when you type !joinspace our bot will DM you a secret (e.g. "chubby-flappy-bird"). The server knows which secret it's given to which Discord user, so when you enter the secret and join the server we can then assign you the right avatar.

Difficulties and things we've learned

  • Dexter: "I wasted a day on a Chrome Extension"
  • Vignesh: "Bro it's a hackathon there's nothing to think you just do"
  • Julius: We adapted well but we could have a better job at understanding what we wanted.

Why would anyone use this? What is the point of it all?

There are lots of startups in this space like Gather Town, but (in my opinion) they won't get much traction because they aim to be a tool, not a community. We want to build something that piggybacks on--supplants--the communities already existing in groups like Discord and Telegram.

Why not just play a game instead? Our spatial layer is really lightweight and doesn't require a download: good luck getting the 1,000 people on your server to download 20GB of game.

Extensions

We've built a base of movement and chat, the two most important features. We want to give more activities for users to do and increase Discord integration. For instance, we want to allow users to play games with Discord bots like catch Pokemon, farm, fish, etc. We want to build persistent user and server storage. We also want to allow each server to place objects in and customise the look of their server.

We might want to give players of this gameworld something to do: the equivalent of Maki Bot in Discord servers.

Different servers would have different tilesets (like server-specific emoji) and construct their gameworld differently. One server might use a generic tileset to build a massive mediaeval castle while another might use a cyberpunk-inspired tileset to build Night City. This would allow for easy customisation of the space.

It would be really cool if we could allow fellow HnR participants to code their own equivalent of Bots: maybe expose some API where we allow squares and players to have arbitrary metadata associated with them, and allow getters and setters on that arbitrary metadata.

At the most basic and boring level, for instance, a bot could be written to assign players a "Fame" score (just an integer). And players could interact by faming or defaming other players. But more complicated interactions could exist. What if a bot assigned each square a terrain metadata type and you could fish on squares with terrain:water? This would be an API call to a Discord bot which would then update your player's inventory metadata field to have a random fish? What if you wrote a bot that could trade items between players? There are tons of possibilities.

Why not just play an MMO? Or use Second Life?

(WIP section)

  • A discord server is already a community and you want to build something on top of it, not try to transplant/supplant the existing community
  • zero friction is important! how can you possibly convince everyone in your server to move to a game
  • very lightweight layer not a entire game is a feature
  • the layer is completely optional so you can still have the same community even when not in the game

Other stuff we could do

This is an instantiation of the following meta-level principle of building worlds for hyperlocal communities.

  • meta-level: build X ( tinder, facebook, twitter, a game world, etc... ) for a hyperlocal community (the HnR discord server, Telegram group)
  • meta-meta-level: build Y that allows us to build some X for any hyperlocal community

I like the meta idea of building something over the hyperlocal community. Weineng suggested something like Tinder or FB but only for HnR participants.