Welcome to part 3 of the AI of Sea of Thieves here on AI and Games. In parts 1 & 2 I looked at how Rare’s online pirate game balances the AI systems at play across each server plus how skeleton and shark AI are built to keep players on their toes both on land and in the water. In this penultimate video we look at the three biggest threats players face across the Sea of Thieves: Megan, Karen and…. Skevin??
All of the AI we’ve seen to-date in this series on Sea of Thieves is built to facilitate a specific design element. The pigs, snakes and chickens bring life to the tropical islands, the skeletons present a threat that seeks to thwart your quest for hidden treasure whilst the sharks seek to keep you from sitting too long in the water. While other crews of players present a threat as you sail the Sea of Thieves, Rare sought to add great threats that could sink even the strongest of galleons.
At launch players could fall prey to the Kraken as it hunted ships on the open seas. Meanwhile the Hungering Deep expansion introduced the mighty Megaladon plus the Cursed Sails event brought haunted galleons commanded by skeletons to open waters. Each of these act as larger event battles on the sea that have varying conditions that enable their activation. The Kraken has always been haunting the open seas ready to attack ships, whilst the Megalodon originally could only be summoned having completed Merrick’s questline and travelling just south of the Devil’s Ridge. Similarly, the haunted galleons which first appeared during the Cursed Sails event were constrained to three specific sites near Smuggler’s Bay, Sharkbait Cove and Marauder’s Arch. However, since those expansions, both the Megaladon and the skeleton ships have expanded their remit; spawning the open world attacking players in a more dynamic fashion more akin to how the kraken operates.The last content drop of 2018 – the Shrouded Spoils – addressed each of these experiences by adding new features and re-balancing existing ones all in an effort to keep players on their toes. This led to the likes of varying megalodon personalities, two sizes of skeleton ships and tweaks to kraken attack patterns. But as these changes were being made, it led to new constraints to be managed within the core gameplay systems. Do you allow these systems to interact with each other? Can you be attacking a skeleton ship only for a megalodon to interrupt. Does a kraken or megalodon attack skeleton ships as well as players?
At one point there was a concern about having more than one of these systems in play at once for a given crew. However, upon experiencing themselves when testing internally, the opinion with the team shifted pretty quickly. As a result, there has been a more concerted effort in recent updates to ensure that these interactions continue to prove interesting and fun, whilst also enabling them to interact with one another all while keeping those AI overheads discussed in part 1 to a minimum.
During my visit to Rare I had the chance to sit down and chat with three developers whose work had proven critical to the release of each of these features. Andy Blastable, who discussed his work on the Shark AI in part 2, was largely responsible for the development of the Megaladon, while Chantelle Porritt and Tristan Bell who had a big hand in the ongoing development of the Kraken and Skeleton ships respectively. But during my interview on skeleton AI with Rob and Sarah from back in part 2, I quickly discovered that each of these systems go by slightly different names internally. So while the Kraken and Megalodon become Karen and Megan respectively, the skeleton ships became known as Skevin (?)
But hey, I know you’re here to listen about the AI of these enemies, so let’s do just that. Let’s take a look at each of these threats in turn, the basics of how they work, the tweaks and updates made since launch, how each of them fit within the existing AI management systems discussed in part 1, and the fun tricks required to have the skeletons run around and take command of the haunted ships.
Let’s begin with the easiest one to explain: Megan, the Megalodon, or as she was called during development: ‘Tiny Shark’. It was a codename that sought to keep the developers intentions hidden from dataminers always spying for the next update. She’s arguably the easiest AI to explain because, well… I already did much of the leg work in part 2. Given that the Megalodon is – for all intents and purposes – a larger version of the original shark AI, only she now attacks ships instead of players.
However it’s not as straightforward as just ‘big shark’, Megan’s behaviour is re-balanced to better fit the pacing of naval combat. A set of gameplay timers are used to balance the frequency of her behaviour set. This includes popping out of the water to swim alongside your ship, swim under the boat and of course attacking and taking a big chunk out of the hull. While she presents a big enough target to shoot at for the most part, there’s still a need to ensure players can take her down and not feel like the experience is unbalanced. This not only resulted in custom visual effects being employed such that the fin and top of the Megaladon are better visible when on the surface, but the existing shark navigation systems discussed back in part 2 are employed to ensure that Megan is often positioned such that she is within cannon range.
Megan can spawn in to attack a crew once her cooldown timer has ended, after which point any crew that’s out in open waters can potentially suffer her wrath. However, despite this, there’s actually a good chance Megan will only pop up just to mess with you. The updates since the Hungering Deep have added a lot of variety to the Megalodon’s look and behaviour, with different skins, as well as the chance she can spawn in a passive mode whereby she’ll only attack when provoked.
Next up, let’s deal with the boss monster released at launch, Karen the Kraken! The Kraken periodically opts to attack a particular ship somewhere in the open world. Upon triggering the attack, the seas nearby turn black and several tentacles rise from the depths. Each time the Kraken spawns in, the tentacles surround the ship – and yeah it’s just tentacles, as many players have suspected since the beginning, Karen doesn’t actually a main body. Her tentacles are a mixture of those that are actually going to attack players and the ship, as well as those that are merely set dressing and designed to add some scope to the proceedings.Karen is unique, in that she’s the only AI character in the entire game that isn’t reliant on the behaviour tree architecture in Unreal Engine 4. Each tentacle is it’s own unique AI component, which can either attack a player, attack their ship or simply sit in the water and not engage. However, the tentacles are built such that they all receive instructions from a system known as Overlord, which dictates which tentacles should be active and selects valid targets. The Overlord is built more or less as a Finite State Machine, and its job is to keep an eye on the time between attacks, whether a tentacle is attacking the ship or players and the types of attacks being employed.
Much like Megan, Karen’s tentacles are deliberately spawned in such a way to ensure you can defeat them, with them deliberately positioned around the ship such that they are within cannon and pistol firing range. Plus each player on a given crew that is going to be attacked by Kraken has their own corresponding cooldown timer. When that player is attacked by one of Karen’s tentacles, the cooldown timer is reset so that – for a period at least – you’ll get a breather and either recover or start attacking once more. Plus more critically, this distributes the damage being delivered across all the crew and the ship. Hence with a little bit of coordination and luck, you can send Karen back to the depths of the ocean.
Every time Karen attacks a ship on the server, she’ll wait a certain amount of time before doing so again. Hence there’s a chance for all crews to go about their business for a short while before they’re attacked again. While the time between attacks is still a secret, the Kraken’s attack cooldowns like the Megaladons has changed and received tweaks throughout the first year of the games development. However, one interesting thing I did learn that she doesn’t discriminate and will happily attack any crew that is out in open waters – even if it’s a crew she’s already attacked in the same play session. So while you might be safe for a time whilst attacking a Skeleton Fort on land, you better be quick about dropping all that loot off at the nearest outpost .
Last but not least, let’s look at the skeleton ships. As recently as the Shrouded Spoils, skeleton galleons can now appear on the open waters and proceed to attack players if they get a little too close. Each ship has its own crew of individual AI skeletons and there is an interesting combination of real-time AI behaviours being deployed, with some smoke and mirrors to streamline the overall process for the developers whilst attaining the desired effect. It’s actually the most complicated set of AI systems in the entire game and took months to come together from original concept all the way to finished product.
The ships themselves are reliant on their own unique sailing and steering mechanisms, given much like the issues had with the shark AI, there’s no navigation systems built in UE4 to handle ships atop water. So each skeleton ship has it’s own collection of sensors not only for detecting nearby obstacles, but calculating where both it and nearby ships – be they human or AI controlled – are going to be a couple of seconds from now. This helps anticipate collisions with nearby islands, rock outcrops and even other ships – unless of course it wants to ram you – and allows the steering AI to move the ship accordingly. This projection is also applied to the ships rising out of the ocean, so that they don’t land atop another ship like they’re Evel Knievel. The actual movement speed is calculated based on the potential it can achieve based on wind direction and adjusted accordingly.
Now if you consider the make-up of a haunted ship, it has numerous skeletons running around the deck. Each of these are reliant on the skeleton AI framework as detailed in part 2, where they interface with a virtual representation of the players input to do the same things as we can. However there are some limitations. They can man the cannons and repair damage using the planks in their inventory, but they can’t bail water – which has led to some creative solutions for defeating them by players. But it does employ some smoke and mirrors to sell the effect of a skeleton crew manning a ship. The anchor and sails aren’t controlled by the skeletons, the ship itself corrects their position. Plus having explained all of the navigation systems a minute ago, this removes the need for a skeleton to try and calculate the navigation itself. But despite that, the ship can’t steer lest this fella right here is at the helm, the Captain! So while the Captain must be at the helm in order for the boat to sail, the ship effectively controls itself.So there you go, if you’re looking to engage in a spot of piracy, distracting the captain from the wheel or outright killing it will force a skeleton ship to stop and no other skeleton can take control. Keep that in mind next time you spot one in the open seas!
However, despite how cool all this is. The real success that has been achieved in the skeleton ship AI is one that most players would never thing twice about: the skeletons on the ships are actually moving around both on the deck and in the hull. They’re capable of moving to holes in the hull to repair them as well as head for the cannons to fire them. Now this is something that for most players isn’t all that ground breaking, but from an AI perspective this is actually a really big deal and the one thing upon playing Sea of Thieves that really took me by surprise! Let me explain.As I discussed back in part 2: we typically use a system called a navigation mesh for characters to walk across 3D environments and in fact all the skeletons on the islands are using a nav mesh system to move around. However, navigation meshes are typically built or baked into the level in advance or – like in my recent case study in Horizon Zero Dawn – calculated at runtime based on changes by rocks, or other small items being moved around on the surface of the nav mesh. So yes they can adapt to changes in objects and characters being moved around on the nav mesh itself, but the navigation mesh itself isn’t moving. If the surface itself was moving, it would have recalculate not just the nav mesh but also the paths of all characters standing on it every time it moves by even the smallest amount. That’s simply far too much CPU and memory resource to consume. It’s a massive bottleneck. But here in Sea of Thieves, the surfaces of the hull and deck aren’t just moving in line with the waves of the ocean always moving, but they’re on a moving ship! At first I thought it’s faked: that the skeletons simply move from one point on the ship to another, but if you look at how they move on galleons, they’re running around as they wish, all the while adhering to the topography of standing on a moving ship with respect to the physics of the ocean.The big secret is that the navigation mesh for the ships isn’t actually moving. It’s baked deep into the ocean. The navigation mesh for the entire ship is baked onto the deep down on the ocean floor and each skeleton is plotting their movement on that nav mesh. This nav mesh doesn’t move with the ship and stays at a fixed point. Meanwhile each coordinate on the navigation mesh is transposed from the ocean floor onto the ships deck and hull respectively. This has to factor the current orientation of the ship with regards to the oceans surface. Meaning the navigation paths need to follow the actual rotation of the ship as it crashes though a wave. It’s a creative solution to an otherwise horrendously complicated problem and whilst not perfect, it achieves what the team wanted really well!
While players present a real threat to one another as you sail the seas, the AI characters are still pulling their weight. Throughout the past three videos we’ve covered all of the AI systems that are running under the hood during your Sea of Thieves of experience: crafting missions for you, spawning a variety of friendly and aggressive AI characters on both land and at sea and balancing the overall experience for players across the server. But despite all that, I’m not done yet. A game like Sea of Thieves takes a lot of dedication from the entire development team at Rare, from artists and animators to sound designers and programmers, and it can prove challenging to steer a project of this size.
In my closing entry on the AI of Sea of Thieves, we’re going to look at testing and deployment systems used throughout Sea of Thieves development and how it streamlined working practices. I’ll be chatting with Andy Bastable and Rob Masella, two of the leads on a project that were responsible for steering this new direction on the Sea of Thieves codebase; how a testing system helps prevent bugs with AI and other gameplay systems from reaching players and how automated builds enabled for continued rapid deployment of the game long before it ever appeared on the Xbox marketplace.