Game dev #3: The chat server
As a new dev entry, here's why and how I introduced the recent chat server.
From day one, when I introduced multiple Minecraft servers (first Rodinia, then Gondwana, and so on), I relied on IRC to carry the messages from location to location. Each server would spawn an IRC bot that'd be used to join #interordi-mc to send messages, read them and show them in game. Rather simple, and it works. The first version of this setup used a Minecraft plugin, which eventually I replaced with my own server wrapper when said plugin seemed like it would no longer be updated. This also allowed me to make a universal chat solution that worked for Bukkit/Spigot instances, Forge setups, and even vanilla Minecraft itself.
Some of you might have seen me running some tests with Discord earlier this year. This used a IRC <–> Discord bridge, where another IRC bot would be used to relay messages to and from Discord. This created the following structure (only showing three Minecraft servers for the example's sake):
This meant that messages travelling from Laurasia to Discord would absolutely need to go through IRC. The end effect is that messages as seen on Discord would look like this:
CreeperDiscord <CreeperLaurasia> (Doctacosa) Hello there!
That's a bit wordy, isn't it? Additionally, I had no control whatsoever over the formatting. What I wanted to get is closer to this:
CreeperDiscord (Doctacosa) Hello there!
Much better, isn't it? It's more readable, too. To do this, though, I needed to get IRC out of its position as the messages middleman. I eventually got the idea to write my own relay station of sorts. All of the various chat locations (which I've named internally “channels”) would send their messages there, and the server would accept and transmit them to all other channels. The new setup took this form:
Eventually, I settled on this text format:
Creep [Laurasia] (Doctacosa) Hello there!
I shortened the original “CreeperDiscord” to the more compact “Creep”, and decided to include the location name so people would know if a chatter was on Discord, IRC, or directly in-game. People seem to like having that information available, so that will be here to stay.
Of course, as I mentioned before, having that new chat core in place opens more options. I've reintroduced today the .players command, which now works from in-game, IRC and Discord. As an extra bonus, it's able to relay the list of persons connected on IRC and Discord as well. Those custom ranks I talked about in my previous post? They'll be read and attached to messages by the chat server directly, making sure that the information is always up-to-date everywhere. Other additions could happen at a later time, too!
Got an idea on what topics I should write about in future Game Dev entries? Send in your suggestions in the comments!
– Doctacosa