Game Development Community

dev|Pro Game Development Curriculum

Virtualizing The Virtual

by Steve Acaster · 06/18/2013 (4:28 pm) · 12 comments

Quote:
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:

i.imgur.com/8miyfel.jpg

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.

i.imgur.com/DE2zMOa.png

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

#1
06/18/2013 (4:56 pm)
row, row your boat,
Gently down the steam.... ;) you know what i mean
gotta love those ships
#2
06/18/2013 (8:06 pm)
Great blog as always I enjoy to see your game coming along.

Did you investigate speeding up the game during AI turns?
#3
06/19/2013 (3:24 am)
Good idea to speed things up, I do not like to wait in a game and or watch long sequences where I cannot do anything. I remember I played Xcom always on the highest speed or almost the highest to keep these periods short.
#4
06/19/2013 (6:53 am)
in the passive phase the camera goes to various points to show the environment which is a lot more interesting than looking at X-Com's static screen for hidden movement - speeding up looks bad because everything moves - wind, trees, atmosphere particles. Just speeding up the Ai means that they overshoot their turns on the path and don't stop at the correct position. Much better to drop them at the end position of their turn with some failsafe checks.
#5
06/19/2013 (1:59 pm)
HOLY CRAP DO YOU ACTUALLY HAVE 10,000 LINES OF TORQUESCRIPT or were you exaggerating a bit? If it's the former, you have my condolences.

Cool blog, mate :).
#6
06/19/2013 (2:27 pm)
Worse than that - 15000 lines of TorqueScript for my Ai ... not in one function obviously :P

To be honest 5000 is player generic (armor and other class stuff), and much of the rest are small generic functions which I attach to AiPlayer or at least stick inside the cs file, and there's a fair bit commented out that I left in incase it needed rolling back later. I've got 15 Ai tactics and 10 Ai thought states.

The TorqueScript for my actual pathfinding is 66 lines ...
#7
06/19/2013 (10:03 pm)
That goofy AI tutorial I started only has about 2000 lines, and a lot of that is documentation in the scripts.

In 3 Step Studio I had about 6000 lines tied up in allowing the user to mirror sprites for tower animations in allowable combinations in the Tower Defense template.... And it almost drove me mad!
#8
06/20/2013 (11:46 am)
It's getting better and better. Great job Steve.
#9
06/20/2013 (7:11 pm)
I'm weird like that but I can't help but wonder : Any idea when you'll be adding/integrating footstep sounds?
#10
06/21/2013 (7:25 am)
I don't actually want footsteps. I want the main audio to be fittingly over-the-top pompous music, I've had my eye ... or ear ... on a few loops. I think that I'll hook up the environmental audio to a seperate channel so that wind/rain/ambient can be disabled so it won't interfere with music and without reducing general combat sounds.
#11
06/21/2013 (10:09 am)
Cool! I'm starting to see your vision coalesce into a coherent whole. Can't wait to try this!
#12
06/23/2013 (4:14 pm)
Looks awesome Steve, nice job :)

That's still a lot of TorqueScript ;)