Dev Blog Quest Friends Forever

We're aware of a crash bug effecting OS X users since v1.0.3 and we're working on a fix - we'll let you know more as soon as we can! In general, at the moment we are working on another patch containing some fixes and small adjustments, and we've started working on our first post-1.0 content update.

It's been a while since we had a real technical dev blog, though, so for tonight @tccoxon's written up a post about how he built Starbound's procedural quest system!

~Mollygos

Since Starbound hit 1.0, I’ve found myself looking back over my contributions over the last couple of years. I feel incredibly lucky to have had the chance to work on Starbound, and be a part of the community. I know the rest of the team here in the office does too.

One of my favorite features in Starbound is procedural generation - the way it produces endless distinct planets to explore, the way every weapon you find is different, and every NPC has a unique appearance. I know that from a design perspective, procedural generation is often inferior to hand-designed content... but designing a procedural system that produces pleasing results is still an interesting puzzle that fascinates me. (And has been central to the concept of one of my other projects, Lenna’s Inception.)

So I jumped at the chance to build a procedural quest system for Starbound!

We had three main goals for a procedural quest generation system. The first goal was encouraging the player to explore more, playing to Starbound’s strengths. Exploring in Starbound is fun. Walking across the surface of a new planet, you’ll encounter monster fights, treasure, new building and crafting materials, dungeons to clear out, friendly NPCs with something to say, and occasionally hostile NPCs to engage in combat with. So to make the best use of Starbound’s other features, the quest system should encourage you to explore the planet you’re on.

Second to that, distant parts of a planet in Starbound often don’t have anything to connect them. For example, a planet can have a floran village and an avian temple on it. You might wonder about how these two groups interact and relate, but the chances are they’re distant enough that the NPCs that live in them never see each other. A good procedural quest system that involves both of these places can provide more context and story. If you rescue a floran that has been kidnapped by avian fanatics from the temple, you can read into that and determine that there is some tension between these two groups.

Many games have repeatable quests that quickly become dull. One of the reasons for this (in my opinion) is that the quests often have no meaningful cause or effect. If an NPC has asked me to kill the rats in her basement ten times in a row, I begin to wonder why the rats are entering her basement, why the NPC is not doing anything to keep them out, and what effect my actions are having on the local rat population. I feel dissatisfied knowing that there is no cause or effect for this quest. IMO, good quest generation systems should at least try to give their quests some semblance of meaning, so I made that the final, aspirational goal.

Starbound isn’t the first game with a procedural quest system. Skyrim has probably the best known quest generator, Radiant. Most quests produced by Radiant consist of a randomly chosen location, enemy type and reward. The locations can be things like homes, businesses and dungeons. The type of quest you get, whether an assassination or theft, depends on who gives you the quest.

The stated goal of Radiant was to get the player to explore locations they haven’t been to before. It achieves this, I believe, and it also happens to do reasonably well at producing meaning. I think it’s because of that that I didn’t realise I was playing procedural quests until I was half a dozen quests in.

Radiant quests generally have some sort of cause -- you receive theft quests from the thieves’ guild because you’re a thief -- and sometimes an effect -- someone you’ve stolen from can seek revenge. What I think reduces the meaningfulness of Radiant quests is that the same causes and effects are used repeatedly. There just isn’t much variety. With Starbound, we experimented with an idea to produce a wider variety of causes and effects.

Earlier in development, Starbound had a series of placeholder quests to make a cup of coffee for an NPC. The sequence was something like:

Find coffee beans and use a machine them into coffee liquid

Find sand and craft it into glass to make mug

Find silver, craft it into a spoon and use it to stir the coffee in the glass

It’s not a great story line, but each quest in the sequence does exhibit purpose, cause and effect. That’s partly because the result of each quest is used in the next. That’s a pattern that’s easy to formalise and use in a generator:

Get A.

Use A to get B.

Use B to get C.

