Friday, May 30, 2008

My Interview at the Neverwinter Nights Podcast

Michele from the Neverwinter Nights Podcast interviewed me regarding a number of things, including my Battle of the Builds module and the new one that I'm currently working on, Faithless. She also gave me a chance to air my views on game design and story writing. Now everyone can hear just how bland my voice is at Episode 57 of the NWN Podcast.

Wednesday, May 21, 2008

The Game Engines of War

I was all set to create a battlefield area for "Faithless" when I realized that I had no idea how large my area was supposed to be. I need to make several battlefields for my module, but I did not know what the minimum dimensions are and how many NPC soldiers the NWN2 engine can handle without slowing down too much. To give me some inkling of these figures, I decided that making an initial set of AI scripts for relatively large scale battles was in order.

Instead of writing my scripts in the NWN2 Electron Toolset, I chose to create them in the NWN1 Aurora Toolset first. Scripting and testing in NWN1 is much faster than in NWN2. I figured that porting my NWN1 scripts to NWN2 later would be a simple matter.

After two days, I got an initial set of scripts working. To test the scripts, I pitted an army of 38 dwarves against a total of 41 enemies -- 28 orcs, 11 half-orcs, and 2 hill giants. All of the foot soldiers on both sides were level 3, and most of their commanders were level 5. The exceptions were the dwarf king, who was level 6, and the hill giants, who were level 12. Despite the slight superiority of the orcish alliance in terms of numbers and total character levels, the dwarves generally won.

I couldn't help but smile when I saw the dwarven archers march in formation to get within arrow range of the enemy and loose their volleys together. Having squads fight as a unit is what differentiates the default AI from the one that I wanted to develop.

Incidentally, the scenario described here will not appear in "Faithless." The sole purpose of this scenario was to test my battlefield AI routine.

After spending an additional day ironing out a few kinks, I was ready to port the module to NWN2. I had to create the area and NPCs from scratch. I only spent a couple of hours creating the battlefield since I didn't want to obsess over an area that I wasn't going to use in my module. For my NWN2 demo, I pitted 26 dwarves against 45 orcs. I was too lazy to add half-orc NPCs to the module, and since the Electron Toolset does not have any hill giants, I couldn't add those. As for my scripts, I exported them to an ERF file, which I then imported to the NWN2 module. The scripts compiled without a hitch. When I ran the module, however, my game kept freezing as the armies were about to clash.

Panic time.

Fortunately, I had created a trace debugging technique for NWN1 three years ago. This debugging technique also works in NWN2, although setting up the game to output error logs is more convoluted than in NWN1. With this technique, I found that the problem was with something completely unexpected. The NPCs were issuing too many shouts that other NPCs had to respond to. This was causing the engine to overload and break down from sheer stress. It took me two days to get my scripts to run without freezing the game.

Features of the Battlefield AI

The battlefield AI that I created makes soldiers fall in formation when they are spawned. Even if the soldiers are placed haphazardly in their area, they will immediately organize themselves around their unit leader during the game. Hence, the only soldiers that have to be positioned properly are the unit leaders.

The picture below is from the toolset. It shows how the dwarves are initially arranged in their area. In particular, the dwarven archers on the right and the royal guard at the rear are scattered. The dwarven men-at-arms on the left are spaced widely apart.



Below is an in-game view of the dwarves shortly after the module starts. Notice that all soldiers are now neatly lined up in close formation.



Soldiers on the move will also march in formation, albeit somewhat sporadically. Below are a couple of images of orcs on the march. These images were taken within seconds of each other.

Before



After



Soldiers will generally fight as a unit. Unless their commanders order them to attack, they will stand their ground. The moment steel cleaves flesh or crushes bone, however, fights will quickly degenerate into chaos. But then, such is the nature of war.

The first time that a military unit suffers 50% losses or more, all its soldiers must make a morale check, which is basically a Will save versus fear at DC 20. Any soldier that loses at least 50% of its hit points must also make a morale check. Soldiers that fail will flee the battlefield.

Below are a couple of pictures of orcs exercising the better part of valor. A tell-tale sign that they are running away is that they are no longer carrying their weapons, having dropped them along the way.





To Do

There is still quite a bit of work to be done with this AI routine. For example, I have not implemented any fancy maneuvers such as flanking. In addition, I haven't coded any routine for unit commanders to try to rally their troops. Also, the in-game frame rate when there are too many soldiers in the area is bad. I'll have to figure out what the maximum number of NPCs should be to maintain a minimum frame rate of, say, 15 per second.

All these features will have to come later. For now, I wanted to post an update in this blog regarding my progress. It has been a while since I've written anything here.

Making a War Movie

Screenshots of NPC soldiers in the battlefield are nice, but nothing captures the drama and excitement of war better than a video. I ran my module several times, shooting scenes from different positions until I had enough footage to make a three-minute movie.

