Choose Your Language

Thursday 26 November 2020

Episode 36: Camera Now Goes To 11!

The last few weeks since my last post have been relatively productive for me, and since that time we have also had the news that Arem (from the NWN2 Forums) has successfully managed to locate the hexadecimal locations of the nwn2main.exe to allow us to increase the zoom potential of the camera for the game. Technically, it goes much further than 11, but I hope my Spinal Tap reference has not gone unnoticed. (I have a clip to the hilarious link in my post below.) Read on for further information.

Overcoming A Hurdle

I am pleased to say that I managed to finish a difficult set of conversations that formed an important section of the main plot for moving the player forward in the game. The conversations included where the player learns of a situation, seeks what must be done and then decides what to do about it. The point is, however, this series of conversations was already being dictated by how the player had previously explored the area and what they already knew. Therefore, it involved quite a bit of logic flow checking, and even ended up needing a final potential event added to the area that had a small chance of requirement if the player had done something completely off the wall. For those interested, I even had to brush off my skills of calculating probabilities of a certain event occurring, to help ascertain requirements. My thanks goes out to Thierry (a.k.a. 4760), who re-educated me in this.

Leaving The Options In

With respect to what I say above, I know there is an argument that, as a builder, I can make the options simpler for myself with what I allow the player to do. However, as a DM from days of pen and paper (PnP), I like to place myself in the position of the player and try to accommodate as much flexibility and out of the box thinking by the player as possible. There are of course still limits compared to PnP, but if I can minimise these, I will. This last section of conversation writing was one such situation, and now that it is finished, it offers around four possible paths just for this one area of the game. Then the fun for me is watching (or hearing) how a player managed it in their game. Thankfully, I have a small group of players who I will see at first hand what they will do; and my wife, I am fairly sure, will try a number of them through various plays.

Conversation Animations

During the time of writing conversations, I also discovered some animations that failed to work reliably. After some testing, I eventually managed to narrow down those that (for me at least) appeared to work as described. However, again, having had info back from Thierry, my results differed from some of his own experiences, although he concurred there were some that gave him problems too. One that stood out to me, which I had liked to use, was the Scratch Head animation: sometimes it worked, other times it did not. The main point to note, however, is that NOT all animations work. I post my results at the very bottom of this post for information.

Overcoming A Bug!

I give as a warning to others who may do something similar ...  

If you have scripted your code to recognise a certain TAG reference, do NOT forget it! 

We all know about being careful with UNIQUE tags, but there may be others like me who may also use a common aspect of a tag to help distinguish between similar tags when applying a common aspect of code. The problem is, if you forget you have done this, it can come back and haunt you as a bug!

After my hiatus, I returned to continue building an area and added a number of "guards" that were required to fill it. At the time, I was using a standard "alb_npc_xxx" to help distinguish the various guard types. However, I had forgotten that I use the "alb_npc_" section of a tag to distinguish between specific and unique proper NPCs. So, when my code spotted one of these generic "guards" with the prefix, I ended up with some very strange results that were tricky to track down. E.g. One guard of a group of sleeping guards refused to sleep. (Insomnia I guess. 😏) Tracing the fault back, I discovered the guard had lost the variable that told it to sleep due to its tag making it have other code fire beforehand. What made this more difficult to track was that after this particular piece of code fired and prevented the guard from sleeping, it no longer fired for any other guard. i.e. The problem appeared specific to the particular guard, but turned out to affect any and all guards that had the wrong tag, but only the first ever one the code found.

The end result: I had to go over a number of areas re-tagging the erroneous guards and then also correcting all way points, triggers, conversations and scripts that referenced these tags. The good news is, while a pain (because each change also forced me to have to restart the toolset because it does not like such in area changes), I have now fixed that and can continue. And so finally ...

A Camera That Goes To 11 (At Last)

OK, for those that don't know the Spinal Tap clip, here it is ... Where have you been?

The real news, however, is that we can now go just that little bit further out with our camera zoom angles within NWN2. It has been a long time coming, but thanks to Arem (of the NWN2 forums), we have been blessed with the hexadecimal information we needed to apply this hak to the nwn2main.exe file.

For those that would like to do the same, here is a brief tutorial.

The Hex Editor I used was: HxD Downloaded From Here.

INSTRUCTIONS

Preparation:

  1. Always check any downloads for viruses before usage.
  2. Understand where you install a utility and access files. Install the HxD if you do not have it.
  3. Always backup any files you are working with. In this case nwn2main.exe.

Working with a copy of nwn2main.exe using HxD:

  1. Copy nwn2main.exe to your desktop to work with.
  2. Open HxD and open the nwn2main.exe copy on your desktop
  3. You will be presented with a lot of numbers and data in a window.

The hardest part when working with a editor is finding the part among the data you need to edit. The two sections we need to edit have been presented to us by @Arem as hexadecimal numbers:

  • For the height of the STRATEGY (default 25) the area to edit is located at: 572818
  • For the height of the EXPLORATION (default 22) the area to edit is located at: 580D64

I have personally set mine to both 35 as a test for the time being.

