Where do I start to implement a massively-multiplayer game on the Iphone? - iphone

I have a card game on the iphone and I really would like to take it to the next step by allowing players to interact with each other in real-time environment.
My questions:
Do I need a web server ?
Is there a third party specifically for iphone multiplayer games that I can use to host the game?
I would probably need a database - what is the best solution?
Should Apple push notifications be considered ?

First off, I have never done one myself, but I imagine that any massively multi-player game would entail some sort of central server to hold statistics (wins/losses), rankings, game table information, etc.
I imagine some sort of remote service providing server is required. A web server would certainly fit the bill and would most likely be the most logical solution, but certainly not your only choice.
Hosting of this service depends on the service you choose. If you're going the java route there are several places to look. Google's app engine, a straight up java web provider, amazon's cloud, etc. So many choices.
There are several open-source databases that would fit nicely with java. Postgres would come recommended by me. There are certainly others and other commercial options.

The server you use is bound to how fast the interactions with players need to be. The problem with HTTP would be that it's hard to have push notifications and it's also probably too heavy, depending on the type of game.
If it's in real time, but doesn't have a lot of interaction I'd probably use XMPP for the actual gameplay. If it's something where latency is more important, like a FPS or plataformer (actually any action game really) you'll probably need to roll your own protocol (and server obviously).
For the matchmaking a web server is enough.

Yes, you need a server for a traditional MMO, since an MMO is defined as a game where arbitrarily many people connect to each other. If you require people to be in the same vicinity, you can have an "ordinary" multiplayer game over the phones' wifi.
Doubtful. MMO servers require a lot of custom code. There are servers for high scores and such for more traditional games, however.
For your central database, this is entirely a question of preference. It sounds like cost is important to you, though, so I would go with MySQL since it's a free solution (and I think it's very nice to work with).
That depends on what gameplay will entail. If you're talking about a real-time game (like EverQuest or something), push notifications will probably not be helpful. If you're talking about something like Mafia Wars (is that the proper name of the Facebook one?), maybe.
I'd recommend looking at Parallel Kingdom, which is an existing MMO for the iPhone, iPod Touc and Android.

Related

For what programmatic reason do IoT-programmed devices always require cloud/server access?

