I’m looking to use an XMPP server for a simple multiplayer game. I’d like to use the XMPP messages for both chat messages and game commands. For instance, in the user interface, I would have an area for chatting with other players (so this would use normal XMPP message passing). Then perhaps some game controls like a button, when the player hits the button, a message is silently sent to the XMPP server where I can interpret it as something like “player3:jump_right”, in the context of the game room they’re part of.
My question is - will Openfire allow me to do this kind of customization to the XMPP server? I would need to have a list of users connected to the server, and which ‘game rooms’ they’re participating in - then I’d need to examine each message as it comes in, and if it is a game command, take some action server-side. Where would I begin writing server-side logic like this?
If Openfire is not suited for this, is something like ejabberd more extensible?
My question is - will Openfire allow me to do this kind of
customization to the XMPP server?
You have full access to Openfire API when writing an plugin. However, many things are possible, not all. In any case, Openfire is open source, you can modify the code directly, but that not the best way.
I would need to have a list of users
connected to the server
no problem, check UserManager#getUsers()
,and which ‘game rooms’ they’re participating
I would use an additional data structure to maintain that. => no problem
then I’d need to examine each message as it comes in, and if it is
a game command, take some action server-side.
implement Component or PacketInterceptor interface. Use your own XML namespace when sending game data over XMPP.
Where would I begin
writing server-side logic like this?
Plugin Developer Guide
when the player hits the button, a message is silently sent to the XMPP
server where I can interpret it as something like "player3:jump_right"
What kind of game you want to write? Will this be somekind of ego shooter (or similar game) where fast reaction times are everything?
XMPP would be far to slow. Games like that normally dont even use TCP protocol, because it’s to slow. Check out UDP protocol in that case…
Great thanks for the info. Yeah it will be a turn-based game, so I figured the speed would be sufficient.
I’m also currently implementing a multi-user game service support for openfire. We are working on a XEP proposal maybe you are interessted to cooperate with us. We are implementing a tic tac toe game for a proof of concept. My game plugin provides a API framework for games. The games can focus on the game logic and don’t have to care about user and room management. Our work is still in progress. It’s currently possible to play a simple game and spectators can watch this, but many details aren’t implemented yet and the XEP proposal is also still in progress.
That sounds just like what I’m trying to do. I’ve already implemented the multiplayer game server/client as a java applet, but who wants to download applets nowadays… so I was hoping to transition it to an XMPP framework. Is your plugin up an running to try it out? I’m not sure what issues I’ll run into yet using XMPP as the communication medium, just starting out with this,
look at the sourceforge project site http://openfire-mug.sourceforge.net/.