The simplest way to find it is as KevL points out (if you use HxD) as we both appear to do.

Long Explanation: The column presented on the left of the editor only shows you where different sections of these blocks of data begin. If it was in decimal, it is akin to showing 10’s, as in 10, 20, 30, 40, etc. Therefore, to continue the example and to look for say, 45, we would need to look for the 40 in the first column and then move along the row five places to reach the 45 position. In this case, however, the numbers are made slightly more difficult to read intuitively because we are using hexadecimal rather than decimal.

The easiest number to find is the 572818, because we can look for the column 572810 and then along until we reach the ninth location (including the zero offset), the one we want. (Note: These are called “offsets” and begin at “0”) NB: HxD shows the actual point you are at in the bottom left hand corner, so you know when you are the exact spot you need to be.

Here is the screenshot of where you should be for each place. Note the values on the right hand side of the images. These are the ones you need to edit to the value you want.

  

Once you have changed them, save the file and use the modified nwn2main.exe instead of the original.

KEEP THE ORIGINAL IN A SAFE PLACE!

And Finally!

Finally, and for an added bonus this week, I have three screenshots to leave with you, although all of the same image. The shots are from a new area I have started to work on. It is not "new" as in an additional one, but "new", as in I have finally reached the stage to work with it properly.

The three images, however, have been taken using the new camera angle settings I have with my game now ... one from each of the camera angles, with all now set at 35.

The differences to the normal setting may not be obvious or hard to tell from these shots, but I hope the view they give helps you to see how flexible the depth is even at the level of 35 in each case.

Camera: Character Mode

Camera: Exploration Mode (35)

Camera: Strategy Mode (35)

BODY ANIMATIONS TESTED ON MALE ELF:

NB: By “WORKS”, I mean it provided an animation of some sort, but may not be of much use. Some marked “FAILED” occasionally worked, but maybe only once and then not again. Most did nothing at all, BUT may work with other creature models.

ACTIVATE - FAILED
ANNOYED - FAILED
ATTENTION - Appeared to keep raising shoulders. (WORKS)
BARDSONG - FAILED
BORED - FAILED
BOW - WORKS
CHUCKLE - WORKS
CLAPPING - WORKS
CONVERSATION_ANIMTYPE_TALK_FORCE03 - WORKS
COOK01 - WORKS
COOK02 - WORKS
CRAFT01 - WORKS
CURTSEY - FAILED (May work on a female NPC.)
DANCE01 - WORKS
DANCE02 - WORKS
DANCE03 - WORKS
DEJECTED - WORKS
DRINK - WORKS
DRUNK - WORKS
EQUIP_WEAPON01 - WORKS
FLIRT - WORKS
FORGE01 - WORKS
IDLE_MELEE - FAILED
IDLE_MELEE_RAGE - FAILED
IDLECOWER - WORKS
IDLEFIDGETDRUM - WORKS
IDLEFIDGETFLUTE - WORKS
IDLEFIDGETGUITAR - WORKS
IDLEFLUTE - WORKS
IDLEGUITAR - WORKS
IDLEINJURED - FAILED
INTIMIDATE - Appeared to put back shoulders. (WORKS)
KNEELDAMAGE - FAILED
KNEELDEATH - FAILED
KNEELDOWN - FAILED
KNEELFIDGET - FAILED
KNEELIDLE - FAILED
KNEELTALK - FAILED
KNEELUP - FAILED
LISTEN - WORKS
LISTEN_INJURED - WORKS
MEDITATE - WORKS
NOD_NO - WORKS
NOD_YES - WORKS
PLAYDRUM - WORKS
PLAYFLUTE - WORKS
PLAYGUITAR - WORKS
POINT - WORKS
READ - WORKS
SALUTE - WORKS
SCRATCH_HEAD - FAILED (INITIAL SOMETIMES)
SEARCH - FAILED
SHRUG - WORKS
SIGH - FAILED
SIT_DOWN - FAILED (SOMETIMES WORKED)
SIT_DRINK - WORKS
SIT_EAT - WORKS
SIT_FIDGET - FAILED
SIT_IDLE - FAILED
SIT_READ - WORKS
SIT_TALK - WORKS (Looks good for seated talkers.)
SLEIGHT - WORKS
STEALTH_IDLE - FAILED
TALK_CHEER - WORKS
TALK_FORCE - WORKS
TALK_FORCE02 - WORKS
TALK_INJURED - WORKS
TALK_LAUGH - WORKS
TALK_NERVOUS - FAILED
TALK_NORMAL - FAILED (Nothing to show anyway?)
TALK_PLEAD - WORKS
TALK_SAD - WORKS
TALK_SHOUT - WORKS
TAUNT - WORKS
TIRED - WORKS
TOUCH_HEART - WORKS
UNEQUIP_WEAPON01 - WORKS
USEITEM - FAILED
VICTORY - WORKS
WAVE - WORKS
WAVE_SHORT - WORKS
WILDSHAPE - WORKS
WORSHIP - WORKS
YAWN - WORKS

No comments: