Dev Log 3 - NPC ships, ahoy!

Sea Of Rifts

In this naval roguelike RPG you assemble a motley crew of misfits and sail into a broken ocean to solve the mystery of why the world is falling apart. Engage in tense ship to ship combat and experience a new unique story every time you play. The helm is yours Captain.

Hello, landlubbers! It’s Alex back with another dev update. This time, it’s about our newest gameplay feature: NPC ships! [img]{STEAM_CLAN_IMAGE}/44778071/dc10b2c9bd3087300ff981021da26ea0895606be.gif[/img] [h1]What zombies and sea monsters have in common[/h1] Have you ever thought about why zombies are so popular in video games? I think one reason is that they are easy to code. If you see a zombie do something that puts them in danger, it doesn’t go against the way we imagine a zombie to behave, since they are primarily driven by their lust for tasty brains. For the same reason, when I was prototyping Sea Of Rifts, I also started out with making monsters chase the player instead of other ships. It was simply easier and quicker to make than ships, since we expect a vessel crewed by other humans to behave more intelligently than a monster just following instinct. This meant the combat could be prototyped quicker, but I also found out that they don’t make for interesting antagonists in the more narrative sense, since they can’t have as much character as other ships. With other ships, the player can build a relationship with the other captain and to the factions that they belong to. Since we are working towards having the game generate deeper stories, we therefore needed NPC ships. I started out with defining the requirements for the system to drive the behavior of the ships: - Use a common data structure so both the player and NPCs use the same data for their ships and weapons. - Not too complicated to write. - Something that can be extended with more behaviors as need be. - Ships from different factions can interact with each other without involvement from the player. - Didn’t need to be super performant since I don’t think we will have a lot of ships on screen at the same time Therefore I split the system up into three groups: decision making, locomotion, and combat: [img]{STEAM_CLAN_IMAGE}/44778071/9ae9ceb77643e7f0e204e93f1576f1c0d79c9b52.png[/img] For the decision making, I ended up with a mixture of boid steering used for simulating flocking behaviors and utility AI. If you are interested, AI In Games has a [url=https://www.youtube.com/watch?v=p3Jbp2cZg3Q]great video[/url] on utility AI by the way. It also took some refactoring of the existing code used to steer the player ship to make it modular and plug into the steering code. The end system consists of a ship controller component that finds the behavior that has the highest utility and then uses the movement components to apply that movement. [img]{STEAM_CLAN_IMAGE}/44778071/2a8b1e77b56d4133c7dcd14041bc7e1513e79273.png[/img] As you can see at the start of this post, it has worked out quite well! It’s going to be fun when we have more ships and factions in the game to tune the behavior so each ship gets to have more personality. That’s it for this time! Please give us a wishlist if you haven’t already :)