Is it possible to use x4m to create a online game ?

Asked by R. Rigaud

Hello, I'd want to create a online card game using Jabber and Xmpp4moz... Is it simply possible without coding Sameplace from scratch ?

I mean, I just want very very basic functionnality : No account manager, etc...

I just want :
- Contact List
- Send/receive basics messages
- Sens/receive "special messages", that could help me manage the game : Informe what players do, etc... manage a game.

Is it the right approach, I mean the client-side ? Because server-side is contraignant and dependant from the server...
I think client-side is better because users only need my application and their JID to play together...

Do you know any examples of client-side game with xmpp4moz ? Do they use Jabber to transmit data game or another approach ?

Thank you very much.

Question information

Language:
English Edit question
Status:
Solved
For:
SamePlace Edit question
Assignee:
No assignee Edit question
Solved by:
R. Rigaud
Solved:
Last query:
Last reply:
Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#1

xmpp4moz has very few UI elements. You'd have to rewrite the contact list (it's about 50% of SamePlace, so I'd say it's definitely non-trivial) and provide a way to setup at least one account.

Alternatively you could set aside all this and just concentrate on the application, like this: http://www.sameplace.cc/blogs/bard/2008/3/13/webhosted-im-applications-a-reintroduction. (If you don't want to host it on a server, it shouldn't be difficult to ship it to clients, although I can only see advantages with hosting it remotely...)

One such example is the chessboard: http://apps.sameplace.cc/chessboard/chessboard.xhtml

Another example, with a referee bot and Google maps, can be seen at the end of the video in this post: http://hyperstruct.net/2006/10/22/instant-messaging-two-point-o

Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#2

I forgot to add: yes, of course it's possible to send/receive basic and special messages with xmpp4moz. xmpp4moz takes a very hands-off approach where it doesn't hide XMPP stanzas in classes like most other libraries do, instead you handle XML directly (courtesy E4X).

Revision history for this message
R. Rigaud (raph-rigaud) said :
#3

Ok... Is it so difficult to retrieve a contactlist ?
I thought :
- XMPP.send to catch Contacts in an array, probably using DOM or E4X if possible ?
- Display contacts in richlistbox using tips you use with Sameplace (hide a richlistitem and clonNode()).

Why do you think that host the game on a server is better (easier ?) than creating the game on the client-app and transmit data through Jabber ? I don't really understand advantages...

Thank you.

Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#4

> Ok... Is it so difficult to retrieve a contactlist ?
> I thought :
> - XMPP.send to catch Contacts in an array, probably using DOM or E4X if possible ?

Retrieving contact list data is trivial, but note that I was talking about implementing a contact list *user interface*. That's not trivial at all.

> - Display contacts in richlistbox using tips you use with Sameplace (hide a richlistitem and
> clonNode()).

Well, good luck. :-)

> Why do you think that host the game on a server is better (easier ?) than creating the game on
> the client-app and transmit data through Jabber ? I don't really understand advantages...

No, I don't mean that, I mean just hosting the game on the server. Communication still happens client-side.

For a simple 2-player game you'd have 4 entities: player A, player B, web server, and XMPP server. Let's assume that player A and player B are already chatting through the xmpp server (not strictly necessary, but easier to understand). You can think of them as having an XMPP link, and allowing a "chat application" on either side to use that link. Or they could allow a "whiteboard application" to use that link. Or a game. Now just have them retrieve any of those applications from the web and you get the best of both worlds: a 1-1 connection that relies on Jabber instead of an ad-hoc implementation on a web server, and transparent deploy/update of applications through the web. I describe that in the article I mentioned earlier, please have a look: http://www.sameplace.cc/blogs/bard/2008/3/13/webhosted-im-applications-a-reintroduction -- Also in this paper: http://2007.xtech.org/public/schedule/speaker/85 though it's probably way more boring. :-)

Revision history for this message
R. Rigaud (raph-rigaud) said :
#5

Thank you for your links, very interesting. Now, I understand what you mean by advantages of hosting game on the server.

However, in my case, I think I'll be the first and only client of my game, because community around it is pretty young and for some other reasons. So I don't think my game will ever make an interoperability problem...
Moreover, my App is a XulRunner application that is fully coded with XulRunner Extension System, so Upgrades are very very easy. My App is always up to date when a user wants to play with another user.

So, from my point of view, I will try to make a game on each client-app... to begin.

Your example code is very usefull ! I understand XML Game syntax better than yesterday... Thanks a lot !

Let's go working, I'll let you informed of my development, I think that I'll have a lot of questions in the future weeks... :)

Thanks.

Revision history for this message
Massimiliano Mirra (bard-hyperstruct) said :
#6

You're welcome. :-) Consider using the mailing list at http://groups.google.com/group/sameplace for development-related questions, as other people playing with the code are there too.