Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
keeping information about players around
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Littlefield, Tyler  
View profile  
 More options Sep 23 2012, 9:33 pm
Newsgroups: comp.lang.python
From: "Littlefield, Tyler" <ty...@tysdomain.com>
Date: Sun, 23 Sep 2012 19:32:57 -0600
Local: Sun, Sep 23 2012 9:32 pm
Subject: keeping information about players around
ytHello all:
I've asked for a couple code reviews lately on a mud I've been working
on, to kind of help me with ideas and a better design.

I have yet another design question.
In my mud, zones are basically objects that manage a collection of
rooms; For example, a town would be it's own zone.
It holds information like maxRooms, the list of rooms as well as some
other data like player owners and access flags.
The access flags basically is a list holding the uid of a player, as
well as a bitarray of permissions on that zone. For example, a player
might have the ability to edit a zone, but not create rooms.
So I have a couple of questions based on this:
First, how viable would it be to keep a sort of player database around
with stats and that?
It could contain the player's level, as well as other information like
their access (player, admin, builder etc), and then when someone does a
whois on the player I don't have to load that player up just to get data
about them. How would I keep the information updated? When I delete a
player, I could just delete the entry from the database by uid.
Second, would it be viable to have both the name and the uid stored in
the dictionary? Then I could look up by either of those?

