Friday, 24 July 2015

Alpha Testing #2

Latest testing reached the point where I decided to restart my alpha-testing ... and so I am now on Alpha-Testing #2. Basically, I had a number of fixes to creature AI, journal updates, feats and general maintenance that made me decide a restart was required to ensure I had sorted these first issues. It also gave me the opportunity to start with a different class PC to try a few other ways of approaching the module.

Script Handling & AI

The main changes I made this time around were to do with the scripts that are attached to companions and creatures, especially as dictated by the NWN2_ScriptSets.2da. In the early days of my coding, I relied more on existing scripts and OC protocols, using variable holders to fire my "custom" scripts associated with creature event hooks, like OnSpawn and OnHeartbeat. However, as my scripts have grown, these two "older" systems have become more of a confusion and hindrance than simply rewriting my own and directly associating them using the SetCreatureScriptsToSet function pointing to the NWN2_ScriptSets.2da. After the issues I experienced in Alpha-Testing #1, I decided this change was sorely needed to allow me to sort through both companion and creature scripts more easily. This change helped a lot when it came to working with henchmen and other associate types that shared scriptsets in common, or I had manually edited to try to workaround the differences between them. This separation has helped streamline the code and tidy many of the discrepancies.

Journal Entries On Creature Death

Another change that determined a restart for me was after I encountered a failure with a "trigger" event to do with a journal entry update after I killed all creatures spawned from an encounter. In this case, a single trigger for an encounter would be simple enough. However, I had a series of encounter triggers that spawned creatures, which was only meant to update a journal entry when all creatures from all these spawned encounters (from shared triggers) were killed. My existing system relied upon another trigger involved in the setup, which simply did not work reliably. Therefore, it was a case of rewriting the scripts surrounding this journal update event for those quests that relied on such.

Other Fixes

There were some other issues that revealed themselves in the latest lot of testing, but they were straightforward to fix by comparison. There was a situation where two "Hunger" icons were displayed in certain circumstances, due to me not doing a correct condition check.

There was the reappearance of some erroneous "faith" related information, which pointed towards an error I had in setting a variable at the time of "losing faith". This also had an impact on clerics "resting" and the prayers they gained, which meant it was important to track down and fix.

"Out with the old and in with the new" is probably the saying I mostly used regarding script changes recently made, as I rewrote some of the oldest scripts I had previously written ... even amalgamating similar event scripts to reduce overhead. I believe I have addressed most of these older scripts now, and, hopefully, I will be able to make progress again.

Hopefully, I will have a bit more to say in a few weeks time. If you don't hear anything in the meanwhile, just assume I am focussing on another set of issues, and will update you when I have more to report.

Thursday, 9 July 2015

Alpha Testing #1

I have finally reached what I would consider the alpha testing stage for my module. I know there are some that would say I should just jump straight to using beta testing, but due to the high amount of customization in both AI scripts and XML, this module needs this final stage of internal testing before I release it into the hands of beta testers. As it happens, it's a good job I did, as some of the latest changes I made did have quite a bad affect on the module. Here is just some of what I picked up in my recent testing:-

Companion and Henchmen AI

This was one of my biggest concerns in my initial testing, as I discovered both companions and their summoned creatures would fail to return combat after a first combat. This was a hard cookie to track down! In the end, it turned out to be due to a player AI toggle setting to do with my own AI master control between having PCs in AI Mode or Puppet Mode.

The problem turned out to be due to two issues: The first issue was because I had failed to NOT include henchmen (inc summons, familiars and animal companions) in the master AI toggle, which meant when the game switched automatically to turn-based combat, it turned the AI off on these creatures too, which it is not meant to do. The second issue was more difficult to track down, and turned out to be due to the main PC not using the conversation script attached to it until after the player had switched to at least one companion. Once I had addressed these two issues, the AI all worked again as it was meant to, with companions using AI or not (according to the player's AI toggle setting), and henchmen (etal) using AI as standard.

Indestructible Quest Items

When a PC returned a quest item to an NPC, the item is destroyed as normal. However, upon a reload, the quest item returns to the player. This problem was due to the database not being updated correctly due to the item being "destroyed" rather than "un-acquired", where the check is normally updated. In the end, I decided to have the database update as the player used the escape key to bring up the "Options" menu when saving or quitting the game. This turns out to be a better way of dealing with this code anyway, and it sits quite nicely alongside my "henchmen fix" code that uses the same XML. (The "henchmen fix" code removes henchmen prior to exiting the game, which normally makes the module crash on exit if not done.)


As some may recall, I have made a list to double-check four things during this testing time, and conversations was one of them. In the testing, I discovered a few conversations that had illogical nodes due to where the PC was located according to the time of day. (A rare situation, but one that I have proven to be possible.) While this was not a drastic problem, it was the sort of thing I was keeping an eye open for and so it got fixed.

I also decided to add an option to allow a conversation to continue after a player chose to "shop" via an NPC. This was because I wanted the player to not miss out on any potential new nodes that may present themselves *after* having browsed the shop's goods. Works a treat!

I also noticed that if the area map was open when a cutscene conversation started, that sometimes, the map would still be visible over the cutscene conversation. I edited the cutscene.xml to ensure it closed the area map GUI as it started, which now does away with that potential issue.

Quest Completed!

I have a dedicated quest VFX and small tune that plays with some quests, which adds quite a nice sense of achievement. However, in my testing, I discovered that the method I was using to deploy the VFX (via a conversation) was not being reliably displayed, due to the way the conversation set the camera angle. Therefore, in the end, I opted to deliver this VFX outside of a conversation and just within the game itself. I had to alter the SEF slightly, but all now looks far better when presented.

Debug Feedback

And while the least of my problems, I discovered there were still one or two lines of debug code giving feedback, even though I was no longer testing the game in "Test Mode".

Additional New Code

The only new code I added was the implementation of Spell Resistance (SR) when wearing items that give SR. I decided to use the feat system to add a new feat (SR Via Item) whenever a PC wore an item that gave them a higher SR value than any natural benefits the may have had.

And Onwards ...

That's all I have found and fixed so far, but I will continue to go through the module at a reasonably swift pace, and in a fashion that I think may help to mimic the most common choices or path. (Beta testers will probably do better at finding the more unusual path for me.) That said, this first batch of alpha testing has had me restart about four or five times, mainly due to the AI bug, as that was difficult to track down. However, now I am underway again, and have the support once more, hopefully, I will make quicker progress and iron out any other final major issues prior to beta release.

I will report back further testing issues in the days that follow ....