Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29880

keeping information about players around

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <tyler@tysdomain.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'attribute': 0.05; 'memory.': 0.05; 'that?': 0.05; 'lately': 0.07; 'level,': 0.07; 'permissions': 0.07; 'though:': 0.07; 'admin,': 0.09; 'events.': 0.09; 'prevents': 0.09; 'scripting': 0.09; 'stored': 0.10; '(the': 0.15; 'flags.': 0.16; 'from:addr:tyler': 0.16; 'from:addr:tysdomain.com': 0.16; 'from:name:littlefield, tyler': 0.16; 'message-id:@tysdomain.com': 0.16; 'received:69.164': 0.16; 'received:69.164.206': 0.16; 'received:69.164.206.65': 0.16; 'received:tds-solutions.net': 0.16; 'trap': 0.16; 'weakref': 0.16; 'whois': 0.16; 'zone.': 0.16; 'basically': 0.17; 'variables': 0.17; 'thanks,': 0.18; 'load': 0.19; 'holds': 0.20; 'question.': 0.20; 'suggested': 0.20; 'sort': 0.21; 'all,': 0.21; 'all:': 0.22; 'builder': 0.22; 'finally,': 0.22; 'flags': 0.22; 'received:192.168.1.100': 0.22; 'defined': 0.22; 'player': 0.23; 'references': 0.23; 'this:': 0.23; "i've": 0.23; 'somewhere': 0.24; 'thus': 0.24; 'script': 0.24; 'header:User-Agent:1': 0.26; 'first,': 0.27; 'right.': 0.27; 'separate': 0.27; 'question': 0.27; 'object,': 0.27; 'subject:information': 0.27; 'dictionary': 0.29; 'pickle': 0.29; 'project:': 0.29; 'questions.': 0.29; 'second,': 0.29; 'trigger': 0.29; 'objects': 0.29; 'url:code': 0.29; "i'm": 0.29; 'on,': 0.30; 'sense': 0.31; 'located': 0.31; 'code': 0.31; '(and': 0.32; 'gets': 0.32; 'system,': 0.32; 'generally': 0.32; 'could': 0.32; 'asked': 0.33; 'to:addr:python- list': 0.33; 'another': 0.33; 'entry': 0.33; 'list': 0.35; 'along': 0.35; 'data,': 0.35; 'doing': 0.35; 'ability': 0.36; 'but': 0.36; 'expensive': 0.36; "i'll": 0.36; 'does': 0.37; 'being': 0.37; 'data': 0.37; 'store': 0.38; 'object': 0.38; 'some': 0.38; 'things': 0.38; 'sure': 0.38; 'delete': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'save': 0.61; 'kind': 0.61; 'back': 0.62; 'town': 0.62; 'url:p': 0.63; 'world': 0.63; 'information': 0.63; 'more': 0.63; 'contents.': 0.65; 'players': 0.65; 'lose': 0.71; 'etc),': 0.84; 'light-weight': 0.84; 'rooms': 0.84; 'subject:around': 0.84; 'those?': 0.84; 'viable': 0.84; 'zone,': 0.84; 'care,': 0.91; 'relating': 0.93; 'room,': 0.93
X-Spam-Checker-Version SpamAssassin 3.3.1 (2010-03-16) on wuff
X-Spam-Level
X-Spam-Status No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1
Date Sun, 23 Sep 2012 19:32:57 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version 1.0
To python-list@python.org
Subject keeping information about players around
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1174.1348450389.27098.python-list@python.org> (permalink)
Lines 58
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348450389 news.xs4all.nl 6850 [2001:888:2000:d::a6]:49954
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29880

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

keeping information about players around "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-09-23 19:32 -0600

csiph-web