The quest generator in Starbound doesn’t generate just individual quests, it plans entire sequences of quests (like the above) that achieve an NPC’s goal. Surprisingly, this isn’t really anything new. At its core, the quest generator is something known as a regression planner -- an algorithm that has been known about for at least 40 years. This may simply be its first use for generating quests in a commercial video game.

What a regression planner does is find a sequence of actions that will take it from the way things currently are, to a world where its goal has been achieved. A futuristic household robot might use a regression planner when you ask it for a cup of coffee. It would work backwards from its goal (a cup of coffee in your hand) to determine that it needs a cup of coffee in its own appendage, and in order to get there it needs a clean cup, some fresh coffee and a spoon to stir it with. The fresh coffee would need brewing. And in order to brew the coffee it needs some beans...

In the case of the quest generator, the goal is randomly chosen from a pool. It can be anything from finding the NPC a new friend, improving the state of the village, broadening a merchant’s stock, gaining influence over another NPC, or finding a stylish new hat.

I didn’t have the heart to tell him!

These goals are especially designed to produce permanent effects on the world, and many of them can affect the generation of later quest sequences. For example, when you’ve completed a quest to help an NPC assert dominance over another NPC, he/she can later use that influence in another quest to extort the victim for a needed item.

By giving each goal a permanent effect, and having each quest serving the next quest, I think we’ve done a decent job of making sure Starbound’s procedural quests are meaningful. Some quests and goals work better than others, but overall I’m pleased with how it works, and I hope our players enjoy them.

One of the things I learned while building this system is that, depending on the context, even bad or stupid procedural generation can be positive. The first sequence I remember Starbound generating was one where an NPC wanted to make friends with his neighbour… so he asked me to steal his neighbour’s torch off the wall, and then give back to the neighbour as a gift from him. The neighbour was so delighted to have a torch again, they became instant friends!

The reason this is funny instead of jarring is that the NPCs in Starbound always look dumb, thanks to their cartoony emotes and exaggerated behaviours. So if you know you’re going to be using procedural generation in a project, you can design the context around it to turn its mistakes into (in the legendary words of Bob Ross) happy accidents.

Starbound was pretty much the perfect environment in which to experiment with procedural quest generation, thanks to its cartoony NPCs and wide variety of mechanics and activities.

I’ve also learned how to make a better quest generation system.

Starbound generates multiplayer quests. Multiple players can accept a quest, and what happens -- whether they can all complete it together or whether they must compete for the reward -- depends on which quest it is. I think this was a mistake because it complicates the system and prevents the generator from reasoning about the player’s progress. Quests individually tailored to each player would be much better. The generator would know what the player’s been doing on other planets, it could involve their other colonies, and tailor the difficulty of enemies more precisely. Right now, it can’t make any such assumptions about the player.

Quests with branching paths and multiple actors would allow the player more freedom to complete quests the way they want. Right now, quest sequences have only one ending, but theoretically multiple endings could be generated with a more advanced iterative planning algorithm. If you receive a quest to steal an NPC’s item, an alternative quest could be provided that allows you to report that NPC to a guard instead. Branching quests probably wouldn’t fit Starbound very well, but would be interesting to see in other games!

We're aware of a crash bug effecting OS X users since v1.0.3 and we're working on a fix - we'll let you know more as soon as we can! In general, at the moment we are working on another patch containing some fixes and small adjustments, and we've started working on our first post-1.0 content update.

It's been a while since we had a real technical dev blog, though, so for tonight @tccoxon's written up a post about how he built Starbound's procedural quest system!

~Mollygos

Since Starbound hit 1.0, I’ve found myself looking back over my contributions over the last couple of years. I feel incredibly lucky to have had the chance to work on Starbound, and be a part of the community. I know the rest of the team here in the office does too.

One of my favorite features in Starbound is procedural generation - the way it produces endless distinct planets to explore, the way every weapon you find is different, and every NPC has a unique appearance. I know that from a design perspective, procedural generation is often inferior to hand-designed content... but designing a procedural system that produces pleasing results is still an interesting puzzle that fascinates me. (And has been central to the concept of one of my other projects, Lenna’s Inception.)

