Sunday, December 14, 2008

Users and cron jobs

Today, we implemented some basics: User creation and ticks. The results can be found here.

After login (using Google's user authentication), we require that a nick name is chosen. From Google we only get the email-adress of the current user as an authentication token - obviously not perfect to address the user.
While making sure that an already used nick cannot be chosen, we found out that RequestHandler.redirect(url) does not really redirect the current call. Rather, it sets the "Location" header of the HTTP response and then returns.

Additionally, we implemented the ubiquitous "tick". Every five minutes resources are recalculated, ships are moved and so on. Since we cannot use the cron job from GAEUtilities, as noted in a previous post, we implemented our own lazy cron scheduler. During each request we first update the current tick from the start date of the round and the current time.
Then, for each cron job we determine, if one or more ticks have passed since the last time we executed it. If so, we run the job and provide the number of times it ought to have been called by now. Having processed all cron jobs, the actual user request is processed.

Using this implementation, we now have available a primitive resource distributer. For each tick, credits and metal are increased by one.

Next time, the Control Center will be awakened. :)

Wednesday, December 10, 2008

"Hello World" of Nebula Conflicts goes live

We proudly present our first version of "Nebula Conflicts". You cannot imagine how difficult it is to find a name for a SSBG (Space Strategy Browser Game), which is not already in use. ;)

The code is available in our subversion repository, with anonymous read access. This version uses Django, which is the default templating engine in GAE to create the webpages. Other Python based template engines are also supported, e.g. ClearSilver and Quixote. We will use Django because it is the default and many tutorials can be found. Information on how to use Django in GAE can be found here.

We're always eager to get feedback on what can be improved. So leave a comment, if you feel something ought to be different.

Sunday, November 30, 2008

First prototype powered by Google App Engine

Our first game prototype will be built on the Google App Engine (GAE).

GAE supports straight forward development: Scalability, powerful and simple data store, user management, Python :). After some early ideas we figured out, that GAE does not support all useful functions for browser game development, e.g. cronjobs. Also: Google tries to handle requests within (sub-) seconds. No less is expected from developers. If the request does not return after three seconds, the request handling process gets killed.

This means, we have to handle events during a user request and within three seconds.

Until now we found some (strange) work-arounds for these problems like automatically refreshing tabs. The most powerful solution at the moment seems to be Cron from GAEUtilities. Unfortunately Cron works lazily.

For low traffic sites, this may mean cron tasks will not run as often as scheduled. If you only get 1 request every 20 minutes, and you have a task scheduled for every 5 minutes, it will only run every 20 minutes. - GAEUtils Wiki

This does not to fit into the simple tick based browser game view. We still have to consider, that events are not handled at the correct time. If the player supposed to get his credits every 5 minutes then he has to get it 4 times after a twenty minute delay and in three seconds ;)

Additionally after a few hours, we ran into the "datastore_path bug" (SDK v1.1.7). Thanks Google Quality Management!!!

Possibilities of browser game development

Today we started our blog on the topic: "How to write a browser game?". The main idea is to implement a space strategy game using different technologies, e.g. Google App Engine or Yahoo! Widgets.
Our prototypes and experiences will be made available from this blog.