I realized yesterday morning that I had been developing this multi-user game engine the wrong way, which I kinda felt from the beginning, by using the IM system of communication as opposed to the conference room system. The new switch over to the conference room system is perfect for what I needed, but be forewarned, what a pain in the ass it was to get a conference room up and running.
What I didn’t realize is that there are quite a few properties needing to be set when creating or
joining a conference room:
room = new Room(kernel.connection);
room.setRoomJID(
"myroomname@conference." +
kernel.connection.server +
"/Game%201");
room.roomName = Kernel.formatIncomingName(
kernel.connection.getBareJID());
room.nickname ="Game 1";
room.conferenceServer = "conference." +
kernel.connection.server;
room.enableAutoUpdate();
addRoomListeners();
room.join();
You need to set the room’s JID, roomName, nickname, and conference server. The other thing to note is that the conference server seems to need the conference. at the beginning of the URL, it seems to not work at all without it. The JID needs to be formatted as such as well:
{roomName}@{conferenceServer}/{nickname}
Without these set properly it will not even attempt to create a conference room. Once this was done the rest was a breeze. I’ve created the ability to search for all available games, create a game, join a game, leave a game, end a game, display all game players, message all game players, and for the user who created the game to be able to move a box that then refreshes its location on each of the other players screens.
The known errors in my code are exceptions that occur when a connection times out and that the app does not reset itself when a disconnection occurs, a game is left, or a game is ended.
As usual the latest code can be downloaded from:
git clone git://github.com/mbrio/xiff-game.git
git checkout post-three

