Unity and Google App Engine Backend

I’ve got an idea for a kind of multi-player turn-based game I’d like to develop with Unity. I want this game to be playable on the popular platforms: iOS, Android and Desktop (probably WebPlayer, but I could go for standalone too). It’s going to require persistent storage of user progress (such as level and xp) and a way to notify each player of the other player’s move. Think asynchronous chess game, where each player can perform one move per turn.

My initial thought was to develop my game backend as for Google App Engine (GAE). The clients would periodically poll the backend via HTTP request to retrieve the latest game state. The main reason I’m going for GAE is scalability and ease of development. I don’t want to have to worry about hosting and scalability issues down the line.

Now I’m already running in a few road-bumps when it comes to interfacing my backend with Unity. For my game, I must be able to uniquely identify users as I will be storing persistent data for each of them. This means I need a user management system with account login and session. GAE natively supports Google’s Account service, which takes care of most of that stuff for you. However, the catch is that it doesn’t have an API method for programmatically signing in a user with a username password, nor create a new account. Instead, you have to forward the user to Google’s account sign-up URL. And this requires a web browser. I would like to be able to do this from within my game. The other alternative is to write my own user authentication system, but I’m really not excited about the idea.

So has anyone tried to do something similar for their game, and found a good workaround/solution to this problem? Do you have another tech suggestion to implement my server backend, given my constraints (Unity client + crossplatform + HTTP only)?

Thanks in advance!

Quick update: I came across the Tipfy framework (python) for Google App engine. It has support for custom user auth and session, and it works pretty well so far.

I can now login with a username password from my unity client. I’ve had to bend some corners with Unity’s built-in http request class (WWW) in order to retrieve the auth session cookie and submit it as part of the HTTP header in subsequent requests to my backend but it works :slight_smile: I’m also using POST method only as it seems to be the only way to provide custom headers with Unity’s current implementation of the WWW class. I would like to be able to do that with GET method as well.

I’m also looking at GAE for the backend engine. Nice to know that authentication with Tipfy worked for you.

Any further progress?

I am also playing around with GAE with unity. Have you looked into the Channel API? It’s actually built for mplayer game type concepts

It lets you rebroadcast updates to all listeners on a channel without polling. I wouldn’t use it for any low latency stuff like player movement, but it could work for a lot of stuff.

I got the tic-tac-toe running in my sandbox, been playing around with it. I haven’t hooked it up to Unity client yet (Im new to Unity)

Also, check out XMPP for chat

Here is a xmpp client for mono, but I havent tried using it in Unity yet.

[edit] This is not longer available on Asset Store but I did include the sources in a post lower down in this thread.

If anyone is looking for this kind of Google App Engine (GAE) support you could have a look at the package I released. It is based on the tech behind my new game, Battlemass (a turn-based multiplayer strategy game)

There is also Scoreoid it’s an easier solution need to develop your own it does user saves and log-in - http://www.scoreoid.net/

Scoreoid, developed by game developers for game developers, is a non-restrictive, reliable and easy to use gaming platform designed to handle but not limited to scoring, leaderboards and game management, including advanced functions such as platform content awareness, for multi-platform games.

Scoroid’s goal is to make games better by handling advanced features, shortening game development time and costs, and freeing up developer time to focus on their games.

Hi. Thanks for starting this thread (I realise it was a while ago), since I’m thinking along very similar lines for my game, and it’s really useful to see how other people have solved the same sort of problems.

Tipfy looks awesome, which is annoying since I have to use the Java side of GAE (I’ve got shared code between the backend and Unity, and Java is the only common language). Does anybody know of a Java equivalent to Tipfy?

In any case, my first thought is that if GAE natively supports Google Accounts, then sure our Unity projects could just have the player enter their username and password, forward it to the backend, which would handle the sign-in grammatically (as opposed to forwarding to the login page). I can’t see precisely how to do that last bit though. Do you think it’s possible?

Wow, Scoreoid actually looks pretty nifty. Nice to see that there are Unity examples provided :slight_smile:

Check out this link, I am sure you’ll get your solutions.

http://api.shephertz.com/

I bumped into this page when looking for Google Cloud Backend starter kit. Surprised that there is no client or plugin or endpoint for Unity yet.

Although there are other cloud services (I used Parse which is horribly slow in UK and EU), I am keen to use Google Cloud because of their massive data centres.

Any help from Unity community would be greatly appreciated to all Unity game developers out there.

Just in case someone views this thread and is looking for something to get started with. I’ve attached a solution I developed back in 2011. It is old and will probably throw some errors against the latest Unity and Google App Engine but might be helpful in getting started.

1778780–112912–Connect Google App Engine.zip (769 KB)

2 Likes

thanks!