You are here

Bounty Hunters in Persistent Worlds - A Study on NPCs in Neverwinter Nights (Part One)

Brian P. Gefrich

Bounty Hunters In Persistent Worlds: A Study on NPCs in Neverwinter Nights

by Brian P. Gefrich

July 10th, 2001



I would like to preface this article by stating that this will not cover actual scripting and the language, as this is knowledge not made public in any completeness whatsoever. Instead, I will be rambling on about the theory and technique to be applied through these scripts to achieve the sorts of dynamic effects and interesting NPC interactions that will separate your world from the rest.

The problem with creating a working script, and what stymies most potential “script wizards” (a term I hope catches on) is not the idea, which is the easy part, or knowing the syntax and definitions of the code. Instead, it is designing the process that the script will move through in it’s execution. In other words, how do you get from Point A to Point B. These articles will tell you how to do this in the best way I know of…an example. The first chapter, which you are reading now, will be about the theories involved.

The next installment will get a little more technical, talking about the variables affected in this situation. Lesson 3 will present a C script showing you the whole thing in a simulated (meaning corny, text-based, nothing like what it will be like) Neverwinter Nights world. Then, after the release of the game, I will make the final installment, which will be using NWScript.h and will actually work in a persistent world.

The Premise

A little background on the development of the topic: Last night, on an IRC chat about NWN, we were discussing the possibilities of a bounty hunter element on the persistent world to be, Neverwinter Nights Online (see the IGN NWN Worlds Boards for more info). The situation we developed was this:

  • Your party kills a bad guy in a mini-quest.
  • This bad guy is the brother of some more powerful and influential baddie
  • The surviving (and probably relatively P.O.’ed brother) hires a bounty hunter to extract revenge.
  • The bounty searches for you, looking for clues and tracking you across the land.
  • Bounty hunter finds you and attempts to carry out his contract.

Now the question is… how do you implement that into a persistent world?

One obvious solution, have PC bounty hunters. And while that certainly is a possibility, and fun for the characters who undertake it, it relies on the human factor that is both inconstant and unreliable. You won’t always have PC bounty hunters, and they won’t always do what you want to do. So, what’s the other option?

NPCs, of course. You have an unlimited resource of any kind of player you want.

What we wanted to figure out would be how to 1. Get this to work. 2. Humanize the process as much as possible. Make it almost impossible to tell that you aren’t being hunted by another human player, and 3. To allow the PC’s to know, or at least develop an irking suspicion that they are being hunted with less than friendly intentions.

The Meat and Potatoes of NPCs

Now, the first step exists mainly in the code (see first paragraph) so we move along to how it works. Well, to effectively plan for this action to make it’s way into script form, we must be look at it how the program will: as a series of events. In this case, the progression would be something like this:

  • The Trigger: The death of the bad guy
  • The brother finds out
  • He contacts and hires a bounty hunter
  • The bounty hunter (BH) goes to the last known place that you were at
  • He attempts to pick up a trail, or else just makes a decision on which way the PC’s are traveling.
  • When coming upon other people, he “questions” them about the PC’s whereabouts.
  • If he’s good, or the PC’s aren’t careful, the BH finds them and attempts to capture or maim or kill them, depending on the contract.

Sounds like a pretty logical progression of events. One could even write it out as a short story. You could also write it as a series of scripts to be played out over a period of time. This is what we plan to do.

On a side note, this isn’t hard on a server with set games and modules run by a DM whenever the group comes together, just like a normal tabletop game. In this instance, the DM creates a bounty hunter with a scripted conversation, and spawns him where he wants him to come into the PC’s storyline. The BH describes why he’s there, and furious combat ensues. So we instead look at the ambitious project of a persistent world. First off, there is a DM monitoring every player at all times, and there is a larger level of free will in the game. But the game world still has to be compelling, dynamic and engaging to hold the attention of the players and provide them with a highly enjoyable experience. So we allow for things like this that may or may not happen, and don’t always turn out the same way or how you expect it.

