Pages

Monday, 23 December 2013

Stats you say?

Grr... i'm so mad that i didn't finish yesterday, i really could have you know? >_<

Either way, this bettered be over by tonight, if i can't just relax on the 24th (tomorrow) and finish off contrast and read some of that nice Asylum book i've got afterwards, what kind of a jól will that be huh?

Hrmpfh.

Now how best to do stats... lets see yesterday i decided:

statname_base = base value + base_modifier values
statname_modifier = effects from items or spells + racials/perks
statname = statname_base + statname_modifier

Now it's about the statname_base

Should that be a class? should that be a method for each stat? or should it just be a variable?

Humm...

I'll start by just making it variables...

Wait...

Some stats are racial. Oh but these will be applied via a perk system (and thus i edited the above)

Now it's all pretty clear :D

Let's see.. .1 by 1

Maybe, i can use a list or dict rather than just a standard variable.

like

HP = {'base': 50, 'modifier': 0, 'max': base + modifier, 'current': max}


no wait... isn't that... perfect? testing testing testing...

hmm

I'm writing some prototype code for it, to see how many values i really "need" per stat, after that i will decide how to handle it, it's not pseudocode but not real code either (i comment out modifier values)

Thanks to well written design documents (Ho-ho-ho) this wasn't hard, but it still took time since there are a lot of stats.

I've written it down in code-form now in a third party document. Now it's just... how... best... to... do... hmm...

If i were to divide it into classes i'd have

HP
Mana/Stamina
Resistances
Reputation
Hit/Crit Chances

But what about the others... Some can get away with just being one variable

One thing is for sure, there's no easy way to do this. If there is, i'm not seeing it. I "could" make a shitload of variables... but, it's a question of "should" and "Shouldn't"

Only way to find out is try i guess.

i think this looks ok in "HP"'s case

class
Health(object):
    def __init__(self):
        self.Base = 50 # + (Vit / 2) * PL
        self.Bonus = 0
        self.Max = self.Base + self.Bonus
        self.Damage = 0 #Damage taken
        self.Current = self.Max - self.Damage
    def Calculate(self):
        self.Current = self.Max - self.Damage
        return self.Current

Don't You?
...

No
there's one fundamental flaw in there.. that's the "Base" value... i need to be able to calculate it again in the "Calculate" method...

Hours later...


I finally managed to start rolling this up. After all these hours i've finally built up some sort of system for this. Huff, puff... but by the time i had written all the stats except for sex related and resistances it was 3AM. And time for bed. Luckily, i've already written the base code for this system so the rest will be pretty much copy/paste work.

Cool part? much of this is pretty much "final" code, i.e. while testing this i'm seeing real values a player could possibly start with :)

A basic human would for example start with 65 HP. a Fae would start with 60, a garax would start with 75. These are numbers i've known for a while, but now my complicated chain of inherited classes is spitting out these numbers for me :D

To be honest it was almost painful to stop now!

No comments:

Post a Comment