While filming, I found out that my frame rate was terribly slow. The actual rate varied from time to time, but I was getting as low as 7 frames per second. Sometimes, my video speed dipped even lower than that. This is unacceptable. I will have to find a way to raise the video speed. The most obvious way is to decrease the number of NPC combatants, although my scripts can probably stand a little more streamlining.

To create a movie out of my footage, I used Microsoft Windows Movie Maker, which comes packaged with Windows XP. Within a few minutes, I started wishing I had bought a reliable video editing software. Windows Movie Maker kept crashing on me. Each time I made a move, I had to save my file for fear of losing all my hard work. This travail was worse than playing the computer game version of Temple of Elemental Evil. War is hell, but so is making a video with Windows Movie Maker. If I had been coerced into using it, that action would have constituted a crime against humanity. Since no one forced me to use the software, I can only excuse myself by pleading temporary insanity.

After a day of madness, I finally completed the video to my satisfaction. It isn't Apocalypse Now, but at least it shows what my battlefield AI is capable of doing. A somewhat hi-res version of the video may be downloaded from the Neverwinter Vault at this page. A very low-res version may be viewed below.

video

Wednesday, May 7, 2008

The Fire-Forged Queen of Damara

To help me understand my characters better, I find it fun and useful to write back stories for the more important NPCs in my module. Character backgrounds are often excellent inspiration for side quests. For this post, I've decided to spotlight Queen Christine of Damara, wife of King Gareth Dragonsbane. A submissive woman this lady is not. Even though she only has a small role to play in "Faithless," her strong character warrants a separate writeup on her.

Despite appearances, nothing that I write or show in this blog is a spoiler. Most of the information presented below may be read in the four TSR modules regarding the Bloodstone War; namely, Bloodstone Pass, The Mines of Bloodstone, The Bloodstone Wars, and The Throne of Bloodstone. A small part of this writeup is actually my conjecture on why some of the characters behaved the way they did. I believe that readers may discern the actual realms lore from my conjecture based on how I phrase some of the information.

The Years of the Bloodstone War
Christine, the daughter of Baron Tranth of Bloodstone, was only eight years old when the undead wizard Zhengyi appeared out of nowhere to establish a kingdom in Vaasa. Mustering an army of humans and monsters, Zhengyi set his sights on Damara in what was to be a twelve year war. During that time, the bloodstone mines were sealed off from the Damarans, and Christine saw her father's barony slip slowly into poverty.

For ten years, the Vaasans and the Damarans fought with neither achieving a decisive victory over the other. In the battle at the Ford of Goliad, however, King Virdin Bloodfeathers of Damara was slain. Immediately thereafter, groups of assassins killed the most powerful and loyal nobles of Damara in one fell swoop, leaving behind the incompetent and disloyal to sue for peace. With his coffers bare, Baron Tranth was not deemed a serious threat to the Witch King. The former kingdom of Damara was broken into autonomous baronies that paid tribute to Vaasa.

Before the arrival of Zhengyi, the domain of Bloodstone had grown wealthy from trade in the gems that gave the barony its name. Even when the war started, the barony's descent into poverty was not immediate. Christine grew up well aware of her family's high status, but she witnessed that status diminish to a ghost of its former glory. To most people, she is as cold and haughty as she is beautiful, but those who knew her would have seen the shame that fuels her passion.

Because her mother died when Christine was a baby, the only authority figures that Christine could look up to were male. Aside from her father, Christine often sought the guidance of the old druid Quillan, whom her great grandfather had hired as the barony's historian. It was from Quillan that Christine grew to love nature and attain some level of competence in the druidic arts. To her father's credit, Tranth did not seek to dissuade Christine from her worship of Silvanus despite the widespread worship of Ilmater in Damara. Instead, he schooled her in matters that he deemed most important in their troubled times -- the twin arts of diplomacy and war. Perhaps because of this, Christine became feisty and tomboyish. When a group of powerful heroes eventually answered Baron Tranth's call for aid, Christine had command over the village militia and fought alongside the rest of the Bloodstone army.

Lady Christine was eighteen years old when she first laid eyes on Gareth Dragonsbane, one of the heroes who answered Baron Tranth's call. Her icy demeanor must have melted at the sight of the dashing paladin. It is said that Christine often sought to draw Gareth's attention by strolling around in plain sight while Gareth was training the villagers or by sending him delicious lunches whenever he was nearby. Sometimes, she even invited him to "secret meetings" that turned out to be picnics by the lake. Perhaps the thought that death could come to her or Gareth at any time emboldened her to be forward with the handsome hero. War has been known to throw the usual rules of courtship out the window.

