Pyrel dev log, part 5
Collapse
X
-
I hadn't looked at the relevant code before throwing out my idea for storing the player knowledge. I think a hierarchy of dicts is the most flexible, and is the right choice.
However, if performance is a consideration, it'd be faster to have all the keys in one dict, and represent the hierarchy through the respective key names, rather than a hierarchy of dicts, due to the extra calls made to __getitem__ descending through the tree. Attached is a script (run with ipython) that shows 3 implementations (nested dict, flat dict, flat set), and their resulting memory size, as well as time to fill and access, respectively.
Code:create nested dicts 1000 loops, best of 3: 848 us per loop size 1048 access 1 1000 loops, best of 3: 375 us per loop access 2 1000 loops, best of 3: 687 us per loop create dict with path keys (i.e. creature.Fire Hound.magic...) 10000 loops, best of 3: 132 us per loop size 12568 access 1 10000 loops, best of 3: 119 us per loop access 2 1000 loops, best of 3: 213 us per loop create set 10000 loops, best of 3: 148 us per loop size 8424 access 1 10000 loops, best of 3: 120 us per loop access 2 1000 loops, best of 3: 214 us per loop
Attached FilesComment
-
That's good to know. I guess the main concern for a nested-dict setup is how long it'd take to load player knowledge when the program starts up, since you have to initialize the whole thing in one go.
I expect most of the accessing is going to be done by e.g.Code:player.getKnowledge('creature', creature.name, 'magic', 'spells', spell.name)
Incidentally, mtadd, thanks for submitting all those pullreqs recently!Comment
-
No wait, I'm getting confused, aren't I? +fin/prow are *already* treated the same as pvals in the code, aren't they? So we're only talking about the display. I think it might do more harm than good to display (+fin, +prow) where V displays (+hit, +dam), as they're fundamentally different. My suggestion would be to relegate both to wherever pvals are inspected."Been away so long I hardly knew the place, gee it's good to be back home" - The BeatlesComment
-
No wait, I'm getting confused, aren't I? +fin/prow are *already* treated the same as pvals in the code, aren't they? So we're only talking about the display. I think it might do more harm than good to display (+fin, +prow) where V displays (+hit, +dam), as they're fundamentally different. My suggestion would be to relegate both to wherever pvals are inspected.
* curHitpoints, nativeDepth, and experienceValue are not stored in the Stats entity for whatever reason, but we could easily move at least the latter two into it. I think curHitpoints should probably stay as a separately-tracked value since the game does want to know when things die.Comment
-
Correct, every modifier on every Item (and almost every modifier on every Creature*) is just an entry in the Stats entity for that object. I do think there's some value in giving prominence to the "most important" stats for an object (thus dice, fin, and prow for weapons, and absorption/evasion for armor), but that's just for purposes of easy legibility.
* curHitpoints, nativeDepth, and experienceValue are not stored in the Stats entity for whatever reason, but we could easily move at least the latter two into it. I think curHitpoints should probably stay as a separately-tracked value since the game does want to know when things die."Been away so long I hardly knew the place, gee it's good to be back home" - The BeatlesComment
-
I don't disagree with that, but you have talked elsewhere about the importance of intuitiveness / noob-friendliness. I don't know whether you think about those things specifically through the lens of V or just roguelikes/gaming in general - but I think a lot of people will think "oh, those are plusses to hitting and damage" because that's a common RPG convention. If you go with the prominence, I think it would help to make it a very early piece of tutorial help that +fin has no effect on accuracy and +prow has only an indirect effect on damage.
I think honestly the way to go here is to have a tutorial that explains things. We'll need one anyway.Comment
-
I think a good middle ground to take is to display the Balance / Heft numbers and move +Pro and +Fin to the pvals.
Simlarly, I'd like to see the base level affixes to modify balance and heft rather than prowess and finesse... a "sharp" dagger does nothing for my kobald's ability to hit hard, but does affect how much of his meager arm strength the dagger can convert to damage. So as a sample, something like:
Sharp Dagger of Finesse (1d4, 90/15) <+48 fin>
That still leaves it where an explanation is going to be required for the newbies at one point or another, but it puts the most important weapon characteristics under this system immediately visible.Comment
-
I think a good middle ground to take is to display the Balance / Heft numbers and move +Pro and +Fin to the pvals.
Simlarly, I'd like to see the base level affixes to modify balance and heft rather than prowess and finesse... a "sharp" dagger does nothing for my kobald's ability to hit hard, but does affect how much of his meager arm strength the dagger can convert to damage. So as a sample, something like:
Sharp Dagger of Finesse (1d4, 90/15) <+48 fin>
That still leaves it where an explanation is going to be required for the newbies at one point or another, but it puts the most important weapon characteristics under this system immediately visible.
Please rest assured that there are affixes that affect balance and heft, as well as those affecting fin and prow. In the interests of game balance, the former are rarer and deeper than the latter."Been away so long I hardly knew the place, gee it's good to be back home" - The BeatlesComment
-
Putting balance and heft in as the primary weapon stats does sound reasonable. Good idea.
Regarding having e.g. "<+5 fin>", any thoughts on having pvals generally display short text for what they modify? In Vanilla it's just "<+4, +1>" and the like. v4's items tend to have longer names in general, and I suspect it's only going to get worse in Pyrel...Comment
Comment