Text based RPG

118 views
Skip to first unread message

Matthew Kramer

unread,
Sep 3, 2009, 3:57:45 PM9/3/09
to Google App Engine
I'm really new with python and google appengine and I'm still trying
to figure out how to work things with it. I'm going to try and make a
text based rpg and I was wondering if anyone could give me some
pointers and easy ways to get me started.

Thanks for any help given :)

N. Rosencrantz

unread,
Sep 4, 2009, 1:11:05 AM9/4/09
to Google App Engine
Common types are adventure, world, place, actor, thing, player, view,
command, and prioqueue. We may view an adventure in a view in a world
looking for some special thing. Important are both classes ie "thing"
with name and subclasses to food, tools, or creatues and also
wellchosen data structures to serve the purpose: a prio queue with
future, a binary tree to store the gamepath or a more advanced trie
structure and store actions taken on a stack to quickly access way
back and last move in a maze. A classic maze à la Zork, thing like
Dallas Quest or any classic renewed will be fun.

Brandon N. Wirtz

unread,
Sep 4, 2009, 1:46:37 AM9/4/09
to google-a...@googlegroups.com
Python isn't an ideal language for this... HTML "Choose your own Adventure"
doesn't require any Python to work.

The Traditional Python Games don't use the web to render and can run in
realtime but doing that in html is a bit different...

If you want to learn Python, and don't care if you learn GAE at the same
time you should check out http://www.pygame.org

-Brandon Wirtz

Matthew Kramer

unread,
Sep 7, 2009, 9:17:13 PM9/7/09
to Google App Engine
Brandon,

You're not understanding what I want to make, but that may be because
I didn't explain it very well. I want to sort of make something like
an old school based MUD using GAE. I am learning Python, just
wondering if there are any resources or tutorials that would get me
more into GAE with what I'd like to make. :)

Brandon N. Wirtz

unread,
Sep 8, 2009, 12:54:26 AM9/8/09
to google-a...@googlegroups.com
You could build one of these... You'd go broke running it. A MUD is always
running.. It handles multiple threads and not only accepts requests but
sends them to the user..

GAE no process can run for more than a few seconds, so you'd have to use
some polling tricks on the client to ask what happened and have a chron job
run the main thread every few seconds... This would Be HUGELY expensive.
Not impossible to do... I don't have an good leads for where you'd get help
with this. GAE just isn't designed for this kind of thing, and I think we
are back where I started of You'd have to have a "Client" that was Jscript
or Flash and it would talk to the Python backend via essentially web pages
or ajax or what ever data format you like but as port 80 text/binary
content... Not a Telnet like session. And You'd have to ask for updates not
just have them pushed like the old muds would do.

I'd start a project like this writing a Chat program. You say "Hello
World" and someone else receives it. From there you could start Tracking
what room people are in, and introduce small commands... You'd basically be
programming in GQL queries of "Who is in the room" and "what messages does
user have. The amount of "Python" will be pretty small.

Hope this is help ful.


David Given

unread,
Sep 8, 2009, 5:24:15 AM9/8/09
to google-a...@googlegroups.com
Brandon N. Wirtz wrote:
> You could build one of these... You'd go broke running it. A MUD is always
> running.. It handles multiple threads and not only accepts requests but
> sends them to the user..

I actually *am* building something like one of these (using Java).

The biggest problem I've got is that GAE has no synchronisation
mechanisms. None. There are transactions, but as they only work on
single entities they're useless. This means that it's very hard to run
game logic that needs to synchronously touch the global database.

To work round this I've implemented my own semaphore backed by the
datastore; it's extremely nasty but does actually work. I then read the
entire game database out of a blob in a single entity into RAM, run the
game logic, write the database back again, and release the semaphore.
That is also extremely nasty but it does all actually work. (My game's
actually intended to be run on a standalone server, not GAE, but the
persistence layers are all abstracted out to let me host on GAE for
development purposes.) It'll congest rather badly but by the time
congestion becomes an issue I should have a more suitable server.

Performance isn't bad; I'm usually getting request times of about 500ms
when the server's hot. That breaks down to:

startup: anything from 10 to 5000ms
db load: 50ms
game logic: <50ms
build client update: 50ms (varies according to the size of the update)
db save: 100ms

Startup time is very strange. Sometimes it's practically nil, usually
it's 100ms or so, and if the server's not hot it something takes many
seconds (together with weird warnings about failing to start the
finalisation thread). It's all out of my control --- it happens before
the app starts.

Note that the cheapest part of the whole process is actually running the
game logic! Most of the time most requests take 0ms, as nothing will
have actually happened since the last request...

> GAE no process can run for more than a few seconds, so you'd have to use
> some polling tricks on the client to ask what happened and have a chron job
> run the main thread every few seconds...

I'm running the game logic asynchronously on-demand. After all, you only
need to change things when someone's looking! This works beautifully,
but if it's been a couple of days since the last request it can take a
while; I'm planning to use a cron job to update the server every half
hour or so to avoid this.