So I jumped at the chance to build a procedural quest system for Starbound!

We had three main goals for a procedural quest generation system. The first goal was encouraging the player to explore more, playing to Starbound’s strengths. Exploring in Starbound is fun. Walking across the surface of a new planet, you’ll encounter monster fights, treasure, new building and crafting materials, dungeons to clear out, friendly NPCs with something to say, and occasionally hostile NPCs to engage in combat with. So to make the best use of Starbound’s other features, the quest system should encourage you to explore the planet you’re on.

Second to that, distant parts of a planet in Starbound often don’t have anything to connect them. For example, a planet can have a floran village and an avian temple on it. You might wonder about how these two groups interact and relate, but the chances are they’re distant enough that the NPCs that live in them never see each other. A good procedural quest system that involves both of these places can provide more context and story. If you rescue a floran that has been kidnapped by avian fanatics from the temple, you can read into that and determine that there is some tension between these two groups.

Many games have repeatable quests that quickly become dull. One of the reasons for this (in my opinion) is that the quests often have no meaningful cause or effect. If an NPC has asked me to kill the rats in her basement ten times in a row, I begin to wonder why the rats are entering her basement, why the NPC is not doing anything to keep them out, and what effect my actions are having on the local rat population. I feel dissatisfied knowing that there is no cause or effect for this quest. IMO, good quest generation systems should at least try to give their quests some semblance of meaning, so I made that the final, aspirational goal.

Starbound isn’t the first game with a procedural quest system. Skyrim has probably the best known quest generator, Radiant. Most quests produced by Radiant consist of a randomly chosen location, enemy type and reward. The locations can be things like homes, businesses and dungeons. The type of quest you get, whether an assassination or theft, depends on who gives you the quest.

The stated goal of Radiant was to get the player to explore locations they haven’t been to before. It achieves this, I believe, and it also happens to do reasonably well at producing meaning. I think it’s because of that that I didn’t realise I was playing procedural quests until I was half a dozen quests in.

Radiant quests generally have some sort of cause -- you receive theft quests from the thieves’ guild because you’re a thief -- and sometimes an effect -- someone you’ve stolen from can seek revenge. What I think reduces the meaningfulness of Radiant quests is that the same causes and effects are used repeatedly. There just isn’t much variety. With Starbound, we experimented with an idea to produce a wider variety of causes and effects.

Earlier in development, Starbound had a series of placeholder quests to make a cup of coffee for an NPC. The sequence was something like:

Find coffee beans and use a machine them into coffee liquid

Find sand and craft it into glass to make mug

Find silver, craft it into a spoon and use it to stir the coffee in the glass

It’s not a great story line, but each quest in the sequence does exhibit purpose, cause and effect. That’s partly because the result of each quest is used in the next. That’s a pattern that’s easy to formalise and use in a generator:

Get A.

Use A to get B.

Use B to get C.

The quest generator in Starbound doesn’t generate just individual quests, it plans entire sequences of quests (like the above) that achieve an NPC’s goal. Surprisingly, this isn’t really anything new. At its core, the quest generator is something known as a regression planner -- an algorithm that has been known about for at least 40 years. This may simply be its first use for generating quests in a commercial video game.

What a regression planner does is find a sequence of actions that will take it from the way things currently are, to a world where its goal has been achieved. A futuristic household robot might use a regression planner when you ask it for a cup of coffee. It would work backwards from its goal (a cup of coffee in your hand) to determine that it needs a cup of coffee in its own appendage, and in order to get there it needs a clean cup, some fresh coffee and a spoon to stir it with. The fresh coffee would need brewing. And in order to brew the coffee it needs some beans...

In the case of the quest generator, the goal is randomly chosen from a pool. It can be anything from finding the NPC a new friend, improving the state of the village, broadening a merchant’s stock, gaining influence over another NPC, or finding a stylish new hat.

I didn’t have the heart to tell him!

These goals are especially designed to produce permanent effects on the world, and many of them can affect the generation of later quest sequences. For example, when you’ve completed a quest to help an NPC assert dominance over another NPC, he/she can later use that influence in another quest to extort the victim for a needed item.

