Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'cache': 0.05; 'level,': 0.07; 'welcome.': 0.07; 'subject:question': 0.08; 'lookup': 0.09; 'perks': 0.09; 'subject:design': 0.09; 'dynamic,': 0.16; 'flag,': 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; 'rough': 0.16; 'set,': 0.16; 'storing': 0.16; 'char': 0.17; 'specify': 0.17; 'thanks,': 0.18; 'trying': 0.21; 'all:': 0.22; 'finally,': 0.22; 'modifying': 0.22; 'object.': 0.22; 'received:192.168.1.100': 0.22; 'work,': 0.22; "i'd": 0.22; 'player': 0.23; 'idea': 0.24; 'header:User-Agent:1': 0.26; 'appreciated.': 0.26; 'first,': 0.27; "doesn't": 0.28; 'project:': 0.29; 'points': 0.29; 'url:code': 0.29; "i'm": 0.29; 'that.': 0.30; 'checks': 0.30; 'figure': 0.30; 'system,': 0.32; 'generally': 0.32; 'could': 0.32; 'builds': 0.33; 'curious': 0.33; 'like:': 0.33; 'to:addr:python-list': 0.33; 'self': 0.34; 'exist': 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; 'level': 0.37; 'previous': 0.37; 'data': 0.37; 'store': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'url:p': 0.63; 'costs': 0.64; 'total': 0.65; 'overall': 0.66; 'purchase': 0.67; 'increase': 0.72; 'subject::': 0.83; 'cost,': 0.84; 'light-weight': 0.84; 'subject:system': 0.84; 'care,': 0.91; 'dirty': 0.91; 'factors': 0.95 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: Tue, 02 Oct 2012 14:00:27 -0600 From: "Littlefield, Tyler" 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: design question:game skill system 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349208044 news.xs4all.nl 6940 [2001:888:2000:d::a6]:49782 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30654 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, -- 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.