Wednesday, 19 June 2013

Virtualizing The Virtual

Virtualizing The Virtual!? Is that a double negative? And if it is, does that mean that the virtual is now physical? If so, I for one welcome our new Steampunk Turn Based Tactical Artificial Intelligence Overlords ...

So, there I was, playing away, testing my game. It was night, poor visibility ... also probably in real life too ...
I was defending a flag from pirate assault ... back in the game now, not in real life ... when I realized that sometimes it takes a while for the Ai to get into the attack, especially when visible distance on the battlefield is very low. I had got my troops into my chosen defensive positions early on, and now kept clicking for the Ai to take it's turn and advance against my forces. And it was taking a while ...

Which is when I hit upon the idea of virtualizing the Ai's move. First check that they can't be seen, then make simulate how far along their path their current tactic can take them distance-wise, make sure that they'er not going to be spotted by the player's forces, and dump them at the end of their phase, decreasing their Action Points as if their turn had been taken normally. For the player, no more interminable waiting whilst the Ai to complete something that they can't see. 3+ minutes for the Ai turn could become 45 seconds.

And if the Ai could be spotted during their virtual movement, then play their turn as normal, have the player's trooper spot them, and let all hell break loose as normal.

Needless to say ... it turned out to be considerably more of a pain in the backside to get it to work correctly. First up my test function - 5 whole lines - worked lovely ... then when I rolled it into the full Ai thinking process - 10000 lines - I had to invert the values.

Then they kept falling through the terrain and other objects - make a check for that - then they all try and jump on each other - check for that - then they fall off the end of their path somehow - check for that - then they have the falling through terrain issue again - recheck post virtualized move for that. But finally it all works. The key of course was to slap the camera on the Ai so I could see what was happening when it all went wrong.

And so here's a little video of something that will never be shown in general gameplay - the Ai moving in dev mode.

Also I finally finished off the last of my character art - so here's a video of all of the different factions in various conditions.

Character types:
Unarmoured - with hat
Light Armour - helmet
Stealth Armour - helmet and camouflage
Heavy Armour - tin man with Regime flag facings (not all flags finished at time of video)

In order:
Regime/Faction - Environment - Weather

British Royalists - Temperate - Clear
Austro-Hungarian Empire - Jungle - Stormy
Chinese Dynasty - Mountainous - Clear
US Republic - Arid - Cloudy
People's Collective - Urban - Clear
Zulu Nation - Mountainous - Stormy

Followed by repeats of the various regimes in various environments with various weathers.

You might want to up the quality level - no idea why it's defaulted to 360p when it's in 720HD ...

I finally also finished the flags for all of the regimes - though admittedly after that video had been taken. I didn't want the flags to be particularly historical, as that kind of takes the fun out of it being Steampunk.

This is what the Single Battle Mode options screen looks like now:

From the left:
That's a stylized Imperial Engle on the Austro-Hungarian Empire

Union jack ensign and crown for the British Royalists

Traditional Chinese (Cantonese) word for Dragon for Chinese Dynasty - I came up with this after many failed attempts to make a stylized dragon design that I liked ... then thought that using the script for the word might be nice. Colours taken from the Qing Dynasty of the Steampunk peroid. They did have a dragon picture on their flag but I didn't like it.

Soviet Constructivist Colour Scheme for the People's Collective. Always knew that degree in art history would come in useful eventually ...

Slight change on the 1877 version of the Stars and Stripes by making the twin circles of stars into solid hoops for the US Replubic faction.

And finally, because of alphebetical order the Zulu Nation.

I sorted some really annoying issue with the Ai not always updating their aim aniation - probably self inflicted due to the manner in which I've changed spawning and mounting - and also made a rather spiffing icon for my game.

This being a MUCH larger version of said icon ... obviously.

No comments: