Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'true,': 0.04; 'cache': 0.05; 'level,': 0.07; 'welcome.': 0.07; 'subject:question': 0.08; 'lookup': 0.09; 'perks': 0.09; 'subject:design': 0.09; 'to:addr:comp.lang.python': 0.09; 'useless': 0.09; 'cc:addr :python-list': 0.10; '"python': 0.16; 'dynamic,': 0.16; 'flag,': 0.16; 'rough': 0.16; 'set,': 0.16; 'storing': 0.16; 'wrote:': 0.17; 'char': 0.17; 'specify': 0.17; 'thanks,': 0.18; 'trying': 0.21; 'all:': 0.22; 'decorators': 0.22; 'effort.': 0.22; 'finally,': 0.22; 'modifying': 0.22; 'object.': 0.22; 'wednesday,': 0.22; 'work,': 0.22; "i'd": 0.22; 'player': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'appreciated.': 0.26; 'first,': 0.27; "doesn't": 0.28; 'points': 0.29; "i'm": 0.29; 'that.': 0.30; 'checks': 0.30; 'figure': 0.30; 'point': 0.31; 'system,': 0.32; '-----': 0.32; 'generally': 0.32; 'could': 0.32; 'builds': 0.33; 'curious': 0.33; 'like:': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'self': 0.34; 'exist': 0.35; 'problem,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'add': 0.36; 'really': 0.36; 'but': 0.36; 'skip:{ 10': 0.36; 'method': 0.36; 'anything': 0.36; 'possible': 0.37; 'october': 0.37; 'level': 0.37; 'previous': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'performance': 0.39; 'called': 0.39; 'google': 0.39; 'where': 0.40; 'think': 0.40; 'your': 0.60; 'costs': 0.64; 'total': 0.65; 'overall': 0.66; 'purchase': 0.67; 'increase': 0.72; 'subject::': 0.83; 'absolutely': 0.84; 'cost,': 0.84; 'received:209.85.216.184': 0.84; 'subject:system': 0.84; 'dirty': 0.91; 'urge': 0.91; 'factors': 0.95 Newsgroups: comp.lang.python Date: Thu, 4 Oct 2012 06:19:33 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=122.167.227.18; posting-account=uPFZNQoAAAAm9w7z13q1SjWNKNjztdcD References: <506B47DB.9030401@tysdomain.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 122.167.227.18 MIME-Version: 1.0 Subject: Re: design question:game skill system From: Ramchandra Apte To: comp.lang.python@googlegroups.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 106 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349356782 news.xs4all.nl 6945 [2001:888:2000:d::a6]:50077 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30724 On Wednesday, 3 October 2012 14:19:57 UTC+5:30, Jean-Michel Pichavant wrote: > ----- Original Message ----- > > > Hello all: > > > I'm looking at a skill/perk system, where the player builds up his > > > char > > > by using perk points to add abilities. > > > Each perk is under a category, and generally costs go up as you > > > increase > > > the perk. > > > So I'm trying to figure something out; first, I'd really like the > > > cost > > > calculation and all of that to be dynamic, so that I don't have to > > > write > > > a calculateCost per object. I'd also like to be able to specify > > > dependencies and say a level, as well as other factors before a > > > player > > > can obtain a perk and have them self documenting. The idea is that a > > > player could do something like: > > > data perk extended health > > > and it would tell them they require health at 50 before they can > > > purchase extended health, as well as the cost, the increase per level > > > and the total overall cost. > > > Any ideas on how to set this up would be really appreciated. > > > Finally, I'm curious how to store and calculate these. I thought > > > about > > > using a uid per perk, then storing something like: {uid:level} on the > > > player, but means that I have to lookup the name somehow still in the > > > main perk database, then use that uid to check if the player has it. > > > Are > > > there better ways of storing skills? I'm also thinking about > > > calculation; currently the CalculateMaxHp method would have to add up > > > all the possible perks for health, then add stats and all that. That > > > could get really rough on performance if it's called often; would > > > something like a cache work, where you have something like: > > > {attribute:dirty}? So if I call CalculateHealth, it checks for the > > > dirty > > > flag, and if it doesn't exist just returns the previous max HP, but > > > if > > > the dirty flag is set, it recalculates? Then anything modifying > > > health > > > (level gains, perks, stat increases/etc) would just set the dirty > > > flag > > > and call calculate? > > > Thoughts/ideas would be welcome. > > > Thanks, > > > > Hi, > > > > Again, do not think about performances before actually having an issue with them. What's the point to optimize something that doesn't need it ? > > > > For your cache problem, google "python memoize decorator" for a bunch of decorators that will allow you to cache your data without any effort. > > > > JM True, but I always have an irresistible urge to optimize to every yoctosecond even if its absolutely useless to optimize.