If you're writing a text-based game things will be both easier and
harder. Easier, in that you don't have to do all the complex database
synchronisation between the client and the server that I'm doing, and
harder, because the game logic itself will be more complex and the
client will need to poll much more frequently. (I can get away with a
poll every ten minutes or so. A MUD can't.)

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────

│ "They laughed at Newton. They laughed at Einstein. Of course, they
│ also laughed at Bozo the Clown." --- Carl Sagan

Nick Johnson (Google)

unread,
Sep 8, 2009, 5:57:42 AM9/8/09
to google-a...@googlegroups.com
Hi David,

On Tue, Sep 8, 2009 at 10:24 AM, David Given <d...@cowlark.com> wrote:

Brandon N. Wirtz wrote:
> You could build one of these... You'd go broke running it.  A MUD is always
> running.. It handles multiple threads and not only accepts requests but
> sends them to the user..

I actually *am* building something like one of these (using Java).

The biggest problem I've got is that GAE has no synchronisation
mechanisms. None. There are transactions, but as they only work on
single entities they're useless. This means that it's very hard to run
game logic that needs to synchronously touch the global database.

Not true - Transactions can encompass entire entity groups. With the correct entity group configuration, you could perform updates on local areas of the map transactionally.



--
Nick Johnson, Developer Programs Engineer, App Engine

David Given

unread,
Sep 8, 2009, 6:21:43 AM9/8/09
to google-a...@googlegroups.com
Nick Johnson (Google) wrote:
[...]

> Not true - Transactions can encompass entire entity groups. With the
> correct entity group configuration, you could perform updates on local
> areas of the map transactionally.

Is it possible to directly access entities in a group other than the
root one? I was under the impression not (but I could well be wrong).

And I'm afraid it still wouldn't help --- I'd still need synchronisation
between different groups when dealing with multiple areas on the map;
and AppEngine's transactions are optimistic rather than blocking, which
are no use to me.

In addition the overhead to performing a single database access appears
to be so high that it's *much* faster to read and write the entire
database in two accesses than it is to read parts of it using multiple
queries! Although that may change as the database size grows.

Nick Johnson (Google)

unread,
Sep 8, 2009, 6:25:59 AM9/8/09
to google-a...@googlegroups.com
On Tue, Sep 8, 2009 at 11:21 AM, David Given <d...@cowlark.com> wrote:

Nick Johnson (Google) wrote:
[...]
> Not true - Transactions can encompass entire entity groups. With the
> correct entity group configuration, you could perform updates on local
> areas of the map transactionally.

Is it possible to directly access entities in a group other than the
root one? I was under the impression not (but I could well be wrong).

Yes - child entities act in all respects like any other entity, except that they have a parent entity (or entities).
 

And I'm afraid it still wouldn't help --- I'd still need synchronisation
between different groups when dealing with multiple areas on the map;
and AppEngine's transactions are optimistic rather than blocking, which
are no use to me.

Presumably transactions across local groups are rarer; there are a number of proposals for distributed transactions on App Engine. You can also use your locking strategy, but restrict that to when you need to do a cross-region transaction, significantly reducing contention.
 

In addition the overhead to performing a single database access appears
to be so high that it's *much* faster to read and write the entire
database in two accesses than it is to read parts of it using multiple
queries! Although that may change as the database size grows.

Indeed - with a single entity you're limited to 1MB, and you're reading a lot of superfluous data. If you size your regions right, you can read the whole region with a single query, and write only the changed parts back.

-Nick Johnson
 

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────

│ "They laughed at Newton. They laughed at Einstein. Of course, they
│ also laughed at Bozo the Clown." --- Carl Sagan


martin n

unread,
Nov 24, 2015, 8:39:11 AM11/24/15
to Google App Engine


On Tuesday, September 8, 2009 at 6:54:26 AM UTC+2, Brandon Wirtz wrote:
... Not a Telnet like session. . .

Have similar telnet-related question.
Is GAE able to accept incoming telnet connection ?
Or any google's service ?

For my game is  telnet compatibility neccessary.

Alex Martelli

unread,
Nov 24, 2015, 10:03:05 AM11/24/15
to google-a...@googlegroups.com
On Tue, Nov 24, 2015 at 5:39 AM, martin n <3inf....@gmail.com> wrote:


On Tuesday, September 8, 2009 at 6:54:26 AM UTC+2, Brandon Wirtz wrote:
... Not a Telnet like session. . .

Have similar telnet-related question. 
Is GAE able to accept incoming telnet connection ?

No: HTTP, HTTPS.
 
Or any google's service ?

You may want to look at Google Compute Engine.


Alex
 

For my game is  telnet compatibility neccessary.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/73420740-08a9-4e66-93f4-ccaae3ff9c71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

martin n

unread,
Dec 1, 2015, 4:48:23 AM12/1/15
to Google App Engine


You may want to look at Google Compute Engine.

Thanks for tip.
Will try it ASAP.
Reply all
Reply to author
Forward
0 new messages