Playing Games Against Users With Different Devices

One of the things I really love about mobile devices is that they have become very capable gaming platforms — so capable, in fact, that I think they seriously threaten dedicated hand-held gaming platforms like the PSP and Nintendo DS. And since our devices are easily connected, playing games against friends is usually just a matter of jumping on the same local network.

But the problem is fragmentation. Some of my friends have iPhones and some have Android devices which can make it difficult or impossible to play games against each other. But not so with games written with AIR. Last week, I decided to see how hard it would be to add network play to iReverse in order to enable two people to play against either other over a local network no matter what kind of device the two players have (iOS, Android, laptop, etc.). As it turns out, it was less than a day of work. Here’s a demo:

The key to game instances discovering each other on the network and passing data back and forth is RTMFP. The code is extremely simple to write, and no server of any kind is required. I haven’t updated the release versions of iReverse yet (I’ve been on the road a lot lately), but I should have them out before Christmas. In the meantime, you can see how it all works by checking out the code.

13 Responses to Playing Games Against Users With Different Devices

  1. Hoss Gifford says:

    This is truly awesome Christian, and thanks for sharing the source!

  2. Thomas says:

    This is excellent. Perhaps not the best comment in the world, but then again, it never hurts to show the love once in a while, eh? Thanks Christian!

  3. Pingback: Playing Games Against Users With Different Devices

  4. This is officially my favorite blog! Keep up with the consistently great content.

  5. miha says:

    very cool, didn’t even know you can do it completely without server!

  6. Rob says:

    Does this require you to allow a certain type of traffic on your network? I have tried multiple tutorials about this type of thing and cannot get it to work on my home network. I am hoping it is just something I need to configured on my router but I haven’t figured it out yet.

  7. Christian Cantrell says:

    @Rob: RTMFP uses UDP.

  8. Ted says:

    This uses Cirrus correct?
    I didn’t notice a different way to implement RTMFP other than what’s noted on the Cirrus product page? Any page you could point us to with the coding basics for RTMFP?

  9. Have you checked out the Brass Monkey SDK http://brassmonkey.infrared5.com/ ? I’m not certain they have enabled AIR or Android support yet but I am very curious to see the possibilities for enabling complex gaming across various devices and screens.

  10. Mark Hadisty says:

    Can the latency be reduced when using this form of communication? I presume it isn’t good enough for real-time games?

  11. Mark Hardisty says:

    Christian, great video and source code. I have implemented this in a quick game engine and two desktop machines see each other. I have two questions if you capable of answering them?

    The first is how to reduce the latency between transmissions … there seems to be some lag between the transmit from one client and reception on the other. Would it be to use Flash Media Server?

    Second, when I publish to AIR for Android and attempt to connect the device, with Wi-Fi enabled and on my local network the two clients do not see each other. What permission is required for the Android device?

    Thanks in anticipation!