By giving each goal a permanent effect, and having each quest serving the next quest, I think we’ve done a decent job of making sure Starbound’s procedural quests are meaningful. Some quests and goals work better than others, but overall I’m pleased with how it works, and I hope our players enjoy them.

One of the things I learned while building this system is that, depending on the context, even bad or stupid procedural generation can be positive. The first sequence I remember Starbound generating was one where an NPC wanted to make friends with his neighbour… so he asked me to steal his neighbour’s torch off the wall, and then give back to the neighbour as a gift from him. The neighbour was so delighted to have a torch again, they became instant friends!

The reason this is funny instead of jarring is that the NPCs in Starbound always look dumb, thanks to their cartoony emotes and exaggerated behaviours. So if you know you’re going to be using procedural generation in a project, you can design the context around it to turn its mistakes into (in the legendary words of Bob Ross) happy accidents.

Starbound was pretty much the perfect environment in which to experiment with procedural quest generation, thanks to its cartoony NPCs and wide variety of mechanics and activities.

I’ve also learned how to make a better quest generation system.

Starbound generates multiplayer quests. Multiple players can accept a quest, and what happens -- whether they can all complete it together or whether they must compete for the reward -- depends on which quest it is. I think this was a mistake because it complicates the system and prevents the generator from reasoning about the player’s progress. Quests individually tailored to each player would be much better. The generator would know what the player’s been doing on other planets, it could involve their other colonies, and tailor the difficulty of enemies more precisely. Right now, it can’t make any such assumptions about the player.

Quests with branching paths and multiple actors would allow the player more freedom to complete quests the way they want. Right now, quest sequences have only one ending, but theoretically multiple endings could be generated with a more advanced iterative planning algorithm. If you receive a quest to steal an NPC’s item, an alternative quest could be provided that allows you to report that NPC to a guard instead. Branching quests probably wouldn’t fit Starbound very well, but would be interesting to see in other games!

Click to expand...

Hmm... It'd be very interesting if you were to make such tailored quests at some later point in development. Perhaps implementing them with some sort of bounty system. The more you harass Apex Miniknog, the more likely Apex Rebels would trust you to do more difficult tasks, while Miniknog bases would become much more hostile towards you... The more you help Stargazers, the more Grounded avians will attack you and will not trust you in their cities... I think if this were something to be implemented, branching quest paths would fit VERY well in this sort of system...

I love these types of posts, that talk about the type of decisions that go into creating a game that flows well and is fun to play. It's been a lot of fun watching the development choices that brought Starbound to fruition and gave me a better sense of what makes games interesting or engaging.

I like that quests don't take place in a vacuum, but can lead to other quests and have some impact on the world besides giving loot and pixels to the player.

These blog posts have been getting me really excited to play 1.0! I have to wait though; I promised my brother we'd explore the official launch together

"we'll let you know more as soon as we can! In general, at the moment we are working on another patch containing some fixes and small adjustments"
So…are we (mac users) getting the fix we need in THAT patch or you're leaving us for later? .___. …

The reason this is funny instead of jarring is that the NPCs in Starbound always look dumb, thanks to their cartoony emotes and exaggerated behaviours. So if you know you’re going to be using procedural generation in a project, you can design the context around it to turn its mistakes into (in the legendary words of Bob Ross) happy accidents.

Click to expand...

This is the experience I have had so far. I agree that the whimsical aesthetic of many NPCs allows the more eccentric quest lines be read as world-building rather than unconvincing. I remember there was some Floran leader that wanted to be more approachable, so he decided that he needed my help to make clothes made out of bones, to this end. I read it as leader that was so into war and combat that he had a hilariously distorted view of what people consider approachable. I guess this sort thing may be intentional for a Floran quest considering their nature, but either as dumb roll of the procedural dice or no, it played off well.

