Hi Nathan,

Your best options are either to keep track of one event stream per
game, or to use system time, and 'rewind' the timestamp a bit to
capture any missed events, as you suggest. Global monotonic counters
aren't very practical in large distributed systems.

-Nick Johnson

On Tue, Jul 14, 2009 at 1:39 AM, Nathan Gray<[email protected]> wrote:
>
> Hi there,
>
> I'm writing a game backend in app engine where progress in each game
> is described by timestamped events.  So any time a player takes a turn
> or types a chat message it generates one or more events, each
> timestamped using datetime.utcnow().  Each game and its data form an
> entity group in the datastore, and each user can have multiple games
> in progress at any given time.  On the client side the game keeps
> track of the timestamp of the last event it's seen (across *all* the
> user's games) and periodically requests all newer events.
>
> But of course GAE is a distributed system and utcnow() is not going to
> be consistent across different nodes of the system, so this won't
> work.  Eventually there will be two near-simultaneous events in
> different games that get written to the datastore in the "wrong" order
> and one of them will never be seen because it's "older" than the
> "newest" event.
>
> So what's the right way to solve this kind of problem?  I like the
> concept of a global event stream for each user, but maybe I have to
> abandon that model and use one event stream per game.  Or maybe it
> would be better to assume that the clocks won't be *too* far off and
> request events with timestamps greater than N seconds before the last
> event the client's seen.  I'd be grateful for any recommendations or
> suggestions.
>
> Thanks,
> -n8
>
> --
> http://n8gray.org
>
> >
>



-- 
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
Number: 368047

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to