Monday, May 3, 2010

Power Play

So, Exasperation has hit the ground running. He has already cleaned up a ton of my messes, mostly having to do with how mobs are spawned down below (a place I rarely traveled during the last 6 months).

I had a fairly productive day, but a lot of that was chasing bugs. I think I'm learning the value of efficient debugging.

Friday, April 30, 2010

Why units refuse to lose their abilities

So, if when {CLEAR_VARIABLE unit.abilities}-ed a unit, it didn't always drop their ability. This was very troubling. I had Dwarvish Guardsmen with bucklers that refused to give up steadfast along with Fencers wearing armor who could still skirmish. This totally wasn't the case ever for player characters. This code, inserted into the start event of the tutorial, confirmed it.

Hypothesis #1: It has to do with the fact these NPCs are canrecruit=no.

Nope. Tested it in the Tutorial. It did the same for Konrad (if I made him a Dwarvish Guardsman).

Hypothesis #2: There's a [modification] that needs to be removed.

Nope. Not in the save file.

Hypothesis #3: Abilities of regular-ish units need to be removed via [object]/[effect].

Damn, this one worked, but there's no way to just clear them all like that.

Then I talked to zookeeper who, as always, had brilliant insight. In IRC:

zookeeper: could it be that removal works on abilities which are no inherent to the unit type?
zookeeper: that'd be my first guess; that the game would see something missing and would recalculate it...like if you removed unit.hitpoints then the game would recalculate it (probably means fill them up to max)

Oh, so I just put a dummy [abilities] container in after clearing it and it worked fine. It turns out that PCs never had an inherent ability, so it was never an issue.

I was really scared this would be a roadblock, but it turned out not to be, thanks to good ol' zoo.

Thursday, April 29, 2010

Abilities mostly done, valuation mostly done, now for items gain

I've come to a resting point for valuation. Some abilities, specials, and traits are all that is left, and I would mostly just be throwing random values at the algorithm for each one.

Instead, I'm focusing on how to make the item move to and from the players and the environment. I'll have to scrap a lot of the old way of doing things, but I can replace most of that with the NPC valuation now.

I got PCs giving shields to NPCs working. It was great to simply create a second copy of a unit, give it the new shield and see if the valuation algorithm thinks it is overall better or worse than the original. And, it's working good. A Thief is worse off with a shield while a Thug is better off, so the thief refused.

The difficult part is going to come when I try to give a unit a weapon when it already has 3 equipped.

I've also given most weapons negative evade adjustments, and most armors' negative evade adjustments have been lessened. A weapon, simply depending on its type, will have either 0, -1, -2, or -3 evade adjust. I'm a little unsure about this, mainly because you would expect a heavy club to have more of a penalty than a light one, but it's not like strength has ever found itself into the evade equation from the start.

Thursday, April 8, 2010

Not So Bad

Fortunately, the new release of Dwarf Fortress is more buggy and the docs on how to play are less complete than I had anticipated. This means less time it will be sucking away at my soul and more time on Wesnoth.

I think I have the multiple-attacks-of-a-range system down well enough now.

I need to get abilities now, but Trolls and Fungoids (consider them underground Woses) have natural armor, which means they won't be nearly as weak as the units wearing tattered versions of whatever they wear. This means it's going to be difficult to give a value to regen.

I need to get back into the project because I'm daydreaming of making action games again. I've got a unique setting nearly fleshed out any everything.

Friday, March 26, 2010

Second attack of a range

I have the value of a second attack of a range down, but I'm rather unsure of the result. There are parts that can be tweaked, but I'm having trouble deciding their values. At I can say this much: having an extra attack of a range, no matter how small, will be valued higher than not having it, given everything else as constant. In the process of making this, I even got to use a little knowledge about sorting from a really simple coding course I'm taking.

As soon as the abilities are in, and they shouldn't be too hard, I'll be provisionally done with the valuation algorithm. Non-mainline specials.abilities can wait for later.

Next will be the hard part (again?): advancement path finding. I guess the best way to go about it is to make logical trees to try, give the unit maybe 3 chances to try them and look for the highest value.

Ugh, and then there is Exasperation's code that I need to replace, which lets a unit decide for itself whether or not to pick up/equip weapon/armor. I need to make sure if a unit that doesn't have evade and has cheap armor will still wear the armor rather than going naked. Let me add that to the to-do right now.

Tuesday, March 16, 2010

Valuation Again

This value algorithm isn't nearly as grind-y as I thought it would be. It's actually going down really, really easily. Part of the reason for that is I can usually just assume a unit's usefulness goes up with each aspect of it. For example, a unit with 6 moves is going to be well enough better than one with 5 moves, given everything else is the same. There are no "tits on a bull" aspects to units. Movement, terrain defense, resistance, hitpoints, attack power. Having one low aspect is going to seriously hurt the unit, but there doesn't seem like there is one combination that is hugely better than another.

There are a few exceptions to this. Skirmisher gets a ton better the more the unit can move around. But, even at 1 movement, Skirm is going to have some value. Steadfast is good only if the unit has some positive resistance. It actually is at its best at 25% resistance and then gets less and less valuable as the resistance nears 50%. These exceptions are few and pretty easily managed.

Managing terrain defense and movement cost has been a bit of a trial. For some reason, Elvish Archer is being valued less than Elvish Fighter. That probably has more to do with the Archer having one less movement point than it does with the terrain issues.

Wednesday, March 10, 2010

A few days on the grind

Working on the valuation algorithm. It's going surprisingly well, though I've only made it work with the most regular units possible (e.g. Thug, Bandit, Heavy Infantryman, etc.).

One challenge: Low-level units are constantly being under-valued. There's an imbalance between Wesnoth's Mainline gold value of a unit and its value if upkeep isn't involved. A level 5 unit in Wesband will use as much upkeep as will a level 0 unit (none). Perhaps I should say that the average scenario in Wesnoth is 20 turns long, so the actual value of a Spearman should be 14+(1*20). That is to say, a units true cost is its initial recruitment cost + (upkeep * turns in an average scenario). So, instead of a Peasant being valued at 8 and a Spearman at 14, it should actually be 8 and 34 respectively. Ouch. As I'm writing this, it hurts, because that would mean most of today's work was for nothing. Haha.

Another challenge: What is the value of a secondary attack of the same range as another attack (e.g. Dwarvish Fighter's hammer attack)? Sometimes it can mean a slightly better attack, but other times it's useless. How would I put a gold value on versatility?