Help me networking a simple game on mobile, web and desktop

I have a simple (currently 2 player) turn based game targeting iOS mobile devices.

I have the gameplay done and it currently works in a Pass Play mode. I now need to get networking underway - lobbies, hosted games perhaps leaderboards.

To this end I have been investigating the Prime31 plugins for GameCenter and WiFi/Bluetooth connections.

Clearly having the Wifi Bluetooth functionality as an addition to basic connectivity built into all versions would be great in any circumstance.

Before I get started, however, I’d like to make sure I’m not painting myself into a corner when it comes to expanding the game play to include web-based and/or desktop versions. And Android as well. (edit)

I’ve done some simple sifting thru the Networking and iOS forums and I’ve not hit a thread that tackles this issue.

To me, there seems to be (at least) two issues.

One is simply finding a simple solution to the base networking and lobby - which would be nice to find a solution as simple as an existing plug-in - that all platforms could use. I have experimented with a number of the tutorials here rolling my own system, and I’m sure I could crack it, but (like Prime31 and A&BSOft’s EZGui or SM2), if there is a reasonable pre-rolled solution I’d consider it.

The second is more complex, which gets into how people use games… GameCenter does provide a useful place to have a number of games, scores and basic social networking - but it is iOS only. Even tho’ I’ve seen some games that use multiple systems (OpenFeint GameCenter), I’m unclear what a good cross-platform network would be, and whether they could be run in parallel (with GameCenter, etc.).

I’m open for any hints, guidance or smacks on the back of the head, and I’ll post back anything I find here for anyone else who’s looking for a similar solution.

I have accumulated a number of links while I’m researching this issue. They need to be vetted and clarified as I do more research, but so far I’m not finding what I feel I’m looking for, which is a simple lobby system and game pairing that will work cross platform for iOS, Android, Mac, Windows and Web. I’d like all of my game clients to be able to play opponents on any platform.

I know I don’t know enough about this subject, but to proper solution is still eluding me.

First there is the M2H tutorials on the Asset Store

These tutorials get good recommendations, and these were, when they were first released, the best tutorials around, and they sound improved.

The M2H tutorials were originally part of the UniKnowledge Unity Challenge:
(Original Post: UniKnowledge entry: Unity Networking the Zero to Hero guide - Unity Engine - Unity Discussions)

Most of these are resources or solutions for large numbers of concurrent client playing the same game rather than a series of 2 player games.

Badumna:
http://www.scalify.com/badumna.php

NetDog:
http://www.netdognetworks.com/index.shtml

Electrotank:
http://www.electrotank.com

SmartFox Server:

Photon:

uLnk:
http://www.unitypark3d.com

Many of the above links have all sorts of additional functionality. All have variable price tags and license agreements. None seem to suit the two major parameters: Indie Developer with a low profile game and Low Impact/Low Bandwidth 2 player game.

Why don’t you use Unity’s Networking to get a Lobby + Rooms + Games ready?

I had a look into Photon’s LiteLobby, but it seemed a little bit untidy to me (enum hell), so i decided to make an own Lobby with Unity.
Maybe i should make an AssetStore product out of it. :wink:

Sometimes I feel like a man with cataracts when it comes to networking. I can feel it and it seems to make sense, but I can’t quite see it properly… even when it is in my hands.

Yes, I’d love to use Unity’s networking for a Lobby + Rooms + Games… but I’m unclear how to do just that. I suppose this is why I’m looking for a tutorial or a pre-rolled turn-key solution.

What I’m getting the feel is that it seems like I need to have a custom Master Server running a lobby and have clients host games.

I’m now looking here:

And here:
http://unity3d.com/support/documentation/Components/net-MasterServerBuild.html

These docs seem a little clearer than when I last looked. I still don’t see it, but I’ll start fumbling around in the dim light.

I always hate when I read things like this (from the Master Server Build docs): if you have gcc then it should work.

