Perhaps the most underrated tool in game design is happy accident. Stolen Steel VR, the medieval arena swordfighting game with more than a whiff of Thief about it, has happy accident to thank for its very existence. Its roots are in an as-yet-unreleased stealth game from Melbourne developer Joe Wintergreen - aka Impromptu Games - which happens to include an elaborate swordfighting system for its AI guards: a back and forth of swishes, lunges and blocks.
Related: the best FPS games on PC.
“I randomly realised when somebody said something on Twitter that it could be dropped pretty easily into a VR template,” Wintergreen remembers. “If I put a sword in the player’s hand, everything would fall into place. There was a lot of rough stuff in there, but even from the first it was pretty fun.”
On that day, Stolen Steel VR was born. The short but enjoyable journey to Steam release since has taken in experiments with stealth AI, broken bottle physics and eggplant technology.
Training robots to fight
The AI that powers the assailants in Stolen Steel VR was built for a stealth game, so it’s more ambitious than it strictly needs to be. It knows how to lose a player in the dark, and it knows how to find them again.
“I’d say that 90% of the AI doesn’t happen in Stolen Steel,” Wintergreen admits, “except by accident. Sometimes a guy will lose sight of you and then he starts looking around your last known location. Hopefully then, people are like, ‘Oh, this AI has unexpected depth.’”
These mustachioed guards in wide-brimmed helmets represent Wintergreen’s first attempt at AI - though it’s quickly become his favourite part of the job. The guards were put together with Unreal Engine 4’s visual scripting system, Blueprint, which “kind of lets you be an awesome programmer without knowing how to code”.
“AI is an interesting thing to make,” says the developer. “It feels like you’re teaching your little guy things, and then he goes and acts on them in the wild and surprises you.”
get you a man with as much faith in you as this man has in his eggplant pic.twitter.com/jZGoyTTZNN— Joe Wintergreen (@joewintergreen) March 3, 2017
In Blueprint, Wintergreen’s AI looks like a big, branching flowchart. It tells the guards what path to take in a given situation. When they see somebody, for example, they know to ask themselves a series of questions: Am I already in combat? If so, do nothing. Is that person in the dark? If so, pretend not to see them. Do I like them? If so, say hello.
“Unless I already said hello to him, ‘cos I don’t want to look like an idiot,” Wintergreen adds. “It can get out of hand pretty quickly, so there’s a few different ways to do it.”
Unreal Engine 4 now supports Behavior Trees, a relatively new feature that splits AI into two parts: a Blackboard, where the engine stores a character’s memory, and the Tree itself, a processor which makes decisions and acts on them. It’s a system that sounds similar to, but simpler than, Wintergreen’s makeshift Blueprint chart.
“If I was starting again I’d probably use Behavior Trees, which is easier to look at,” he says. “In the meantime I like my massive, sprawling Blueprint graph. But the more complicated your AI gets, the less practical that is - it’s just this massive machine that gets really difficult to maintain.”
Teaching bottles to break
One of the earliest VR prototypes Wintergreen worked on with a friend was about a witness escaping hospital assassination by mobsters - the player using their hands to push and turn a wheelchair to freedom.
“The way we were going to teach basic interaction was, there would be a bottle of whisky, and you would pour the whisky out into a glass,” he recalls. “Then you could use the bottle, break it on stuff or throw it at a guy if he came in.”
Wintergreen couldn’t resist introducing the bottle to Stolen Steel as a weapon - and the task turned out to be technically straightforward. When a bottle in Stolen Steel hits an object with enough force, it’s deleted and replaced with the broken neck of a bottle. Simultaneously, gibs - or fragments - of the bottle spawn in, showering everywhere and giving the appearance of smashed glass.
“It’s my favourite thing,” says Wintergreen. “You can see in the trailer, I break about five bottles.”
Trickier to nail was the threshold of ‘force’ that determines whether the bottle smashes or not.
“It breaks after being hit by 300 or more newtons of force, or something, I’m not sure exactly because physics is tough,” the developer expands. “You just find a number that seems to work, and then you go with it.”
There are peculiar exceptions at work, too: a bottle will always break when hit by a sword, for instance, no matter the speed. And if a bottle is hit by a force below the break threshold four times, it will smash anyway - so that players struggling to break the bottle will eventually succeed, regardless of the strength of their swing.
“Some people aren’t confident enough that they’re not going to hit something with the controller to really whack it,” explains Wintergreen. “They’re probably rightly worried - I have whacked a few walls.”
Plant your feet and fight
More recently, Wintergreen has added eggplants. They were inspired by an Unreal Engine 4 feature that allows you to slice a mesh in half procedurally - effectively playing Fruit Ninja in full, physics-enabled 3D. As with the bottles, eggplants in Stolen Steel VR function as weapons - and sure enough, that reliably complex guard AI rushes in to pick them up when disarmed.
“It’s a beautiful eggplant,” says Wintergreen, fondly. “Maybe we should just do a chef simulator next.”
In this sponsored series, we’re looking at how game developers are taking advantage of Unreal Engine 4 to create a new generation of PC games. With thanks to Epic Games and Impromptu Games.