Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29931
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dwightdhutto@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'attribute': 0.05; 'memory.': 0.05; 'that?': 0.05; 'level,': 0.07; 'permissions': 0.07; 'though:': 0.07; 'admin,': 0.09; 'app,': 0.09; 'events.': 0.09; 'prevents': 0.09; 'received:mail- vb0-f46.google.com': 0.09; 'scripting': 0.09; 'cc:addr:python- list': 0.10; 'stored': 0.10; 'suggest': 0.11; '(the': 0.15; 'dictionary,': 0.16; 'flags.': 0.16; 'for,': 0.16; 'have).': 0.16; 'stored.': 0.16; 'trap': 0.16; 'weakref': 0.16; 'whois': 0.16; 'zone.': 0.16; 'basically': 0.17; 'variables': 0.17; 'memory': 0.18; 'received:209.85.212.46': 0.18; 'app': 0.19; 'load': 0.19; 'holds': 0.20; 'question.': 0.20; 'suggested': 0.20; 'sort': 0.21; 'all,': 0.21; 'builder': 0.22; 'event,': 0.22; 'finally,': 0.22; 'flags': 0.22; 'defined': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'player': 0.23; 'references': 0.23; 'this:': 0.23; 'to:2**1': 0.23; 'somewhere': 0.24; 'thus': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'first,': 0.27; 'right.': 0.27; 'separate': 0.27; 'question': 0.27; 'object,': 0.27; 'subject:information': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'received:209.85.212': 0.28; 'dictionary': 0.29; 'pickle': 0.29; 'second,': 0.29; 'trigger': 0.29; 'case,': 0.29; 'objects': 0.29; "i'm": 0.29; 'maybe': 0.29; 'sense': 0.31; 'located': 0.31; '(and': 0.32; 'gets': 0.32; 'system,': 0.32; 'generally': 0.32; 'could': 0.32; 'point,': 0.33; 'retain': 0.33; 'another': 0.33; 'entry': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'data,': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'ability': 0.36; 'but': 0.36; 'expensive': 0.36; "i'll": 0.36; 'does': 0.37; 'being': 0.37; 'why': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'object': 0.38; 'some': 0.38; 'things': 0.38; 'sure': 0.38; 'delete': 0.38; 'called': 0.39; 'header:Received:5': 0.40; 'high': 0.61; 'save': 0.61; 'back': 0.62; 'town': 0.62; 'world': 0.63; 'information': 0.63; 'more': 0.63; 'players': 0.65; 'life': 0.66; 'lose': 0.71; 'score': 0.75; 'gain': 0.79; 'etc),': 0.84; 'liking': 0.84; 'penalty,': 0.84; 'rooms': 0.84; 'subject:around': 0.84; 'those?': 0.84; 'viable': 0.84; 'zone,': 0.84; 'relating': 0.93; 'room,': 0.93; 'scene': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZN0iQRw1ShF9fX6wzc8S9J6upZCOdHnwmi51JHJl5UI=; b=KbrhndGR3AJI9FDyd3bBlunkQiCdbQgt67B3MAW3swHKpahCqAiOlgWtujtd9l69Ld vXwtGPsbo7szmp6P8mQeK7ow8zVFOONBcfKSxHMMkgvWmgopAeVOJcVSQJp21QQkneUK boZWUex5QFcCaacpoIsVjX+94C0gzYTJrwiPLVxKCAMLM5tYw9/TqHT/UIlppRF6SZxn kyQjchgsNXssLOPKhQQLV01zUdk1ExiuRo77Nd7Kp35cZFAWCx4F9KeBYL3An8FTYbyo 71J6EwrBwGe57DQtB7qNTZ5j8WMqudlGxBlh5pVMlhMCGugQHJ2wf8jMf3Bu/xndKHjL qPug== |
| MIME-Version | 1.0 |
| In-Reply-To | <505FB849.2080201@tysdomain.com> |
| References | <505FB849.2080201@tysdomain.com> |
| Date | Mon, 24 Sep 2012 17:14:17 -0400 |
| Subject | Re: keeping information about players around |
| From | Dwight Hutto <dwightdhutto@gmail.com> |
| To | "Littlefield, Tyler" <tyler@tysdomain.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| 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.1213.1348521260.27098.python-list@python.org> (permalink) |
| Lines | 70 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348521260 news.xs4all.nl 6980 [2001:888:2000:d::a6]:57764 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:29931 |
Show key headers only | View raw
> 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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: keeping information about players around Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 17:14 -0400
csiph-web