Another possibility could be to lazily calculate turns. When a user has either a rich client or web browser open, it pings the server every N seconds. The server then evaluates whether it's a new turn or not and does the computations at this time. If M turns have passed, the server runs the game through M iterations to "catch up" the game.
Depending on what you're doing, this may be a slightly better implementation. Eager updating has the tradeoff of not scaling well, as the amount of work is linearly dependent on the number of games. Lazy evaluation has the benefit of scaling linearly as a function of the number of *active* games (many games will be abandoned), and, you can also "collapse" RPC calls to the datastore into a single call instead of repeatedly making them every N seconds. For instance: let's say you need to save game state each time. Over 10 minutes, you have to make 30 saves per game if you update every 20 seconds. If it's possible to collapse updating of game state lazily, if a user logs out and logs back in 10 minutes later, you can read the game state, run it through 10 minutes worth of iterations, and resave it - you've just improved your throughput in that scenario by a factor of 30, since in-memory local computations are incredibly cheap relative to off machine RPCs. One of the best practices of building App Engine is to minimize RPCs since these are the most expensive parts of your system. Ikai Lan Developer Programs Engineer, Google App Engine Blog: http://googleappengine.blogspot.com Twitter: http://twitter.com/app_engine Reddit: http://www.reddit.com/r/appengine On Tue, Jun 7, 2011 at 3:26 AM, Ian Marshall <ianmarshall...@gmail.com>wrote: > Would queued tasks in general, and deferred tasks in particular, suit > you? You can set an ETA for these tasks, and GAE/J guarantees not to > fire these tasks before any ETA set. > > You could use a scheduled task for a "heartbeat" of interval 1 minute, > and use this to enqueue tasks for ETAs such that you could have queued > task "heartbeats" as desired between your 1 minute scheduled task > "heartbeats". > > > On Jun 4, 4:07 am, Weston Pace <weston.p...@gmail.com> wrote: > > I'm working on an interactive game. I was hoping for turns to be on > > the order of 20 seconds or less. It appears the cron framework can > > only schedule things in 1-minute intervals. Is there any method for > > shorter timers in GAE? > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-java@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.