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


Groups > comp.lang.python > #30677 > unrolled thread

Re: design question:game skill system

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2012-10-03 10:50 +0200
Last post2012-10-04 06:19 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: design question:game skill system Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-10-03 10:50 +0200
    Re: design question:game skill system Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 06:19 -0700
    Re: design question:game skill system Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 06:19 -0700

#30677 — Re: design question:game skill system

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2012-10-03 10:50 +0200
SubjectRe: design question:game skill system
Message-ID<mailman.1757.1349254197.27098.python-list@python.org>

----- 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

[toc] | [next] | [standalone]


#30722

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-10-04 06:19 -0700
Message-ID<d4e3b605-640d-4212-b80c-ef8f9c10cc67@googlegroups.com>
In reply to#30677
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.

[toc] | [prev] | [next] | [standalone]


#30724

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-10-04 06:19 -0700
Message-ID<mailman.1796.1349356782.27098.python-list@python.org>
In reply to#30677
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web