Skip the write to memcache. (and the read from) use the datastore, make sure
you don't "search" for a result just use the index/record so that you don't
burn CPU's on that.   If all players get the same data from the server, set
your cache header for the request and make the request a unique url so that
you don't use Memcache to "cache" the query you use the Google Edge Server.

Yourgame.com/<gameid>/<turnid>

Or something similar, in a 4 player game this will save you about 75% on the
requests and CPU.



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mark
Sent: Monday, February 07, 2011 2:42 PM
To: Google App Engine
Subject: [google-appengine] Thoughts on app engine for games

Hi,

I wrote a turn-based game. I added a multiplayer component to it, using app
engine as the backend. It's working fine, but the cpu costs are probably
going to be too high. I tried to make every optimization possible, and I got
a basic game move down to ~140ms in total (trip to datastore, modify game
state, persist back to datastore). A game usually takes about 4,000 moves to
complete. I'm storing the gamestate as a flat json string, which has been
working very well (each game consists of about 4 to 10 players, one
gamestate object per game).

For the purposes of a game application, it would be really nice if memcache
supported a notification handler we could implement when an object is
getting evicted. So, if I kept all my gamestates in memcache, I would only
ever persist back to the datastore if memcache notified me that an object
was getting evicted. Otherwise I could avoid going to the datastore at all.
This has probably been brought up before and purposefully not implemented.
I'm using memcache, but have to write back to the datastore any time a user
modifies gamestate.

A game of this nature is probably not the best use-case for app engine, but
wanted to give it a shot for fun, cool platform,

Thanks



--
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.


-- 
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