For the purposes of our example, you are playing a fighter who has made a bit of a name for himself in the local area by killing scoundrels and acting heroic. So the mayor comes to you with a quest to rid the countryside of a tyrant who lives in the ominous castle on the mountain above the city (ok, so it’s cliché. It works). Now comes the fun, and proof that on this server, your actions have consequences. You take the quest, go and battle through the castle, killing the meddlesome tyrant. You continue with life, improving your character and being an all around good guy. This was the trigger. The completion of the quest begins a new script for the possibility of a bounty hunter coming after you. We have already set this as a side effect on the event of the death of the tyrant.

A few weeks later (in game time), the recently deceased tyrant’s older brother, a powerful Warlord, learns of his sibling’s demise at your hands. The script determines how mad he is, and if it comes up with the right level of hostility, he hires a bounty hunter. (Of course, we could always just skip this point and assume that he would contract the BH as standard procedure) This bounty hunter will be created from a template, with influences taken from your current stats. We would do this for easy character creation, and to make sure that we don’t overwhelm your character. This doesn’t mean we make it easy, but it ensures that we don’t end up in a situation where we are sending a 15th level monk after some poor schmuck’s 3rd level cleric.

All of this is run from the script on the server at the moment of the trigger. And it’s all figured out right then. And then “bearer of bad news” (a simple messenger) is spawned outside the castle at the base of the mountain and starts heading towards the location of the Warlord. Why do we include this? Well, right away, it gives our little behind the scenes adventure a life and a tangible form. Not only that, it easily allows for time passage, as the messenger has to get to Ole’ Big Brother to inform him.

The other purpose of this exists in our second goal, to humanize the script. If we simply have it happen, then we are playing God over our world and controlling the story. While this is fine in a lot of situations, our purpose here is to give the server world a life of it’s own, and little bit of chaos and randomness. Just think of all that could happen to this young human, barely armed, racing across the land! A band of not-so-nice PC’s could kill him and loot his body, taking the message they found, or any other loot. Maybe this group of PC’s finds the warlord and delivers the message, continuing the script. Or maybe they are loyal to the warlord and decided to hunt down our hero themselves? Who knows? It’s dynamic and exciting content that opens us up to a myriad of possibilities. It is possible that a band of Orc raiders will spawn randomly on the road that our messenger is on and steal him away to be a slave. He never delivers the message and our player is spared his fate.

But let’s assume he does deliver his unfortunate news, which will remove our messenger, and launch the script, which creates the BH. As stated above, he (let’s call him DarkSun, because I just pulled that out of thin air) heads out for the last know location. He is now a physical aspect of the world, with all of those random variables able to happen to him, just like the messenger (although he is better equipped to handle it). All the time that he is wandering around, the script is making calculations for the knowledge about you that he is aware of. As he’s able to question people who have seen you, his modifier in this roll gets higher. If he continues to go unheeded, eventually he will pick up your trail, by means of determining your PC’s location and sending DarkSun towards it. Assuming you stop to interact, engage monsters, etc., the BH is catching up with you. And scripted NPCs are popping up, possibly dropping hints about someone asking about you. At this point you should be getting worried. And maybe you are able to find out who is chasing you. Then, the moment of truth. You stop to complete a step of a quest. In the middle of it, DarkSun bursts from the woods. He informs you of your transgression for killing Lil’ Bro Tyrant, and that he is here to kill you.

And the fight begins…


But also consider an alternate ending. You happen to ask the right question of a hermit you find. You learn that DarkSun is heading for your location. Well, you’ve been heading along the same road for a while, so you go down the road and hide. Then you call up a few friends who are playing high level sorcerers and paladins, and they rush to your aide, setting up an ambush. DarkSun arrives, but finds only painful death at the hands of the combined force and your hero is saved.

Of course, something of this nature would be very difficult to script on it’s own. Hopefully integrated into the toolkit and game engine will be aids for this sort of thing, and shortcuts will, of course, be developed. But I think this serves as a fine example of how persistent world NWN projects, like Neverwinter Nights Online, can be self managing, dynamic, and still maintain the human aspect of PnP games on a Sunday afternoon.

Lesson 2 coming soon, diving into the technical mumbo-jumbo.

Migrate Wizard: 
First Release: 
  • up
  • down