Personally I haven't had a very positive experience with the procedural quests so far and think they need a serious overhaul. They are either laughably trivial (bring me 2 gold ore, craft a bar, then take it to this guy standing 5 feet away,) near impossible (travel to the opposite side of the planet to rescue this guy who's made of paper, enjoys swimming in damaging liquids and jumping in traps, and is pretty much guaranteed to die on the way back) or just a royal pain (go kill this evil guy who can one-shot you and has tons of hp.) I stopped bothering with anything but the trivial quests pretty quickly and even those I only do for the reward bags.

You're aware of the OS crash, but what about the OpenGL 2.0 that many many people are dealing with? Is this going to be addressed at all? All we keep getting told is "update your driver". Which isn't working.

This is brilliant!The future of Starbound, an AI more intelligent than Skynet!

I'm very excited about this procedural generation. I'm playing right now as a Landlord and I've been curious about on how the game register the Mission zones. For example, everytime I build houses in the starting world, I get quests directed to the Old Mineshaft's Depths, or the Old Mineshaft Entrance, and I've noticed the game also register generated places like those eastern-like Bridges, or the Old Water Well. Some Missions get a funny plot around it, like this one, for example:

I received a Pokémon pet as a Mission reward from a
Merchant NPC called Misty living in one of my houses.​

I have two questions regarding of this matter:

• Is there or will there be any way to manually register new Quest places?​

E. g.: I just built a Space Ship above a village and want that NPCs recognize that place as a hiding place for bandits and other Missions in general.

• Is it possible to set an NPC as a villager forever?​

The sad part I'd like to block or nullfy is when more crew members appear, I want some NPCs to stay forever there, but once they put the Protectorae uniform, their AI changes and they move randomly until they die or I recuit them.

Enjoyed the read. I've loved the addition of the quest system. It's made me feel more involved in the overall Starbound Universe and I'm excited to see what may develop in the future on the quest end. Thanks for all the hardwork and effort thus far

I definitely had a positive experience with this quest system. Although one of them cost a candidate for crew, due to a fluke accident on my part. One thing I keep talking about here and there to others.

A guard giving me a quest to off some scientists, that were in a house like a few paces away. ><
So I got pushed back into the guard, and I guess accidentally damaged him with my secondary. Well suffice to say both the quest giving guard and a poor merchant floran died before I was able to rid that army of apex scientists. Not only that, since another guard was near, had agro so when I neared one the florans I was working on for crew... A few lives were lost, including the one I wanted for crew. ><

That of course was in unstable beta before release in the 0.9 update.

I didn't mind at all that that happened, even though I will miss the ones caught in the frey. At least the other guards in the village didn't turn agro. And decided to start... integrated my own colony using the 2 empty buildings as a start. Like a borg assimilating, but with less aggression. Figured why not.

I have met with a lot within the quest systems, but the one above was the most dirty of them. At least my Hylotl Mansion I am remodeling is coming along fine with colony development. Although I am getting the sense of popularity. When one wants to make a hat that is exactly like another in the population. Oh well what can you do, but let them be themselves. Wouldn't be a diverse colony otherwise. So I have been having loads of fun with the colony system and the quests they give me. Even hired a couple, although figuring out what type of crew members I am going to get is tricky. Especially when I want to explore the furniture options myself instead of looking anything up. Just like seeing who pops up.

Regardless I think it was a nice choice, and for me makes my colony feel more lively.

Anything could always use improvements and expansions... I just not so well on that front as I get distracted by my colony enough at the moment. But always welcome...

Starbound generates multiplayer quests. Multiple players can accept a quest, and what happens -- whether they can all complete it together or whether they must compete for the reward -- depends on which quest it is. I think this was a mistake because it complicates the system and prevents the generator from reasoning about the player’s progress. Quests individually tailored to each player would be much better. The generator would know what the player’s been doing on other planets, it could involve their other colonies, and tailor the difficulty of enemies more precisely. Right now, it can’t make any such assumptions about the player.

Click to expand...

If it is a mistake, why ship the quest system as is?

