Making it in Unreal: behind the eyes of the bots in Unfortunate Spacemen | PCGamesN

Making it in Unreal: behind the eyes of the bots in Unfortunate Spacemen

Unfortunate Spacemen Unreal Engine 4

Imagine if you were living as Matt Damon in The Martian and Kurt Russell in The Thing simultaneously. That’s the pitch of the aptly named Unfortunate Spacemen, in which a set of spacesuited players work together to prepare their failing outpost for rescue - rescue that may or may not come before a many-toothed monster picks them off one by one.

Read more: the PC's best space games.

The twist: that monster wears a suit just like everyone else. Players clear the landing pad, secure cargo and establish uplink with the rescue team, all the while acutely aware that one of their number is the enemy in disguise. It’s a game of trust - or rather, distrust.

“One time when playing this game, I killed another player using only my voice,” reads one Steam review. “And his friend’s bullets.”

Unfortunate Spacemen boasts the simplicity of a playground game but the psychological complexity of a John Carpenter film - and it’s been crucial that the tech doesn’t get in the way of that. Here’s how developers Sandswept have made sure it doesn’t.

The solo space engineer

Unfortunate Spacemen Steam

Though Sandswept Studios are supported by a team of on-off collaborators, CEO Geoff Keene is its only full-time staffer. Of the ten maps currently Unfortunate Spacemen, he designed and built nine.

“There are about five more that I’d really like to do,” he says. “I just need to get all the objectives in, make sure there are spawns, make sure there’s navmesh for the bots, and all the systems in the game work on top of that really quickly.”

Time is the main constraint on Geoff’s ability to make levels - since he makes good use on the curated asset stores available to the modern developer. Sellers on services like the Unreal Engine 4 marketplace make their money creating and providing code plugins, audio files and, of particular interest to Keene, art assets.

“I’m not too artistically talented, so I do utilise the UE4 market quite a lot for the base meshes, and then I usually go in and edit textures or recolour things the way that I think they should be for the theme,” he explains.

Unfortunate Spacemen Unreal Engine

Often Keene finds himself softening desaturated, Star Citizen-style space station walls to match the gently cartoon colours of Unfortunate Spacemen.

“People stand out more,” he says. “I want the environment to be very readable.” 

Players in Unfortunate Spacemen are identified by their designated colour, and the maps work the same way - so that players can clearly communicate they’re in ‘yellow wing’ in a hurry.

Despite Keene’s lack of art experience, his maps are getting increasingly diverse - now ranging from genre-faithful space stations to on-ship suburbia. Special mention goes to the farmhouse, replete with visiting UFO. He’s now experimenting with unique map features - namely, trap bridges the monster can drop out from under people.

Networking skills

“Networking’s easier than it’s ever been,” says Keene. “There’s so much support for it.”

Yet it has presented the biggest technical challenges during Unfortunate Spacemen’s development. Unreal 4’s networking is built around the usual server/client model, in which the server continually updates connected clients to make sure they’re seeing the most up-to-date approximation of the map possible.

But getting both parts to sync up every time has been tough. That’s especially true when the game is dealing with high ping players - i.e. those who take the longest time to receive data sent out in packets from the server.

At the beginning of every match in Unfortunate Spacemen, each player is granted a distinct colour. And for the remainder of the game, that colour is who they are. But at time of writing, a rare but persistent bug sees high ping players left blank, uncoloured, because they’ve missed an important packet.

“We don’t have a lot of control over it,” Keene expands. “It’s more like, ‘That person was laggy and it didn’t go through. They took too long to connect and load and the server tried to apply it, but they weren’t there yet’.

“You have to put in a lot of checks to say, ‘Hey, did this guy get his colour?’”

Building brains for bots

Unfortunate Spacemen Early Access

Most multiplayer games worth their salt have bots to fill in the gaps during a quiet match - and Sandswept started out with the same goal, building AI as substitutes that would mimic player behaviour. But there was a problem.

“What you find out really quickly is that player behaviour is crazy complicated,” admits Keene. “No matter what we do, you still pretty much know it’s probably a bot. We’re basically making an AI that can communicate with people, which is of course something not even some big companies are doing. That’s a huge layer of complexity.”

Not only that, but the AI was damaging the mystery of working out which player was the monster - turns out it’s tricky to spot odd behaviour amid a bunch of oddly-acting bots. So Keene scaled back his ambitions, managing expectations by reskinning the bots as security guards. They’re now the Barneys to the players’ Gordons - quietly busying themselves with the map’s objectives.

“We found that was more fun, to have these helpers running around the station alongside the players,” says Keene.

Unfortunate Spacemen interview

Nonetheless, bot AI requires a great deal of work and planning. Keene still needed to lay Unreal 4 navmeshes - enabling security guards to pathfind their way around obstacles, over ramps and through doorways. 

Beyond that, he put together decision trees which allow guards to make branching choices based on a number of variables. For instance, if a player isn’t working towards the map objectives, that’s deserving of suspicion. The bot notes that behaviour, and expresses it by filling the player with holes.

“It’s pretty funny,” Keene laughs. “The most notorious decision bots make right now is they lock doors a lot. I probably need to nerf that a little.”

Trapping players outside the airlock while they’re running out of oxygen doesn’t tend to go over very well - but actually, the binary sternness of the security bots gels quite nicely with Unfortunate Spacemen’s vibe of off-planet paranoia and madness.

“Spacemen thrives on being quirky, and I think the whole theme of the game is there’s something not quite right about this space station,” says Keene. “The security’s a little weird, everything seems slightly off.”

Unfortunate Spacemen is available in Steam Early Access. Unreal Engine 4 is now free.

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

Sign in to Commentlogin to comment