Friday, August 31, 2012

the testing of DOOM & unittests

This is in reference to FantasyMathHammer, it's about boring coding stuff and not warhammer specific.

Still here? Cool.

Up until now I've been feverishly adding new units, and any vital special rules those units need (for instance, undead units really do need unstable), but avoiding the less necessary rules like special weapons - like Halbards (I added those last night btw).

I foolishly didn't write unit tests as I was developing and instead tested it by running the app myself and checking the full debug logs I had already added into the app.
Slowly, and surely, checking and debugging anything with this method started to take more and more time. It's also quite error prone, as you can imagine.

Eventually I reached a place where a few things occurred.
  1. Debugging like this was clearly taking more time than if I just wrote a unit test for the same instance. Starting the app, picking the exact units and formations, all took time vs pressing the UP arrow, and enter to run some unittests.
  2. There were vast swathes of code, nay, entire plains worth, which I was afraid to touch in case I broke anything. My testing method meant that I couldn't go back and retest everything, I could only test for a specific case or thing which I had just added. Clearly not a good place to be.
I should have known better, I did really, but was attempting to fool myself. No really, I should have known better. WFB is a massive set of rules, all thrown into the same mix and interacting with each other. What did I think was going to happen? That I would construct a massive & intricate spiders web of interconnected code and it would all be fine? 

Yesterday I decided it was time to pay the unittest piper.

The unit tests I've written in 3 hours have already picked up some juicy bugs:
  • Derpy Mounts: I implemented mount attacks in combat in v0.50. Unittests showed that they were totally broken, the mounts would act as their parent unit and just use their stat line when attacking i.e. Demigryph knight mounts would use their knights statline when attacking. Fixed.
    Demigryph's (and other mounts) are a lot better now. Sorry about that.
  • The Mounts were receiving supporting attacks. Mounts should not get supporting attacks. Fixed.
If you're reading this and aren't a coder of some sort, unittests might sound like some magical easy band aid. They're perfect for my situation. Once they're covering a lot of the app's code it will mean I can add new code, or edit existing code and if I break anything the tests will throw an error in the relevant test case.

The downside is that they're going to be a metric tonne of work and I won't be adding armies or special rules handling while I'm implementing tests. Still, catching bugs like the above ones make it worth while.

MENTAL NOTE:
UNITTEST THE SHIT OUT OF STUFF FROM DAY 1.

Unittests are nice! I like!


Thursday, August 30, 2012

Tonight's coding music is

MC Frontalot.



Here's a playlist of his stuff.
Ever play Zork? Then this track is for you.
I like. Now you like.

Tuesday, August 28, 2012

FMH v0.65 - Beastmen of Gojiranotronia

Version 0.65 is out. Get it here.

Wow, I really wasn't lying in my last post when I said that positive feedback is my development jamba juice.
I spotted this review as I was about to log off and head to bed.
"Currently I give it 5 stars because the UI is lovely and it's really easy and quick to use. Far better than a regular warhammer calculator especially for during games and quick things. If you add Beastmen I will give you 10 million stars."

Dwarven eyes twinkle while imagining TEN MILLION STARS OF WEALTH.

It's now jaysuschristoclock, and I'm off to bed after a productive few hours - the Beastmen are in, and I pushed it to the market place.

I hope I didn't break anything in the app with my frenzied coding and lax testing standards...there is only one of me after all.

Monday, August 27, 2012

FMH v0.6 - TombKings


I've released v0.6. Get it here.
I added the Tomb Kings, cause Steven complimented my app so nicely. Thanks for that Steven, positive feedback is my development jamba juice.

I fixed some other things that reddit folks pointed out, like no Orc & Goblin Big 'Un units in the app at all, and that Choppas didn't work.

I also added Lances while I was at it, as they are so similar to Choppas, I didn't get a chance to implement anything to handle the Brettonian Lance Formation though. Maybe next time, though I'm prioritising getting all of the armies into the app before I start on each and every special rule.

This is the 11th army in FantasyMathHammer. Woo!

Here's the release notes:
v0.6
Added:
- Added TOMB KINGS!
- Tomb Kings work with UNSTABLE special rule.
- support for LANCES for all races (HE/EMPIRE/DE/VC/BRETS).
- O&G CHOPPAs rule support. mmm, choppy.
- Orcs & Goblins GIANT. Not yet handling giant special attacks though, just gave him 4 attacks.
- Empires Inner Circle Knights
- all Orc Big'Un units.
Fixed STEADFAST rank counts, in certain circumstances the
last horde rank wasn't counted when checking for STEADFAST.