My personal solo experience with the quest system has been fair to wonky so far. Encountered a glitch colony on my second planet. They gave me a couple fetch quests- ok did those, no problem. It was neat to see it the mini quest chain work out--the first time. Then I get subsequent escort from different npcs sending me to the exact same spot. Shouldn't there be some sort of flag that if X type objective (escort, kill etc) gets done at Y (location), don't send the player back there again or just generate something else? Never mind the tuning on some of them. I had a kill quest that spawned a whole mess of npcs that obliterated me on sight on the same lowbie planet. That made for getting caught in a frustrating death loop as a new player playing on survival.

That's not my post, but I find it really troubling for the state of multiplayer. I got this game to play with the intention of playing with friends. If what this guy describes here is the working as intended for randomly generated quests in the current game, I won't be getting this for friends. I don't want to have to tell them to ignore content because it is not at all optimized for co-op. I hope you guys will be able to fix the teething problems with this random gen quests with multiplayer soon.

Although I may gripe that there still doesn't seem to be enough variety in the procedural quests (I may just be unlucky) it is a great system, especially as far procedural quests go.

Not only that, but it can provide interesting context for NPC personalities, should you like to imagine stuff like that.
For example, one of my first NPC quests was given to me by a lone Floran who lived just above a big hostile Floran dungeon. Seemed like an outcast or something. He felt unsafe because the legendary bandit VILE REI was in the area, and from the looks of it, he had nobody to protect him. Against my better judgement, I went to face Rei alone, and... well the result wasn't pretty. I gave my ship's medical systems a workout. I kept returning once recovered, and beat Rei, who admired my determination and decided to come with me after hearing of my quest.

Armed with my new companion, Rei the Former Outlaw, I returned to the Floran, who was absolutely amazed I'd managed to not only beat Rei, but get her to join me. Knowing that I could help now, he asked that I go to a nearby ruin and get his lost friend back. I was moved - this Floran's only companion was lost, and with bandits like Rei on the loose, too! Rei was less moved, but agreed to come along anyway because I'd get myself killed otherwise. Anyhow, much slashing ensued, and we retrieved the Floran's friend, who was overjoyed to be reunited. The Floran, Non, seemed to become attached to me as a form of support, and perhaps saw me as some sort of mythical figure, singlehandedly taking down and pacifying the legendary Vile Rei, and even saving his only friend from certain doom, because he decided to join me out of the blue.

Non was an engineer. Likely a Greenfinger, I assumed, perhaps thrown out for trying to stop the Florans in the pit below his home from attacking people. He became sort of obsessed with pleasing me, and worked tirelessly on my fuel system, eventually making a long trip cost almost no fuel, through sheer force of will and mechanical knowledge. However, whenever I was on the ship, he would follow me around EVERYWHERE. Just standing there, uncomfortably close. I run to the opposite end of the ship, and he would follow. And stand there. Even when making sure I'd told him to keep his distance, he'd start following me again of his own volition. Apparently, this wasn't an isolated incident, because SAIL frequently mentioned that he was making enemies more often than not, or doing various awkward or annoying things. But I kept this Floran who was clearly mentally unwell, because he had nowhere else to go. Although I do now understand why his friend decided to stay behind when he joined my crew...

See? I made this all up from what I gathered from the types of quests he gave, his location, job, his crew statuses, and strange obsession with following me around the ship even when he has nothing to report.
It's really great for roleplaying especially, when everything just clicks together and gives you a good idea of what makes this NPC tick.

That said, I do have a few gripes about the system. Sometimes quests send you constantly to the opposite side of a huge planet, and that can be incredibly annoying. Sometimes you'll complete a quest and have to go to the exact same spot again for the next quest. And it seems most quests only focus on 2 locations, one east and one west of the source, despite there being many things in both directions.

You know, when a character asks to pass a note to the person who is next to him, this is not right.

Click to expand...

Well wouldn't that be the same premises like someone texting on their phone when they are sitting next to the person they are texting, or across the table. Granted it is about as discreet as siblings that were just in a fight having someone relay a message to the other person through a third party... ><