Wednesday 14 September 2011

Strategic Ai Player Logic Finished - Cue 9000 Day BugHunt

As a great believer in "attacking the difficult boring stuff now", I'd worked out the gameplay logic required to have my Ai factions work their own strategies in the "strategy" part of the game ... for that is where strategy happens.

And then it took me 9000 days to reduce the level of embuggeration from "rather high" to a mere "bugger all" <- I'm from Yorkshire, in England, old England, not the one in America, which though I have no idea what the weather is usually like there, I doubt it gets anything like the amount of drizzle that the original gets ... we use this colloquial terminology a lot, not usual about bugs or bughunting, just life in general.

But bugs there were.

9000 days of bughunting ... or over 9000 days of bughunting? Actually it was more like 18 hours a day for 2 weeks of bughunting ... and I made a serious attempt of going through a pack of post-it notes recording them all. Which is how I tend to work.

Write codeyscriptythings, playtest, record failings on post-it note, rewrite codeyscriptythings, playtest, cross off fixes, concentrate on recurring issues, then rinse, wash, lather, scrub and repeat. post-it note to self: in future use "imaginary" soap and water for wash/rinsing euphermisms ... also check if euphermism is the word I think it is ...

So, with bugs fixed and my liver thinking that I've been held hostage away from the pub against my will, let's recap on what actually works.

In the "Main Campaign", the Player has a team/faction/nation, with Ai taking the other 5. The idea is to carve out your little empire, bringing in cash with resources, that are mined by the native population, that are fed with agriculture. More natives than food = unhappy workers, less work, less income, and eventually sedition of urban territories.




Poor management of colonial types leads to dastardly acts of piracy and sedition! Just ask any American ...


Each faction expands through territories, creating new garrisons to keep down unhappy natives, as well as helping to reinforce nearby areas with additional troops. If a Faction loses all of it's Garrisons, it's booted off the map and the remainder fight over the spoils.

Each faction can also save up for more dirigibles ... or can simply capture one by winning some aerial combat, thus depriving the enemy of either the cost of a new one, or the time it takes for their sponsor nation the send a replacement (5 turns). No dirigible means no "fast action response" to attack, and they're left to defend their territories with just native militias. And with no dirigible available to zip around the colonies and keep the locals in check, the natives slack off from the jobs and income halves.

Each of the Ai Factions has their own strategy randomized at the beginning, to determine how that Faction will play the game, ranging from aggresively expanding and looking for enemies to strike, to carefully protecting their territories, keeping natives happy for a steady stream of income and building up their defenses.

Currently the battles are all sorted out by a simple "resistance table" roll ... played Call of Cthulhu/ StormBringer/Runequest with pen/paper? Then you know what I mean ... [/oh_teh_nostalgia] ... for the moment it's based on simple troop numbers versus population with garrison modifiers, but eventually it'll be expanded to choose veteran troops from the sponsor faction/nation, local militias (for cheap and cheerful) and fought out over the tactical squad-tactics part of the game.


Tactical squad-tactics ... because Take That Grammar!


Anyhow, that's to come next ... when things get bafflingly complicated and I have to do stuff with "files" and variables that I'm never attempted before ...

In the meantime ... video ... not very exciting video ... as it just shows the turns being taken by Player and Ai and all of the battles are resolved by hidden dice throws ... but you get the gist ...

... in fact it was so "not very exciting" that for the first time ever I attempted to replace the audio on the YouTube video ... I don't know what I chose, but the first 15 seconds sounds like something a Windows platform developer listens to ...