Also, I have a couple more general-purpose questions relating to the mud.
When I load a zone, a list of rooms get stored on the zone, as well as
world. I thought it might make sense to store references to objects
located somewhere else but also on the world in WeakValueDictionaries to
save memory. It prevents them from being kept around (and thus having to
be deleted from the world when they lose their life), but also (I hope)
will save memory. Is a weakref going to be less expensive than a full
reference?
Second, I want to set up scripting so that you can script events for
rooms and npcs. For example, I plan to make some type of event system,
so that each type of object gets their own events. For example, when a
player walks into a room, they could trigger some sort of trap that
would poison them. This leads to a question though: I can store
scripting on objects or in separate files, but how is that generally
associated and executed?
Finally, I just want to make sure I'm doing things right. When I store
data, I just pickle it all, then load it back up again. My world object
has an attribute defined on it called picklevars, which is basically a
list of variables to pickle, and my __getstate__ just returns a
dictionary of those. All other objects are left "as-is" for now. Zones,
(the entire zone and all it's rooms) get pickled, as well as players and
then the world object for persistence. Is this the suggested way of
doing things? I'll also pickle the HelpManager object, which will
basically contain a list of helpfiles that can be accessed, along with
their contents.
Thanks, and appologies for all the questions.

--
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jean-Michel Pichavant  
View profile  
 More options Sep 24 2012, 11:15 am
Newsgroups: comp.lang.python
From: Jean-Michel Pichavant <jeanmic...@sequans.com>
Date: Mon, 24 Sep 2012 17:15:22 +0200 (CEST)
Local: Mon, Sep 24 2012 11:15 am
Subject: Re: keeping information about players around

That's a lot of questions, few specific to python.
I have one advice:

Don't think too much about performances. Focus on keeping things simple, work on your design and forget about implementation.
Pickle everything, use sqllite for your database. When you get things working, then you can start measuring your performances and think about clever implementation to speed up things **if needed** (<- key notion).

JM


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jean-Michel Pichavant  
View profile  
 More options Sep 24 2012, 11:47 am
Newsgroups: comp.lang.python
From: Jean-Michel Pichavant <jeanmic...@sequans.com>
Date: Mon, 24 Sep 2012 17:47:43 +0200 (CEST)
Local: Mon, Sep 24 2012 11:47 am
Subject: Re: keeping information about players around

----- Original Message -----
> >Pickle everything, use sqllite for your database. When you get
> >things
> working, then you can start measuring your performances and think
> >about
> clever implementation
> That was a bunch of information; sorry about that. what do you mean
> by
> using sqlite for the database? Currently I just drop everything into
> files. Is there a better way to do that?
> Thanks for your advice.

Please keep the discussion on list.

If you have a basic knowledge of databases, sure you could use a sqlite database to store you persistent objects. That's pretty reasonable.
Not to mention a lot of stuff can interface with that database. If you want to build a web app to manage the player database, you can, most of the frameworks handles sqlite. Actually if you don't need a web app, a lot of sqlite admin app already exists.

Note that the database is suitable only for the data. For serializing a python object with its code, you need pickle.

JM


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 5:14 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 17:14:17 -0400
Local: Mon, Sep 24 2012 5:14 pm
Subject: Re: keeping information about players around
> I have yet another design question.
> In my mud, zones are basically objects that manage a collection of rooms;
> For example, a town would be it's own zone.
> It holds information like maxRooms, the list of rooms as well as some other
> data like player owners and access flags.
> The access flags basically is a list holding the uid of a player, as well as
> a bitarray of permissions on that zone. For example, a player might have the
> ability to edit a zone, but not create rooms.
> So I have a couple of questions based on this:
> First, how viable would it be to keep a sort of player database around with
> stats and that?

Well, what are the main items you need to retain for the player to
return to the game?

Also, If this is a browser app I'd go with phpmyadmin, and MySQL

If a tkinter/wxpython/etc app, then maybe sqlite.

> It could contain the player's level, as well as other information like their
> access (player, admin, builder etc), and then when someone does a whois on
> the player I don't have to load that player up just to get data about them.
> How would I keep the information updated? When I delete a player, I could
> just delete the entry from the database by uid.
> Second, would it be viable to have both the name and the uid stored in the
> dictionary? Then I could look up by either of those?

Why would you use a dictionary, when it's DB manipulation you're after?

> Also, I have a couple more general-purpose questions relating to the mud.
> When I load a zone, a list of rooms get stored on the zone, as well as
> world. I thought it might make sense to store references to objects located
> somewhere else but also on the world in WeakValueDictionaries to save
> memory. It prevents them from being kept around (and thus having to be
> deleted from the world when they lose their life), but also (I hope) will
> save memory. Is a weakref going to be less expensive than a full reference?

For any case, you're going to have a DB field with a value, so it
doesn't look like a high value memory cost in the DB.

> Second, I want to set up scripting so that you can script events for rooms
> and npcs. For example, I plan to make some type of event system, so that
> each type of object gets their own events. For example, when a player walks
> into a room, they could trigger some sort of trap that would poison them.
> This leads to a question though: I can store scripting on objects or in
> separate files, but how is that generally associated and executed?

Well, the event doesn't need to be stored unless there is a necessity
to store the event, but if it's poisoned, then it's just a life
penalty, then no need to store the event, just the score loss.

> Finally, I just want to make sure I'm doing things right. When I store data,
> I just pickle it all, then load it back up again. My world object has an
> attribute defined on it called picklevars, which is basically a list of
> variables to pickle, and my __getstate__ just returns a dictionary of those.
> All other objects are left "as-is" for now. Zones, (the entire zone and all
> it's rooms) get pickled, as well as players and then the world object for
> persistence. Is this the suggested way of doing things? I'll also pickle the
> HelpManager object, which will basically contain a list of helpfiles that

I might suggest you take a look at the Blender Game Engine(python API)
at this point, unless you're just liking doing it the hard way to gain
experience(just like I have).

Design the DB, and let the scene render what needs to be rendered, or
list data  for, and those are the necessities to be stored.

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Angelico  
View profile  
 More options Sep 24 2012, 6:20 pm
Newsgroups: comp.lang.python
From: Chris Angelico <ros...@gmail.com>
Date: Tue, 25 Sep 2012 08:19:34 +1000
Local: Mon, Sep 24 2012 6:19 pm
Subject: Re: keeping information about players around

On Tue, Sep 25, 2012 at 7:14 AM, Dwight Hutto <dwightdhu...@gmail.com> wrote:
> Also, If this is a browser app I'd go with phpmyadmin, and MySQL

> If a tkinter/wxpython/etc app, then maybe sqlite.

Out of curiosity, why? MySQL isn't magically better for everything
where data ends up displayed in a web browser. Unless you're planning
to also reference this database from some other language, it's going
to make little difference what backend you use; and even if you are
using multiple languages, it's usually not difficult to find overlap.

ChrisA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 6:32 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 18:31:50 -0400
Local: Mon, Sep 24 2012 6:31 pm
Subject: Re: keeping information about players around

On Mon, Sep 24, 2012 at 6:19 PM, Chris Angelico <ros...@gmail.com> wrote:
> On Tue, Sep 25, 2012 at 7:14 AM, Dwight Hutto <dwightdhu...@gmail.com> wrote:
>> Also, If this is a browser app I'd go with phpmyadmin, and MySQL

>> If a tkinter/wxpython/etc app, then maybe sqlite.

> Out of curiosity, why? MySQL isn't magically better for everything
> where data ends up displayed in a web browser.

No, but phpmyadmin is a great GUI for MySQL

Unless you're planning

> to also reference this database from some other language, it's going
> to make little difference what backend you use; and even if you are
> using multiple languages, it's usually not difficult to find overlap.

Well this is python, but in the browser a little echo, instead of
print, isn't that bad for conversational php.

And in the end it's usually html, php, css, javascript in the browser,
atleast for me it is. I'm just starting to utilize python in that
area, so excuse the naivety.

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 6:39 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 18:39:08 -0400
Local: Mon, Sep 24 2012 6:39 pm
Subject: Re: keeping information about players around
>> Out of curiosity, why? MySQL isn't magically better for everything
>> where data ends up displayed in a web browser.

> No, but phpmyadmin is a great GUI for MySQL

Meaning, it gives a great web app, that sqlite doesn't have...yet.
It's the tools around MySQL for me, that gives it the umph it needs to
be a great DB, with the GUI (phpmyadmin)to match, and short
reference/learni8ng curve to use php in this instance.

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Angelico  
View profile  
 More options Sep 24 2012, 6:56 pm
Newsgroups: comp.lang.python
From: Chris Angelico <ros...@gmail.com>
Date: Tue, 25 Sep 2012 08:55:58 +1000
Local: Mon, Sep 24 2012 6:55 pm
Subject: Re: keeping information about players around

On Tue, Sep 25, 2012 at 8:31 AM, Dwight Hutto <dwightdhu...@gmail.com> wrote:
> And in the end it's usually html, php, css, javascript in the browser,
> atleast for me it is. I'm just starting to utilize python in that
> area, so excuse the naivety.

In the browser it's HTML, CSS, JavaScript (ECMAScript, etc, etc); PHP
is just a way of generating that. Any language works on the back
end... and PHP isn't the best :) Python does quite well at that task;
I have a tiny little Python script that uses a web browser as its
front ent.

ChrisA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 7:09 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 19:09:26 -0400
Local: Mon, Sep 24 2012 7:09 pm
Subject: Re: keeping information about players around

> is just a way of generating that. Any language works on the back
> end... and PHP isn't the best :) Python does quite well at that task;
> I have a tiny little Python script that uses a web browser as its
> front ent.

This stems from my limited usage of python in the browser(I usually
use it for prototype apps). It's usually going to be the difference
between echo or print html/javascript, and perform an iteration for
table, or formulaic computation within a standard function syntax.

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alex23  
View profile  
 More options Sep 24 2012, 7:28 pm
Newsgroups: comp.lang.python
From: alex23 <wuwe...@gmail.com>
Date: Mon, 24 Sep 2012 16:28:17 -0700 (PDT)
Local: Mon, Sep 24 2012 7:28 pm
Subject: Re: keeping information about players around
On Sep 25, 8:32 am, Dwight Hutto <dwightdhu...@gmail.com> wrote:

> No, but phpmyadmin is a great GUI for MySQL

If you're recommending MySQL use on the basis of phpmyadmin, you
should also make sure to mention:
http://www.phpmyadmin.net/home_page/security/

Great GUI, maybe. Huge security hole, absolutely. Most organisations
I've worked for won't allow it anywhere near their servers.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 7:44 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 19:44:36 -0400
Local: Mon, Sep 24 2012 7:44 pm
Subject: Re: keeping information about players around
On Mon, Sep 24, 2012 at 7:28 PM, alex23 <wuwe...@gmail.com> wrote:
> On Sep 25, 8:32 am, Dwight Hutto <dwightdhu...@gmail.com> wrote:
>> No, but phpmyadmin is a great GUI for MySQL

> If you're recommending MySQL use on the basis of phpmyadmin, you
> should also make sure to mention:
> http://www.phpmyadmin.net/home_page/security/

> Great GUI, maybe. Huge security hole, absolutely. Most organisations
> I've worked for won't allow it anywhere near their servers.

 What DB are you recommending, check out sqlite's:

http://www.cvedetails.com/vulnerability-list/vendor_id-9237/Sqlite.html

Maybe just a parsed file with data, and accessing data that you design.

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alex23  
View profile  
 More options Sep 24 2012, 7:52 pm
Newsgroups: comp.lang.python
From: alex23 <wuwe...@gmail.com>
Date: Mon, 24 Sep 2012 16:52:22 -0700 (PDT)
Local: Mon, Sep 24 2012 7:52 pm
Subject: Re: keeping information about players around
On Sep 25, 9:44 am, Dwight Hutto <dwightdhu...@gmail.com> wrote:

>  What DB are you recommending, check out sqlite's:

> http://www.cvedetails.com/vulnerability-list/vendor_id-9237/Sqlite.html

Are you _seriously_ comparing _four_ vulnerabilities to 60+?

> Maybe just a parsed file with data, and accessing data that you design.

Just stop.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Littlefield, Tyler  
View profile  
 More options Sep 24 2012, 8:14 pm
Newsgroups: comp.lang.python
From: "Littlefield, Tyler" <ty...@tysdomain.com>
Date: Mon, 24 Sep 2012 18:14:03 -0600
Local: Mon, Sep 24 2012 8:14 pm
Subject: Re: keeping information about players around
On 9/24/2012 3:14 PM, Dwight Hutto wrote:

>> I have yet another design question.
>> In my mud, zones are basically objects that manage a collection of rooms;
>> For example, a town would be it's own zone.
>> It holds information like maxRooms, the list of rooms as well as some other
>> data like player owners and access flags.
>> The access flags basically is a list holding the uid of a player, as well as
>> a bitarray of permissions on that zone. For example, a player might have the
>> ability to edit a zone, but not create rooms.
>> So I have a couple of questions based on this:
>> First, how viable would it be to keep a sort of player database around with
>> stats and that?
> Well, what are the main items you need to retain for the player to
> return to the game?
> All of their contents are stored, which right now is done through Pickle. The stats is something different, as like I said, I don't want to unpickle an object every time I for example look at a zone and see what players have permissions on it.

Also, If this is a browser app I'd go with phpmyadmin, and MySQL If a
tkinter/wxpython/etc app, then maybe sqlite.

PHPMyAdmin? Might I ask why? This is a mud, so it's all command based,
so that's not even a question, but I'm kind of curious how PHPMyAdmin
factors in there. It's a database creation tool from all I've ever seen
of it, to define tables. Also, using it requires that I have it up on
some server or another, and I'd really rather avoid that if I can.

Design the DB, and let the scene render what needs to be rendered, or
list data for, and those are the necessities to be stored.

--
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 8:31 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 20:31:08 -0400
Local: Mon, Sep 24 2012 8:31 pm
Subject: Re: keeping information about players around
On Mon, Sep 24, 2012 at 7:52 PM, alex23 <wuwe...@gmail.com> wrote:
> On Sep 25, 9:44 am, Dwight Hutto <dwightdhu...@gmail.com> wrote:
>>  What DB are you recommending, check out sqlite's:

>> http://www.cvedetails.com/vulnerability-list/vendor_id-9237/Sqlite.html

> Are you _seriously_ comparing _four_ vulnerabilities to 60+?

Even less if you use your own DB structure, and evn less in mysql if
you reject the injections of the known vulnerablities.

>> Maybe just a parsed file with data, and accessing data that you design.

> Just stop.

Why not suggest odbm or relational db's, this shows your lack of
complexity in design, so please stop your own Dunner-Kruning.

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dwight Hutto  
View profile  
 More options Sep 24 2012, 9:14 pm
Newsgroups: comp.lang.python
From: Dwight Hutto <dwightdhu...@gmail.com>
Date: Mon, 24 Sep 2012 21:14:34 -0400
Local: Mon, Sep 24 2012 9:14 pm
Subject: Re: keeping information about players around
Anything else?

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Sep 24 2012, 10:29 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 25 Sep 2012 02:29:48 GMT
Local: Mon, Sep 24 2012 10:29 pm
Subject: Re: keeping information about players around

On Tue, 25 Sep 2012 08:19:34 +1000, Chris Angelico wrote:
> On Tue, Sep 25, 2012 at 7:14 AM, Dwight Hutto <dwightdhu...@gmail.com>
> wrote:
>> Also, If this is a browser app I'd go with phpmyadmin, and MySQL

>> If a tkinter/wxpython/etc app, then maybe sqlite.

> Out of curiosity, why? MySQL isn't magically better for everything where
> data ends up displayed in a web browser. Unless you're planning to also
> reference this database from some other language, it's going to make
> little difference what backend you use; and even if you are using
> multiple languages, it's usually not difficult to find overlap.

For a desktop application, you can't expect the application user to have
set up MySQL or Postgresql first, so you have to use something like
sqlite.

For web applications, you're probably expecting (or at least hoping for)
tens of thousands of users a day, and sqlite probably won't cut it. If
your web app is only used by you, then you might not care.

I think it is perfectly reasonable to assume a web app and a desktop app
might use different backends.

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jean-Michel Pichavant  
View profile  
 More options Sep 25 2012, 5:09 am
Newsgroups: comp.lang.python
From: Jean-Michel Pichavant <jeanmic...@sequans.com>
Date: Tue, 25 Sep 2012 11:09:36 +0200 (CEST)
Local: Tues, Sep 25 2012 5:09 am
Subject: Re: keeping information about players around

----- Original Message -----
> PHPMyAdmin? Might I ask why? This is a mud, so it's all command
> based,
> so that's not even a question, but I'm kind of curious how PHPMyAdmin
> factors in there. It's a database creation tool from all I've ever
> seen
> of it, to define tables. Also, using it requires that I have it up on
> some server or another, and I'd really rather avoid that if I can.

Given the nature of your project forget MysQL and phpAdmin. At most you may use sqlite. Sqlite data is stored in one file, locally, you can move it back it up easily. Sqlite doesn't need any server.
If you don't see How sqlite would benefit your mud, that would be strange, but then drop it and use pickled dictionaries if you're familiar with them.

> > Why would you use a dictionary, when it's DB manipulation you're
> > after?

> It is? I don't remember mentioning database anything in my thread.
> Unless I missed it, I mentioned pickle once or twice. But either
> way, I'd use a dictionary to keep a copy of {uid:object} for
> objects and {uid:player} for players. Makes lookup by uid pretty
> easy, as well as for any loaded objects.

Actually you mentioned a "player database" in your original post. Player with their stats are typically something that may ends up in a database, along with any object and its properties.
That's why people suggested to use a database. Databases provide then powerful tools to fetch, search and edit your data. Performances on disk access would be handled by sqlite itself, something you may care by yourself if you use dictionaries.

Or maybe your mud doesn't store anything on disk, every run start fresh, in that case just use dictionaries.

JM


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »