noobchat - The ultimate Chat Solution
Multiplayer games are hard, especially for Indie game developers. noobchat is the quick and easy solution if you want to add a chat to your multiplayer game: a complete Prefab that can be dragged into the Scene - ready to go immediately.
Making a decent Chat requires a whole lot of complicated features like whispering, public chat, groups, authentication, reconnecting, thread safety and passwords. Especially as indie game developers, we don't really want to spend one or two months of our time, just so that the chat works properly (which by the way is how long it took us to make noobchat).
The good news is that the IRC Protocol was already around for more than 20 years now, so the smartest solution is to implement our own IRC Client in Unity that can work with an already existing IRC server (which saves us from having to create a complicated chatserver with features like channels, swearword filters, anti-flood, anti-spam, concurrency and of course long nights of testing).
noobchat is the final multiplayer chat solution that uses the established IRC Protocol to make MMORPG, MOBA, FPS, RTS and just about any other game's chat possible. We will provide extensive usage scenarios further down this page.
Unity Webplayer Demo: click here
Let's take a look at noobchat's features:
noobchat is based on the Internet Relay Chat Protocol, which was around for more than two decades and is very well established by now. The huge advantage of using an existing protocol is that we don't have to worry about writing our own server for it. Instead we can use any of the existing IRC Servers that are already well tested, free of bugs and fully functional.
noobchat runs in its own Thread, which means that Unity will never freeze while it connects to server, recompiles, times out or encounters any other kind of problems.
noobchat works right out of the box by simply dragging a Prefab into the Scene. Server info, channels, channel colors and channel commands can be configured in the Inspector. There is no need to worry about any networking specifics.
Highly interactive Unity 5 UI:
noobchat makes use of Unity's new UI system. It's fully customizable, uses modern technologies like elastic scrolling, saves the last command for easier replies and is blazingly fast.
noobchat can use multiple channels to support public-, local-, group-, guild-, alliance-, team- and all kinds of other chat types. Each channel can have its own command like "/g" for guild chat, its own color and identifier.
noobchat was designed to be the ultimate chat solution for every kind of multiplayer game. It works for MMORPGs like World of Warcraft, for MOBA games like Dota, FPS games like Counter-Strike and even RTS games like Age of Empires.
noobchat fully supports private messages between two users by using the command "/w Username Message" or by clicking on a chat message from another person.
noobchat will automatically reconnect to the chat server in case of connection failures. The developer has to worry about nothing at all.
noobchat supports server- and channel passwords, which allows the server to protect the chatrooms properly.
noobchat never freezes Unity and it automatically reconnects to the chat after recompiling a Unity Script.
Let's take a look at how we can setup our chat system.
When doing Networking in Unity, it's always important to go to Edit->Project Settings->Player and enable Run In Background:
This option makes sure that networking won't just freeze and cause timeouts or disconnects when the back is in the background or minimized.
Adding the Prefab to the Scene
As soon as we imported the noobchat package into Unity, we can see a new noobchat folder in the Project Area:
Unity's UI system always requires a Canvas and a EventSystem to be in the Hierarchy, so if you haven't already, simply right click in the Hierarchy and select UI->Canvas and UI->EventSystem:
Now we can drag the ChatPanel from the noobchat/Prefabs folder into the Canvas:
If we select the ChatPanel in the Hierarchy, then we can modify the chat settings in the Inspector:
By default, the chat already uses a test server that works: irc.gnu.org with port 6665. Random Nick feature makes sure that we don't run into nickname issues when connecting to a public test server.
Note: it's recommended to use your own IRC server and disable the Random Nick feature when using the chat in a real game.
If we press Play then we can already see how noobchat connects to the IRC server:
If we take a closer look at the Inspector, then we can see the channels property:
noobchat is basically one chat window for multiple irc channels. We can configure each channel like this:
The Channel is the actual IRC channel like #test
Note: there is one exception, which is the "whisper" channel. It can be used for private messages that should be sent directly to the person.
The Password is the channel's password. Leave empty for unprotected Channels.
The Command is how the user can write a message to the channel. For example, this is how we could write a message to our Test channel:
/t Hello Test Channel
We can also leave the command empty, so that all default messages are sent to that channel:
Hello Test Channel
Note: an empty command can be used for the default chat channel, or in other words: for all the chat messages that don't have any specific command.
The Identifier Out will be put behind the sender's name of messages that we receive from that channel, for example:
Bob(FromTest): this is a message from #test.
The Identifier In will be put behind each message that we send to that channel, for example:
Alice(ToTest): this is a message to #test.
The Color property is the color of the messages in the Chat.
And that's all. Now we will take a look at different multiplayer games and how we can configure noobchat to support them.
Usage Scenario: MOBA or FPS Game
Let's learn how we can adapt noobchat to a MOBA style game like Dota or a FPS style game like Counter-Strike. The solution is fairly simple.
First of all, we will need one big chatserver to which every player connects to. Simply being connected to it already allows for private messages between the players.
So first of all, we would create a whisper channel like this one:
Once connected to the server, it already allows us to whisper just about anyone. For example, we can whisper someone named Bob:
And if he replies to us, this is how it looks:
Team and TeamAll Chats
Alright so as soon as the player joins a game, the gameserver should create three new channels on the IRC Server:
So each player in TeamRed would get two more noobchat channels:
And each player in TeamBlue also gets two more channels:
Note: obviously we don't want the red player to see the blue channel and vice versa.
So once ingame, a player can send 3 kinds of messages:
hello team! <- sent to his team
/all hello everyone! <- sent to both teams
/w Bob hello Bob! <- sent to player Bob
And here is how it looks ingame:
And that's all - perfect chat support without worrying about anything.
Usage Scenario: MMORPG
noobchat works perfectly fine for just about any MMORPG game. A typical MMORPG has a few different chat requirements:
- local chat
- guild chat
- alliance chat
So first of all, we would create a whisper channel again:
Afterwards we can whisper anyone that is connected to the chat server:
Of course, people can also whisper us back:
MMORPGs usually offer local chat as the default channel. We will begin by creating the channel:
We used the empty Command so that every message without a command will be sent to local chat.
Here is how we can use it ingame:
There is one more thing to keep in mind. Right now, the server would have one local chat channel, which means that everyone on the server could read everyone else's local messages - which is more like a public chat than a local chat. However there is also the option to make a truly local chat, where players would only communicate with players that are in a certain radius around them. The easiest solution to this problem is to divide the gameworld into some kind of grid with several local channels. Think about a town that is it's own local channel like #localMysterytown, and every player in this town will automatically join the #localMysterytown channel and hence only use localchat to communicate with the people in that town.
Note: noobchat allows for dynamic channel joining and leaving by using the Script's ChannelAdd and ChannelRemove functions, which can be used to make a truly local chat possible.
In a MMORPG game, there would be several different guilds among the players. noobchat supports guilds perfectly fine, because we would simply create one channel for each guild. So for example:
Afterwards we can assign the correct guild channel to each player's noobchat, for example:
As we can see in the above picture, we used the Command /g, which means that a player can write a guild message like this:
Some MMORPGs will have alliances, which are always a group of several different guilds. We can support alliance chat just like we did with the guild chat:
Here is how it looks ingame:
// chan_add adds a channel to the channels array.
// it will also join the channel if chan_add is
// called while being connected to the server
public void chan_add(string channel,
// chan_remove removes a channel from the channels array.
// it will also leave the channel if chan_remove is
// called while being connected to the server
public void chan_remove(string channel)
The download can be found at Unity Asset Store - noobchat
Note: in order to respect Unity's Asset Store agreement, noobchat is not part of the noobtuts Premium files right now.