Saturday, March 10, 2012

Neverwinter Nights 2 interface mod

Installing user interface mods is one of the first things I did for this game, but it was tricky to balance the different things I wanted. These mods work by replacing the XML files for each piece of the interface, and sometimes I liked the changes made by two different mods that affected the same UI panel. For instance, I play at a high resolution, so I want big panels that take advantage of the large screen size, and also large fonts so it'll be readable.

Usually, portraits are vertically rectangular, somewhere around a 1:2 aspect ratio, including painted portraits of real people from history and modern photographic equivalents. It's simply more aesthetic to have the head and the shoulders in the picture. The ones in NWN2 are square, which not only looks cramped, but since it shows only their heads, and the characters are made from the same 3D models and are all facing the same direction with the same expression, it's rather difficult to tell any of them apart, especially at the tiny size those portraits appear as in the dialogues.

I have a large collection of good looking portraits at a 1:2 aspect ratio (like Baldur's Gate and NWN1 used), and I wanted to use that aspect ratio for the portraits rather than the square ones. I found a good mod that added support for 256x400 pixel portraits, as in Neverwinter Nights 1, called Character Sheet NWN1 Portrait support, and that worked very nicely, though it was made for resolutions a bit lower than what I'm running.

I also wanted all my inventory slots showing as one big bag, instead of them being broken up into multiple bags that I have to flip through to find things. I know some people prefer to organise their items by putting them in different sections, but I prefer to have as much visible at once as possible. Again, I found a mod for that, though again, it was made for slightly smaller resolutions.

I would also prefer the inventory icons to be large, like in NWN1 (though perhaps not quite so large as that), so I can more easily distinguish items at this resolution. I haven't found a mod for that, and I may make one at some point.

I tried using a UI creator program from the Vault, but on starting it up, it claimed there was a newer version available and insisted that I download it, and refused to run this allegedly "out of date" version. I checked, and the version number on the web site was exactly the same. I redownloaded it anyway, but this freshly downloaded version made the exact same claim, and refused to run. This raised my suspicions about scams and malware, but whatever the reasons, the effect is that the program is non-functional.

Eventually, I got around to examining the XML files myself to see what I could do with them by hand. I downloaded and skimmed through Lance Botelle's NWN2 XML & GUI Coding For Beginners, mostly looking at his examples of what different formatting codes looked like. Then I examined the code of two of the mods I was using. One of them had some comments telling what the original values were and what the mod was trying to accomplish, which was useful.

My dialogue box mod

Before adding frame

In this case I was working on a mod for the conversation panel (what the game files call the "quick chat" panel). I prefer the dialogue to be presented in this manner, rather than the "cinematic" style that's the default in the toolset.

But I wanted the box to be much bigger, since I consider the dialogue to be an important part of the game. You can't do anything else while you're in a conversation, why not make it the main focus of the screen while you're in it? Putting it in a little box in the corner is no good, especially at this resolution, where the font is rather squintworthy.

While I was working on this, largely through trial-and-error, I found that I could just keep the game running, make my changes to the code, and then switch back to the game and start conversation again with a handy nearby NPC to immediately see how the changes looked. I was glad I didn't have to reload a save, or restart the game, which would have made progress painfully slow for this kind of trial-and-error work.

The code on which I based this had already changed the background image and font colours to a black-on-parchment style instead of the white-on-charcoal. I actually thought the original colour scheme was fine, but I do indeed find that black-on-parchment is easier on the eyes, so I just made tweaks to that -- I changed which of the parchment textures it used to better fit the larger box I coded, and changed the dark green of the response text to a deep burgundy colour to better go with the parchment colour.

I made the conversation portrait twice as large as it was, to put more focus on the subject of the conversation (though still only half the height I set for the character's dialogue), and with the portrait aspect ratio change I was able to just put it in a kind of "column" on the left, with both the NPC name and the dialogue in a second column to the right of it. One note about the altered aspect ratio, though...I couldn't find any parameters to adjust the camera placement for the default "rendered" portraits made out of snapshots of the character model, so it basically looks like a slightly off-centre closeup. The custom portraits at the intended aspect ratio look perfect, though.

Final version

The portrait frame didn't look good when stretched to the new dimensions, so I commented it out and left the portraits unframed for a while, until I found a more suitable replacement. Now it looks good, and I think it's a pretty good size for both the NPC's dialogue and the list of your responses. Now you can have up to 10 response options visible at once without the scrollbars appearing, if they're all of a typical length. How much empty space you see is, of course, dependent on the amount of dialogue written for any given part of the conversation.

After using and enjoying this new conversation panel size and style, I did find one reason the parchment background isn't the best of ideas. The OC has a couple of places where descriptive text is delivered in this panel using near-white text, which is nearly illegible against the light parchment background. Additionally, user-made modules sometimes use bright colours for special text as well. So, I think it'll have to go back to the white-on-charcoal, even though it's not as optimal for readability. I'll offer the first version I made as an option with that caveat.

Next, I expanded the portrait selection window to show much larger portraits, to make it easier to choose one. I tried to make it more than four columns, but I couldn't get the portraits to appear correctly in the additional columns, so I just left it at four.

Finally, I expanded the column of portraits for your party members to use the full height of the screen at 1920x1080. Even in the vanilla game, there are times when you can have 5 full companions and enough animal companions/familiars/summoned creatures to make you have to scroll through the portrait column to check your companions' health or status effects. Now there's less unnecessary scrolling at 1920x1080.

Some of the male and female portraits from the NWN1 art, in my expanded selection panel

Since my conversation panel mod depends on the portraits being in the NWN1 aspect ratio, and other code based on the work and examples of Ragnorak, Shin-Anubis, Thanatos2001, Fire&Ice, and WhatIsSol, I'll have to include that code in my distribution, as well as the other panels that would affect, though some time later I can design another version that keeps the square ones, even though I don't like them.

Although the mod is functional and ready, I need to figure out how to handle its packaging before I upload it.

Edit: It's online.


  1. Hey ! Je n'avais pas vu que tu avais un blog :). Je suis tombée dessus à cause d'un post sur bioware... tu as vraiment fait un travail monstrueux !

    Je me demandais... les portraits faisaient bugger le client DM en multijoueur. Est-ce toujours le cas ? Je suppose que tu n'as touché que l'interface et non le système lui-même ?

  2. Bonjour, Charlouloute! Mille excuses pour ne pas avoir de nouveau à vous d'avant!

    De quelle façon sont les portraits causant un problème avec le client DM? Comme je ne joue pas en multijoueur, je n'ai pas vu à quoi il ressemble. Pourriez-vous me montrer une capture d'écran? Vous pouvez l'envoyer à mon e-mail, si vous avez encore.

    Je peux dire qu'il n'y a qu'un support limité pour les mondes persistants en utilisant ce mod, car ils incluent souvent des fichiers XML dans leurs haks qui remplacent mes modifications. Parce que haks ne peuvent pas être remplacés, le seul recours est de désactiver les pièces du mod qui échouent.

  3. It's probab. nice fine-tune modding.
    But set portraits of henchmans like a pic. "Final version" is impossible cause noone mod include this fan-art portraits.