Sunday, August 26, 2012

Garagehammer App mention

Woo! My app got talked about in today's Garagehammer, Episode 55.
It's about 10 minutes in, and they chat about and around it for a good 10 minutes. Unfortunately being iPhone users they haven't actually used the app (heh!), but they still went and had a look.

Thanks a million guys, much appreciated.

Get my app here.

Thursday, August 16, 2012

Dwarfs vs. Lizardmen, 2.5k

I used Battle Chronicler to put the report together. It's a really nice application, though there are a few gotchas to it. I really like it though, get it free (!) here.

Army Lists:
Dwarfs
Core
DW1 40 Dwarf Warriors, FC, GW - 425
DW2 10 Dwarf Warriors, Musician, GW - 105
DW3 10 Dwarf Warriors, Musician, GW - 105
Hero
H1 Dragon Slayer, with RoSmiting, 2xRoInitiative 85 points
BSB with Strollaz Rune
Runesmith with MRoBalance + spellbreaker
Runesmith with MRoChallenge + spellbreaker
Runesmith with Spelleater
Special
H2 30 Hammerers, FC - 390
S1 25 Slayers + 5 Giant Slayers - 423
S2 25 Slayers + 5 Giant Slayers - 423

Lizardmen
Core 
S1 30 Skinks + 3 Kroxigors - 337 points
S2 10 Skinks 50 points
S3 10 Skinks - 50 points
SS1 7 Skink Skirmishers 70 points
SS2 7 Skink Skirmishers - 70 points
SS3 7 Skink Skirmishers - 70 points
JS1 Jungle Swarm - 45 points
JS2 Jungle Swarm - 45 points
Special 
TG 28 Temple Guard, Temple Guard - 467 points
Rare 
SHP 2 Salamander Hunting Pack - 150 points
Lord
SMPB Slann Mage-Priest BSB - 300 points
SMP Slann Mage-Priest - 275 points
Hero 
SSV 3 Saurus Scar-Veteran - 160 points

Deployment

Turn 1 - Dwarfs


Turn 1 - Lizardmen


The 3 saurus scar veterans charge the slayers, and start slowly but surely wiping them out, killing 8 this turn. The slayers score only a few wounds, all of which are saved.
The 3 units of skink skirmishers move and shoot at the warriors, amazingly they only kill 6. The warriors don't panic.

Turn 2 - Dwarfs


DW2 Dwarf Warriors on the left flank charge skink skirmishers, killing 4 and routing them. Persuit roll succeeds and runs them down.
S2 Slayers continue to take wounds, while causing none. 1+ armour save, which is re-rollable, or ward save of 4+ (depending on which veteran I target) is very hard to brea.
S1 Slayers charge the Jungle Swarm, wiping the swarm out and overrunning into the Salamander Hunting pack.

Turn 2 - Lizardmen


SS1 Skink Skirmishers kill another 3 DW2 Dwarf Warriors. The warriors do not panic though!
S2 Slayers continue to take wounds, while causing none.
S1 Slayers wipe out the Salamander pack, and overrun for a second time (!) into the Skinks. I think this was a mistake, they should have faced off against the temple guard letting DW1 get into the fight.

Turn 3 + 4 - Dwarfs


S2 Slayers continue to take wounds, while causing none. They reform into a 5x3 with remaining troops. They're not going to last much longer.
S1 Slayers wipe out the Skinks and reform to face the temple guard. They change into a 5x4 with their remaining 21 models.

Turn 4 - Lizardmen

The Scar vets and the Slaan BSB charge the warriors, and do some damage. The warriors fail to cause any wounds against the Scar Vets, but hold as they are steadfast.

Turn 5 - Dwarfs


The H2 Hammerers attempt to charge into the flank of the scar vets, but fail their required roll of a 6 with double 1's. ARGH.
DW1 continues to die slowly to the Scar Vets, they do manage to do a single wound this turn though!
The Scar vets target the BSB in the warriors, killing him very very dead.
The S1 Slayers kill a few of the Temple Guard, but take more wounds themselves. The Slayers went with GW's for this combat (since the combat started that is).

Turn 5 - Lizardmen