I live in an area where net access is mobile or nothing. While I can occasionally get access by tethering a mobile to that network, it isn't often connected, and when it isn't connected, no local device will function on its own, no matter which protocol it uses. Why isn't there any kind of server/cloud resiliency built in where devices can communicate in a peer fashion like Apple's Bonjour (Rendezvous? I can't remember)? If I have an Echo device, I should be able to switch it on through an Alexa interface. I'm OK without speech processing which requires interpretation of commands through an AWS or Google or Apple or whatever cloud, but being able to locally control a switch seems as though the interface could be smart enough to route locally. I guess I may have just answered my question. It seems as though routes could be internally stored so as to not to definitely require a server. Can you imagine shipping a colony to Mars and all the IoT devices stop working? If you ask me, they should not require a branch variation or special programming in order to function.
From the experience of having sat down and built a few, there are a some key reasons why viable IoT gadget products for the general market typically end up having to have a cloud-mediated mode, no matter what was envisioned when the design effort originally commenced:
General consumers (at least think) they want the option to control things when outside the home
Often even at home, a mobile phone may be on the mobile network not wifi, meaning that even if the user is physically inside their home, in network terms, they are not.
Firmware updates, dynamic content, etc are easier when they don't have to be relayed through a mobile phone or PC, especially a mobile that might sometimes have to jump networks partway through the process.
Ironically, having once set out to build an IoT product that could work entirely offline, the further the project progressed, the more and more difficulties that approach presented for general users, and the more the cloud path that was added as an option, started to look preferable in terms of how things should work all the time so that it could become the exclusive focus of development efforts.
My conclusion is that it's very hard to build an offline IoT gadget. Not only the developer, but also the users and marketing people need to understand and accept what sorts of difficulties and limitations that can mean.
So where does it happen? In the situations where the "users" are the "developers" - eg. open source. If you look around a bit, you'll find plenty of gadgets either built form scratch, or more commonly reverse engineered so they can run a custom firmware. Want a local RESTful API? Done! Want could relay via MQTT over SSL to your own broker? Done!
When you control the code, you control the mode.
But with products for the general market, most customers want things to work, not a lengthy technical explanation of why the details of their network setup mean they cannot.

GPGS Unity Plugin - Network Latency Check & Synchronisation

I'm trying to develop a realtime multiplayer game in Unity using Google Play Games plugin. So far, it all has been pretty straightforward. I'm using a P2P architecture.
One of the issues I have is that the data I'm sending to players is time sensitive. I can use and send an unreliable message, but we know that no two players will have the same set of data or 'game state' at any given point. Is there any way I can synchronise my players? my understanding is that having even a client-server architecture will only help me synchronise players to a certain degree, but not completely. Is that correct?
My knowledge of networking, especially with Google Play, is very limited so if you can explain this to me like I'm five, that'd be great. ^_^

What is the best way to implement a Server-Client connection between an iPad and multiple iPhones?

Based on a college-project I'm trying to realize a relatively simple game (Poker) where an iPad acts as Server and multiple iPod-Touchs connect to it as Clients.
Gamekit seems to drop out, since those old ipod-touch-devices don't have bluetooth-support.
Are there already some Frameworks out there simplifying the process, or do I have to fall back on TCP-Streaming-Sockets and implement it myself?
For your task I suggest you have a look at ThoMoNetworking or AsyncSocket.
ThoMoNet is a very simple setup that is specifically developed for fast and easy prototyping and easy to set up. Is will automatically create a bi-partite graph between all instances of you application it finds in the local network. So If you keep your iPad as the server and the iPhones as clients this will come down to less than 10 lines of code to set up.
AsyncSocket is a commonly used framework with ports to PC as well but requires more code to write. On the other hand it will allow you to do more fancy things, should you need them.
Distributed objects are not yet available on iPhone OS, so excluding GameKit you may try using Bonjour networking. Otherwise, you may try using web services with some of the available libraries. If Bonjour and web services are not a choice/possibility, then you have to revert to old plain sockets.

Getting started with Server applications

I have an iPhone game (Combination), and in the next version I would like to set up a server, where users (via the app) can submit which levels they have completed, and see how other users are doing. At this point I don't intend that users will need usernames and passwords, just a simple submit data, get back data.
I know very little about server-based language and databases, but I've heard lots of horrible things that can happen if you get it wrong. What would be the best system to design a simple, lightweight, secure database in?
How about having a look at Onyx Online or OpenFeint?
Onxy Online is from the makers of Trism, and they say, "the XBox Live Arcade ecosystem brought to the iPhone". I wrote this kind of system into Trism as a case study, and it's been a complete success. Since Trism launched in July, we've been hard at work adapting this online code for use in any iPhone game, and the results are stunning. What we're going to do is allow any developer to insert the Onyx code into their game, which will instantly enable online scoring, achievements, leaderboards, and customized forums."
OpenFeint is from the developers of Aurora Feint. From the press release:
"OpenFeint allows any iPhone game to add player profiles, buddy lists, walls, newsfeeds and real-time chat rooms allowing the game to build a real community around itself with ZERO operations overhead and minimal development time. OpenFeint consists of a server and a client. The OpenFeint Server is fully compatible with Google’s OpenSocial REST API and will be accessible through the OpenFeint client code library and sample UI code from Aurora Feint Inc. Indie developers do not have to operate the servers, which will be hosted Aurora Feint’s data center.
In a first for iPhone games, iPhone game developers will have the ability to reduce over 2 months of development work to 1 day, and completely eliminate back-end server operations, while offering their players an extensive set of customizable social and community building features:
Profiles: Players can upload an avatar photo or take one with their iPhone camera.
Walls: Each player gets a wall where other players can leave comments and view wall-to-wall conversations
Asynchronous Real Time Chat Rooms for meeting other players, sharing tips, strategies and experiences within each game community
Buddy List: Players can friend other players within their community or across the iPhone gaming community
Newsfeeds: Players can keep in touch with all of their friends’ activities (wall comments, actions in games, befriending people)
Global Community Chat Rooms for players to discuss recommendations, tips, and reviews of other games on the iPhone"
Have you used Java/C#/Perl/Python any other "server side language?" Are you going to be hosting the server-side yourself, or are you looking at hosting companies? Your decision might come down to how you intend to host your server-side stuff, and what capabilites your hosting company offers or what you are comfortable with.
Java or C# are really powerful server-side languages, but hosting these can take a little more work (and money?).
Java might be a good starting point, because you can setup Tomcat yourself and try hosting some web-services. MySQL is a good database to start with, but there are even more lightweight database alternatives. There might be a bit of a learning curve with any of these.
Have you heard of ICE touch? ICE is a middleware for network communication and has a basic persistence support. It supports every major platform:
iPhone as a client
Android as a client
Objective-C Mac OS X as client/server
C++ Linux as client/server
Java [any OS] as client/server
C#/C++, Windows .NET (with Silverlight) and native as client/server
I evaluated it some time ago and was surprised about its maturity, good documentation and example code. They name Skype as one of their customers.
As a start I would recommend to have a look at their example chat application. You can run a Java server, connect with your iPhone, your G1 and your Silverlight client and have a chat. Pretty impressive interoperabilty!
Here comes the drawback: GPL (you cannot link against it without being GPL yourself) or commercial (individual pricing).
I would also recommend you to use an online database service such as Viravis , DabbleDB or Zoho Creator. Almost all of these kinds of services have required integration capability to work with such a client as Web, Desktop, Windows Mobile or IPhone.
Java/Javascript is the defacto combo for most developers because of the Java support for every platform. Java Script has more than a few "issues"
The rest of the herd uses .NET (with its attendant 100MB run time bloatware that changes every 9 months)
php,pearl,ruby etc are good for server side, but if you want to use code, the best solution is probably C/C++ (or similar) and CGI/FastCGI.
This allows you to write communication algos once and use them on both ends. Any encryption/compresssion sim same.

iPhone to iPhone communication

I'm kind of curious how I should approach a problem with iPhones and communication between two phones.
I have an idea for an application that needs to send data between two known phones. The problem is that the data could be very small or very large. I want to have intermediate storage on a server and a messaging layer, but I want there to be performant means to communicate between devices for shorter, unimportant messages.
You always hear about networking and client to client communication with popular platforms and protocols, but I'm curious what people's thoughts are on doing p2p style communication with an iPhone.
I'm pretty sure it should (and can) be treated as just a simple addressable machine... so I would have to build NAT traversing network code into the iPhone itself. A thought I had would be some sort of UPnP situation where I would ask to NAT a particular port for communication to the devices... but I guess I could just as easily turn it into a polling situation.
Granted, I understand that Apple will have a "push" mechanism for developers eventually but I want to get the app out the door before hand...
Just curious about thoughts on this type of thing... any thoughts on multi-player game situations would also directly apply to (and benefit from) this question.
Have you given the WiTap sample from Apple a try? It addresses the issue of discoverability (via Bonjour) and connectivity (via basic TCP). It may not be as robust as what you are looking for, but it's worth a look:
http://developer.apple.com/iphone/library/samplecode/WiTap/index.html
Look at the docs for Game Kit in the iPhone 3.0 SDK. It allows iPhones to connect to one another locally with Bluetooth, or via wi-fi/3G. It addresses both peer-to-peer and client-server architectures. It provides unreliable and reliable links.