A year after they met, Gareth and Christine were wed. On the day of the wedding, Baron Tranth announced that he was abdicating his title in favor of his new son-in-law. Tranth must have known that Bloodstone Village needed a hero to fire up the hopes of its people. Gareth was their hero. As to whether Gareth could navigate the political snake pit that came with the title, there was no need for Tranth to be concerned. He must have known that his daughter was fully capable of handling whatever Gareth could not.

In the remaining months of the war, Lady Christine had busied herself with cementing key alliances among the baronies of the former kingdom. When Gareth eventually defeated the Witch King and sent his armies packing to the remote corners of Vaasa, Christine's groundwork had paved the way for Gareth to be crowned king of a united Damara, and its people enjoyed an unprecedented level of prosperity.

The Present Time
So what has happened to Queen Christine since then? Has she been living happily ever after, just like in the fairy tales? Well, despite being a fantasy world, Toril is no setting for fairy tales, and like in real life, no one there really lives happily ever after. I've heard it said that a comedy is a tragedy that has not yet ended. (I can't rightly recall who I heard that from. Maybe Jergal. Heh-heh.) Anyhow, conflict is at the heart of any story, and it simply won't do for our characters to be content with their lives.

At the start of "Faithless," Queen Christine is in her very late thirties. I believe that the back story that I presented above can suggest a number of ways to introduce further conflict in Christine's life. I'm not about to spell them out here, however. That would constitute a spoiler. Readers will just have to wait for me to release my module to find out what I have in store for her.

Hair and Makeup
I'd like to thank Barrel of Monkeys for Queen Christine's hair, which is taken from the hakpak Hair Extensions. Queen Christine's face is courtesy of the 3D artists at Obsidian Entertainment.

Saturday, May 3, 2008

Timeline

Dirtywick's comment on my last blog post made me realize that there are novels set in the Coldlands that I was not aware of. I'll need to read the Sellsword Trilogy to ensure that I keep within the known lore of the realms.

To keep my story organized, I wrote a brief timeline of the events that lead up to "Faithless." Much of this is based on the official chronology given by your friendly neighborhood Wizards of the Coast, but I also found a very impressive timeline elsewhere. The events of Neverwinter Nights 1 and 2, including their expansions, are not placed in any precise time period, however, so the year in which "Faithless" occurs is equally fuzzy.

Not all events in the history of the realms are listed here, of course. Only the ones that are meaningful to "Faithless" are here.

All dates in the following chronology are in Dalereckoning (DR).

  • circa -25,000 DR - Death of the god Ulutiu resulting in the formation of the Great Glacier; end of the reign of giants; disappearance of all titans, allegedly because of a curse of the gods

  • 1038 DR - The Great Glacier recedes far enough to expose the Coldlands to habitation

  • 1347 DR - Arrival of Zhengyi the Witch King at Vaasa; start of the Bloodstone Wars

  • 1358 DR - Time of Troubles; Cyric and Midnight (i.e., Mystra) become gods; Mystra kills Myrkul (refs. Shadowdale, Tantras, and Waterdeep)

  • 1359 DR - Defeat of Zhengyi; unification of Damara under King Gareth Dragonsbane

  • 1366 DR - Artemis Entreri and Jarlaxle Baenre go to Calimshan, from which they will eventually head for the Coldlands (ref. Servant of the Shard). Note: The year that they arrive at the Coldlands is unknown to me but is probably not too far off.

  • 1368 DR - Kelemvor Lyonsbane ascends to godhood (ref. Prince of Lies)

  • 1371 DR - Cyric goes mad (ref. Crucible: Trial of Cyric the Mad)

  • 1372 to 1373 DR? - Neverwinter Nights 1. Note: Bioware's NWN1 FAQ places the start of the official campaign early in 1372, the Year of Wild Magic. However, some in-game information states that certain magic items were created for the hero of Neverwinter in 1373. It's entirely possible that the official campaign spans the years 1372 to 1373.

  • 1374 to 1375 DR? - Neverwinter Nights 2

  • 1375 to 1376 DR? - Mask of the Betrayer

  • 1377 to 1378 DR? - Faithless


It should be stated that the known history at around -25,000 DR is highly unreliable and may be regarded as nothing more than folklore. For instance, the story of the titans plunging to their death in the Great Sea like oversized lemmings is too silly to be believed. (See page 79 of Faiths and Avatars for the full story.) More likely, when the titans sensed that the reign of giants was soon to end, they all moved to the outer plane Arborea, never to return to Toril. The tale of the Great Glacier forming from the necklace of the dead god Ulutiu sounds equally spurious even for a fantasy setting like the Forgotten Realms. Of course, I could be wrong. Anyhow, those events happened so long ago that it's anybody's guess as to what really happened.

In case I've made errors in the timeline, I'm welcoming all comments for correction.