Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

(NOTE: This is a duplicate of a question I asked on SO, having temporarily forgotten about GameDev <hang head in shame>. When one is answered, I will link it back to the other.)

I'm trying to do my first client/server game using Google Apps Engine as my back end (specification requirement.) I've done the tutorials (Java), but that all seems highly browser-centric.

Basically, I'd like my (mobile, not that it matters) app to:

  • Allow the user to create a game-account (NOT their Google account!)
  • Log-in with that account.
  • Press the "MARCO" button to send an account-identified request to the server.
  • Get a "POLO" response from the server.
    • As data (like a JSON object, XML-DOM or similar), not as a web-page.

Can anyone point me to a good tutorial/sample project/detailed reading to help me achieve that? I'm pretty sure that, once I get that working, I can do all the rest of it -- but I'm having the "stuck at the starting gate" problem, not being able to work up basic account-login, and non-HTML data exchange.

Thanks!

share|improve this question
    
Is the server side going to be written in Java or Python? Will a simple database on the server suffice or do you need to perform much game logic? –  Alex Schearer Jul 27 '10 at 19:29
    
@Alex: I'm writing in Java. There will be both simple database and some game logic, although I'm not sure why that matters for my question. The part where I'm getting stuck is in the setting-up of user-authentication. The Marco/Polo example was just a trivial game-data exchange, but the key part I'm having trouble with is the user authentication stuff. –  Olie Jul 28 '10 at 23:11
add comment

3 Answers

I have a working example of a client/server game built on App Engine. You can fork it on GitHub and try the live demo.

I haven't written about it or anything yet, but the code is relatively well commented. Have fun!

share|improve this answer
add comment
up vote 0 down vote accepted

The part that wasn't clicking for me -- and, as I suspected, was very very simple -- was that it's just a matter of implementing the doPost() (or doGet(), but I use POST) routine, and write back to the responder.

There were also some bits that I didn't follow quite correctly the first time about setting-up the responder class-names and URLs, in the web.xml file (in the war folder.)

Once I got that (web.xml) set up correctly, then the doPost() routine was simply something along the lines of:

public void doPost(HttpServletRequest req, HttpServletResponse resp)
  throws IOException {
    String reqTypeStr = req.getParameter("reqType");
    if (reqTypeStr.equalsIgnoreCase("marco")
        resp.getWriter().println("Polo!");
    else
            resp.getWriter().println("huh?");
}

There are myriad other details but those were the two that hung me up the most. Once I broke that simple barrier, everything else flowed together very quickly.

share|improve this answer
    
NOTE: This still doesn't point me at a decent tutorial/walkthrough, which is what I originally asked so, if someone points me to a brilliant one of those, I'll mark that as the correct answer. –  Olie Sep 7 '10 at 14:55
add comment

For something that simple I would recommend using python(and in general the python GAE experience is quite good.)

I am pretty sure that for what you want to do the simple app engine tutorial and documentation woud be enough. You want to create an application that has 3 controllers( check credentials, create credentials and answer marco-polo).

There are a bunch of open source examples of python code for the app engine in github, and a lot of documentation on the official site, i would say go try it out and if you run into a wall ask a specific question =D

Hope that helps!

share|improve this answer
    
Learning a new language (python) isn't in the client-spec; I know Java, and am on time constraint. The object hierarchy should all be similar, no? I understand that what I'm asking is very-very-simple. But I've done the tutorials, and it's just not clicking for me. Also, the tutorials don't show quite what I'm asking, and I can't quite figure out how to convert to "not-Google-account"s. –  Olie Jul 29 '10 at 2:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.