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 ...

Thursday, 25 August 2011

Strategy Gameplay CivLite Hexagon Hell also Dirigibles

Does exactly what it says in the title ... I think ... Behold the wonder of hexagons! Behold not very good mathematics for procedural placement. Also behold Dirigibles. Have you beheld? Then good.


The idea is StrategyLite-TacticalHeavy ... to be honest I just made that up right at this moment - which is probably exactly how marketing departments work in huge, lumbering, faceless multinational corporations ... maybe I'll patent it ... and then sue everyone who ever used a hyphen ...

I'd ummed and ahhed about how to make a world map for the strategy campaign section of my squad tactics game idea - and after about 30 seconds decided on hexagon models, mostly due to them having less sides than octogon models. I proceeded to quickly make said models because I had nothing hexagonal to use as a placeholder. Then a slapped a load of them together to see how it looked.





Each area is supposed to give a random amount of resources (agriculture, population, natural resources) based on geographical type of Temperate, Urban, Mountainous, Arid and Jungle. It works in a simple rock/paper/scissors (don't run with the last one!), so agriculture feeds population, population gathers natural resources, natural resources = spending money from your chosen Regime.

Obviously having a manually placed campaign world isn't terribly interesting for replayability, so I came up with a half-arsed procedural generation scheme, which after much bafflement of mathematics and only one cup of tea since stumbling out of bed, gave me a fully randomized giant hexagon of hexagons. With it being a giant hexagon I thus had 6 corners to place the starting garrisons of each of the 6 factions/regimes I'd decided on.



Majestic ... and that's just the Ambient Occlusion map! Textures to come ...

I knocked out the basic idea of gameplay for this section, with the player's vehicle moving around in a Pac-Manesque manner, eating up unoccupied groups of hexagons, and slapping his sponsor's flag on it. The idea is that when the avatar hits a blank hex, it lays claim to all free hexes that are touching. Eventually they'll come across a hex which is occupied by a rival faction or get raided by dastardly zeppelin pirates, and then it's combat in the squad tactial gameplay bit. Troop numbers for defenders will depend on the population of the hex under attack, and bonus troops if it's in protective range of a dirigible or garrison. The attacking troop numbers will depend on what type of dirigible is attacking the area. Rinse and repeat until each Regime has had all of it's garrisons blown-to-buggeration and only one Faction is left.





Still a fair bit to finalize, I've got to sort out various Ai strategies for this gametype, the whole cash flow thing, creating new garrisons (game over if you lose them all!), and obviously some save system is rather neccessary. Also I need to work out the ins-and-outs of moving from the strategy zone to the tactical zone and back again, with the score, character losses, promotions, etc.

And of course all of the finalized art for this ...

In other news, back to the tactical zone for a moment as I decided it would be fun to have secondary explosions. So if any cache of weapons/ammo that's been dropped has an explosive (eg: grenade) in it, and then it gets caught in a blast - it'll go bang too.





In the end, I'm sure it'll all be ...

Sunday, 17 July 2011

TorqueTactics: Magnets! How Do They Work?! I Mean Inventories ...

Fuuuuu --- Magnets!

TorqueTactics/Torque X-Com Style GamePlay Month 2:

So I sorted out a custom inventory system ... eventually ...

Not wanting a gazillion items spilling out and rolling around the game-world, I decided on a simple system (it wasn't). I'd have 3 item types that could be scrolled through back and forth - weapons (guns! etc), ammunition (bullets! etc), items (Hankerchief! etc), and this would be mimicked in the "dropped item cache" which is a bag full of whatever got dropped.

Caching dropped items at a location obviously prevents having to render all of them together, especially useful when ammunition was divided into 5 round stripper clips and a dead team member could drop an imperial tonne of them the moment they left this mortal coil.

So that's 3 arrays of objects for the playerObject's internal inventory, and another 3 for whatever has been dropped (if anything) at that location. And then there are another 3 options that you can do, pickup, drop and use ... somehow it just seemed like more than the 27 possibilities that it was ...

And boy did it take some bughunting to get everything working within those 27 combinations ... I promptly massacred a pack of post-it notes ...





I've also got a system of attributes for each little in-game chap which affects various gameplay parameters. Strength is the important one when it comes to lugging stuff around and off-setting your aquired encumberance. (though in the above pic, that guy ain't going anywhere!) When encumberance exceeds strength it'll start to eat into your available action points.

"Throw" button isn't currently sorted out as it's going to use the same equation as hurling grenades. Everything visible is placeholder artwise for the time being. Everything else in the inventory works as expected and the big missing preview will be an image of the "Class" of the team member rather than individual portraits cos that'd just be nuts considering how fast you can go through fellas when your tactics all go wrong ...

Pior to this little hiccup, I was hoping for inventory completion in just one week (lol, yeah right), it's taken about 17 days ... including a few go slow days where I went to the pub for a couple of small ales and a sit in the sun to top up my vitamin B or F levels or whatever the hell solar radiation gives out that's good for you ...

Anyhoo, back on track for July - the remaining of which will be spent sorting out the Ai ClientPlayer/commander and turning the enemy squad into some sort of team-based, tactically co-ordinated entity capable of using different strategies dependant on mission objective, battlefield conditions, weapons available, etc, etc.

As the Ai are also going to be using this custom inventory system, it was important to get it functioning.



Fuuuu - magnets! Why are they so hard to debug!?