I’m assuming the GNU Compiler Collection (http://gcc.gnu.org/) not Grupo Cementos de Chihuahua (http://www.gcc.com/). But these are the road bumps that can be frustrating… “What is that?”

lol :wink:
I know what you mean. I went exactly that way with my game BlobFoot and it never worked very reliable.
(Masterserver stops working, or Facilitator or NAT Punchthrough … bla bla bla)
Maybe i was too dumb for it - that’s an option, too.

What i am doing now is:

  • The client gets the ip of your server via the Unity WWW class like: WWW www = new WWW( “http://www.yoururl.com/serverip1.txt” );
  • If this lobby has too many players (let’s say more than 100), the Client connects to the ip he gets from “http://www.yoururl.com/serverip2.txt” … and so on, till he has a lobbyserver which isn’t too full (of course you would have to integrate a kind of friendlist, so friends can play on the same lobbyserver)
  • now the client is on one of your lobbyservers, he now sees plenty of ROOMS which he got from the lobbyserver
  • the lobbyserver is managing all players, rooms and games (rooms that went ingame)

It’s a bit rough around the edges, but i’ll give it a try :slight_smile:

Unfortunately, your issues with the Master Server are part of what scares me. As I’m doing my research, I hear many tales about problems with Master Server setups, and as I need a working solution for a live game. Often I hear about problems with the Master Server setup being an issue with the Unity one and when people deploy their own, the issues go away, but not always.

Hrm…

I have my own masterserver (and all that stuff what comes with him) and i still have problems.

My approach from above works completely without masterservers and nat-punchthrough, since it’s all hosted on my side.
Clients won’t host any games - what makes it 100 times easier.

So, then, what are you writing your Custom Server in? Is this a Unity project running full time on a server? Or something else?

You might want to take a second look at Photon, despite being “enum hell” for some.
It covers most of your needs without server-side changes. Use the Lite Lobby application: it has lobbies which list rooms. A player could either join any of them or create a new one. Inside you just pass along your events / turns. There are some fixed events (join, leave, room-list-update, etc).
Adding stuff like accounts and or highscores is up to you but you can use C# to code your custom logic.

The Unity Client Library is iOS and Android compatible. Currently we investigate a bug on a dual core Android device but are going to support this, too.
Up to 100 players (concurrent) are free and the indie license is comparably cheap and easy to upgrade.

Tobias: Can I ask, or really “confirm”, what you mean by 100 players (concurrent). I assume that even tho’ I have only two players per game, if I have 50 games running, that means I have reached my 100 concurrent connection limit?

What happens when I exceed that limit? Do they bounce? As I cannot predict the volume of players, I’m unclear how best to handle this situation when the games go live.

Yes it’s a full-time-running Unity app which will run in batchmode (so graphics and all this overhead will be cut away).

It’s amazing how fast you react when someone types “Photon” in any thread :smile:
Well to get to my point:
I had a look into both tutorials which come with the client and i think it’s quite confusing how you extended the Lite app. The enums, which are made of other enums, which you have to get out the documentation to not overwrite some of those strange picked values.
Maybe i just didn’t get the sense behind all this, but it was a little bit confusing/unhandy/complicated to extend the functionality.

Yes, all this 50 rooms will be hosted by your server application, which then has 100 players to manage.
I think you will have enough time to react on usercounts, since it’s not that easy to get like 100 concurrent users ingame from one day to another.

Mmm…

The biggest hang-up with Photon at this point is the fact that the server is deployed as windows-only and I’m developing on the Mac. This means I can’t test it, and I don’t suppose it works under wine… I’m sure my domain host can deal with it to get it out there, deployed and exposed, but it will be hard for me to develop with it without getting BootCamp up and running and getting a windows license just to play with it. Hrm.

I see on the Photon site that they have a MacOS lib, which I’d need:
http://forum.exitgames.com/viewtopic.php?f=8&t=517

Ethan, I’m trying to get my head around your Unity solution. I’m a fan of all-in Unity solutions. I will admit that the concept escapes me, but my knowledge of the www classes are about as thin as my knowledge of networking.

Wonders about getting BootCamp running on the laptop and Unity running on the desk…

Or will this all be handled by Unity? And the MacOS lib is for developing directly in xCode…

Prolly only need the DotNet lib…

Ethan:

Batchmode Servers? I’d not heard anything about this. I’ve found some forum posts, but nothing official yet. There is nothing in the manual, reference or scripting docs.

http://forum.unity3d.com/threads/41575-Optimizing-Batchmode-Unity-Servers
http://answers.unity3d.com/questions/topics/batchmode.html?viewedQuestions=43347

Oh - Found this:
http://unity3d.com/support/documentation/Manual/Command%20Line%20Arguments.html
It mentions batchmode…

Oh - Standalone Player examples have this:
-batchmode
Run the game in “headless” mode. The game will not display anything and won’t accept user input. This is mostly useful for running servers of networked games.

Which links back here:
http://unity3d.com/support/documentation/Components/Network%20Reference%20Guide.html

It’s like being in a hedge maze. Ok…

Little Angel stares at the Network Reference Guide and contemplates his next move.

Hehe, yes it’s hard in the beginning … :wink:

I am like 40% done with my Unity lobbyserver. Maybe i am putting the whole source on the Asset Store if it’s customizable enough in the end. Or if there are enough potential customers. I will put up a demo and we will see. :slight_smile:

First i have to check if everything works as intended.

The MacOS library is written in C and has C++ and ObjC wrappers, so you could happily code in XCode.
The client SDK can be used in Windows or Mac Unity Editors and runs within the players you build: Mac, Windows, iOS or Android.

I think we never tried running Photon in Wine but some of us run it in Parallels. A XP license would be the minimum requirement then.

Humph.

My domain host only support linux, not windows…

I went ahead a purchased the Ultimate Unity Networking Project from M2H. I would rate this as “good” with “room for improvement”, especially for the price. I would like to point out that even though this is in the complete package section, it should probably be in extensions, as none of the examples really work right out of the box, but are all good places to start when constructing your own game. TBH, they work “as examples”, but cannot really be dropped on a game and just have them function, afaict.

I’ll post more as I scrutinize more of the other options. What I’d like to do is a comparison chart showing the price when scaled and the additional cost for hosting.