Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is ejabberd a good choice as a core technology for turn-based MMORPG?

I think about technology stack for my project and I think about using ejabberd. The project will look like classic multi-user dungeon RPG where players will move across the world from one location to another (locations looks exactly like chat rooms), and they also will figth each other as well as creatures with AI in turn-based mode.

I never used ejabberd, but I have some experience in writing server applications using erlang.

Is ejabberd an overkill for this kind of game? It has a lot of features that I won't need ever. However it is well-known to erlang developers and is also very stable and mature. Is ejabberd worth using it as kind of transport layer for my online game, or I should better invent my own wheel, something tiny and simple?

like image 995
Nik Avatar asked Jun 13 '12 16:06

Nik


1 Answers

I have several years of commercial experience, using ejabberd for things like this. So, my take:

Pros:

  1. It is certainly technically capable.
  2. It is quite easy to grok.
  3. It is very easy to extend and modify.
  4. If you update it regularly, it will solve two really important aspects. A. network security (this is extremely important thing for me); and B.properly done authentication. These two alone are enough of a reason to use it.
  5. It is surprisingly fast.
  6. It gives you chat, presence and friends list for free.
  7. It gives you MUC (rooms) for free. With all the things like permissions solved quite well.

Cons:

  1. Don't really expect to find any usable documentation. Source is mostly your only friend.
  2. Don't really expect to find a community. It's a lonely path. There is a room - [email protected] but it's very quiet (and almost empty). Most of the people there are not developers, but just ejabberd users. Mailing list is a bit better, but usually not enough to find you the answer you seek.
  3. The source code per-se is not the best example of an erlang project. If you want to learn how to write big, modular, distributed erlang software, better have a look at something like Riak.
  4. The internal APIs are not very stable (they change quite a lot with releases). Because of this, I recommend writing your software as a separate erlang application, connecting to ejabberd as an external XMPP component. Thus you will be guaranteed that you communicate over a stable protocol (XMPP). Of course, you cannot escape having to write some internal stuff as well. Authentication and Roster (friend list) modules are the first that come to mind. This combination is quite hard to maintain and update, especially if you need hot code loading, but it's yet the best solution for me. Try to keep the "in-ejabberd" code to the viable minimum.
  5. That being said, there is only one (to my knowledge) usable XMPP erlang library. It's called exmpp and is developed by the same company as ejabberd (ProcessOne). It's not yet considered stable. I have been using it for quite some time, and for now there are no problems, but you never know. It is also mostly undocumented (or was, when I was learning it).
like image 84
loxs Avatar answered Nov 06 '22 05:11

loxs