The BSB Slaan finally gets a spell off (up until now, the Dwarfs have used roughly a scroll a turn, even with RoBalance and 3 Runesmiths for 3 dispell dice, it's hard to handle a +4 caster). The Slaan has previously been using death magic spells which targetted the BSB in the unit, leadership tests for wounds and damage.
He casts Purple Sun (ARGH!) and it side swipes the DW1 Warriors, and the Hammerers. It lifts about 13 warriors and 16 hammerers.
The Scar Vets finish off the Warriors, the Slaan BSB persues and catches them to wipe them.
The swarm chaff moves in front of the hammerers to block any charges.

Turn 6 - Dwarfs


The H2 Hammerers charge and destroy the Jungle swarm, but the overrun angle means they can't make contact with any other units. Instead the Hammerers reform to avoid any flank charges.

Turn 6 - Lizardmen


The Lizardmen finish off the slayers, but don't charge the hammerers - playing it safe and not wanting to lose any points.


What worked well:

My measuring tape...
My first overrun into the chaff which lined me up nicely with the salamanders.
I like Slayers being unbreakable, but they don't seem quite choppy enough on their own. They did take 3 full turns (~6 turns of combat) to be destroyed by the 3 [SSV] Saurus Scar Veterans, which kept the SSV's away from other more fleshy things.


What didn't work well:

Not having cannons:
I couldn't deal with the 3 Scar Veterans, just couldn't scratch them.
Cannons would probably have dealt with two of them. But taking cannon against 25 scouting skinks that can throw out 50 poisoned shots every turn, means I'd be lifting any cannons pretty quick.

I kept forgetting about the Rune of Challenge, though the Runesmith with it was in the Hammerer unit and couldn't have done much. 
Mental Note: Rune of challenge could be used on chaff which is about to block your unit, to get the chaff to charge or flee during opponents turn. It might be a bit of a waste using it on chaff, but if it means your unit gets a decent charge into an important spot the next turn, then it is worth it.


What I would do differently: 

I was overeager. "RAWR! I have teh Strollaz! I must run as fast as I can at you and do DAMAGE!"
He had no warmachines, and a bunch of shooting which was concentrating on my 10 warriors, I didn't really need to run ahead quite as fast. It's just so tempting when you take Strollaz, to use it.

Dawn attack really screwed my hammerer and warrior unit. They were pretty much out of the battle (though double 1's didn't help for their charge!). I outnumbered the lizards unit to unit, I should have waited in the centre while I brought the Hammerers over to somewhere usable.

Next time, if I know a unit is a bit fooked, I might leave my BSB behind the unit before they charge / get charged. The BSB can be picked out by death magic anyway - though I would be exposing the BSB to a hail of skink fire. It might be worth it for the Runesmith though. They're really just there for the dispel dice, and suck in combat.

I still feel like this slayer build could work, but I'm missing the Anvil. It's just so...expensive, and vulnerable.
This slayer list will be back, I'm not done with it yet. No sir.

Tuesday, August 14, 2012

FantasyMathHammer v0.55 - Brettonians added

FMH - now with 100% more
Brettonian flavour.
Another update, this one adds the Brettonians to the app, bringing the grand total to 10 armies out of 16.

Get it here. The market should have updated with the new version within the hour.

Be warned ye Brett players. The app doesn't yet handle lances on the charge, or 'The Grail Vow' which gives Grail Knights Immune to Psychology. It will in the next update.

I'll get there (to 16 armies that is), but gosh darn it it's a lot of work to add a new army.
Bed time now. nn o/

Friday, August 10, 2012

FantasyMathHammer v0.51 'ColdBlooded Ed.' released

Can now specify a General's higher
leadership  to use for a unit.
Now with added Lizardmen, and a slew of bugfixes.
Get it here.
There are a few big changes which I'd like to highlight:
  • Lizardmen!
  • Mounts now get attacks. They didn't previously, so if your Demigryph knights seemed underpowered, it's because they were. This required a bunch of work for all existing armies so that their mounts now fight properly (DE/HE/VC/Ogres/Empire).
  • The ability to use a "general's" leadership, and override your units leadership. This should be useful for those skaven slave units, or other porridge units which have low leadership.
  • UI Guide:
    The app now attempts to guide you through the process. Once you've selected two units, the UI will jump to the next screen to choose unit numbers. If you change the unit size and front rank size of both units, the UI will jump forward to the unit options screen.
  • The back button works on all screens now! I'm sure it was amazingly annoying to everyone, that previously the back button quit the app. Sawwwry about that. It should be working hunkey dorey now.
The full change-list:
v0.50
New bits:
- Added Lizardmen
- mounts now get their attacks against enemy units
- use General's leadership
- updated to Kivy version 1.3
- made the unit picker UI text size larger, should be easier to pick units now
- back button now works
- UI guides you through process
- tree node press vibrates
- accordion press vibrates
- scaly skin armour values
- put unit numbers in fight button & result box
- update popup
  - show popup with latest updates list
  - option to never show popup on start up again, but it's accessible via menu screen

Bugfixes:
- hammerers and other units were getting shields (and a ward save) allocated to them by mistake
- stop model numbers buttons from turning off if pressed again
- Phoenix guard get their 4+ ward save now.
- fixed a bug where if the front rank equalled the max num models that could hit in that unit, then the front rank wasn't counted.
- if difference between strength and toughness was MORE than 2, it fell through the if/else check, and defaulted to a roll of 4 to wound.
- limit number of melee rounds to 12
- fixed bug where fear tests only passed if rolled less than leadership. Equal to leadership was a fail.
- impact hits bug - only the top unit got impact hits (if the unit has the impact hits ability)

Thursday, August 09, 2012

Tuesday, August 07, 2012

WFB shecksy models - Bloodletters

bloodletters
The herald of Khorne points out his enemies...you know, in case they weren't sure.
bloodletters v dwarf warriors
20 Bloodletters charge headlong into a unit of 30 Dwarf Warrior Rangers. Somewhat surprisingly, the Warriors hold and start winning over two turns. Until the Bloodthirster showed up.
bloodletters vs hammerers
Meanwhile the main bloodletter unit is about to decimate the Hammerer horde, killing over 23 models in the first turn. Goooood, feel your hatred.  It gives you focus, it makes you stronger and lets you re-roll hits in the first round of combat.

Friday, August 03, 2012

FMH : Lizardmen & more

Been working away whenever I have some spare time to put in, knocked the following off the to do list. These haven't been pushed to the market version just yet. I'll release another update once I've finished a few more items on the todo list.
Hooray for progress!

New bits:
  • added Lizardmen
  • mounts now get their attacks against enemy units
  • leadership proxy - is general nearby? allow user to override units default ld and specify a generals ld value to use
  • updated to Kivy version 1.3
  • back button now works instead of quitting app
  • change UI layout for unit numbers
  • UI now tries to guide you through the unit choosing 
  • tree node press vibrates
  • accordion press vibrates
  • highlight unit numbers when switch to default unit models tab (20 and 5 for front rank)
  • flip both units accordions when 2 units have been chosen
  • lizardmen get their scaly skin armour values
  • put unit numbers in fight button 
  • put unit numbers in result box
  • unit log names updated to include their original number of models for easier identification if the user has chosen two units of the same name
Bugfixes:
  • stop model numbers buttons from turning off if pressed again
  • hammerers and other units were getting shields (and a ward save) allocated to them by mistake
  • Phoenix guard get their 4+ ward save now.
  • fixed a bug where if the front rank equalled the max num models that could hit in that unit, then the front rank wasn't counted.
  • if difference between strength and toughness was MORE than 2, it fell through the if/else check, and defaulted to a roll of 4 to wound.
  • limit number of melee rounds to 12
  • fixed bug where fear tests only passed if rolled less than leadership. Equal to leadership was a fail.
  • impact hits bug - only the top unit got impact hits (if the unit has the impact hits ability)



Wednesday, August 01, 2012

I will not...

leave any units which take leadership tests outside of my BSB's 12" bubble.

A unit of 40 Warriors with GW's, 8 ranks deep, were steadfast, but failed combat on a roll of a 10. They fled and were run down.

I will not leave any units which take leadership tests outside of my BSB's 12" bubble.

I will not leave any units which take leadership tests outside of my BSB's 12" bubble.

I will not leave any units which take leadership tests outside of my BSB's 12" bubble.

I will not leave any units which take leadership tests outside of my BSB's 12" bubble.

I will not leave any units which take leadership tests outside of my BSB's 12" bubble.

I will not leave any units which take leadership tests outside of my BSB's 12" bubble...