Choose Your Language

Friday, 30 November 2018

The Adventure Continues ... 4. A Day In The Village. (Memory Leak Warning. v2.14 Now Available)

An interesting series of issues arose the last time we played, which although minor in themselves (as they did not stop play), did help highlight an issue that would have eventually caused the server to crash due to a memory leak!

Funny enough, this last set of fixes escalated from initial minor ones, to those that ended up taking me a little while longer than expected to finally resolve. Recall last week,when I mentioned the "COMPANIONS IN MP"? Well it was from that "simple fix" that I managed to introduce a memory leak. More detail on that in a minute. For those that want to keep up with the heroes adventures, that's further below. I also placed this warning on the download page to stress the importance of the latest fix:-

v2.12 WARNING: If you are one of the few people to download v2.12, then please accept my apology, as that version had a memory leak, which will eventually make the module unplayable. From v2.13, the memory leak has been fixed. However, even patching will leave you with damage in the form of numerous invisible unwanted objects scattered over areas.

The List of Fixes

1) MEMORY LEAK (DISCOVERED): Let's get this one out of the way. Basically, to help resolve an earlier companion issue, I caused a function to be called from their heartbeat (every six seconds) to do a simple check. Unfortunately, when this check was called, it caused the companion to dump all their equipment into an "invisible container" every six seconds! By the end of 43 minutes in one area, there had been 423 containers dropped, and after 54 minutes in another area, 543 containers had been dropped (all with items). This would have kept on happening until the server eventually "died" under the strain. The latest update now prevents this from happening, but does NOT resolve damage already done. I have written specific "fix" code for our own situation (which a person can check out in "alb_althea_patchscript"), but I have commented this  code out for the latest update, which would not need it. I only actually discovered this issue because I was having a problem with some items NOT being cleared from an area after being exited. Investigating that issue brought to light the mass of invisible items all over the two areas in question.

2) RESILIENT ITEMS (INTERCEPTED):  This problem was not experienced during the session, but while testing some code to fix a TRANSITION problem, I noticed some items remaining in an area when they should have been removed. It turned out that the general Area Clean Up code was clashing with some dedicated clean up code for these particular offending items. Once I established this, I re-timed the checks and the offending items were destroyed as expected. And once that timing issue had been resolved, it sorted the transition problem ...

3) TRANSITION FAIL (INTERCEPTED): While returning to a place to test a conversation for the next session, I discovered that the transition that had worked fine before, stopped working. It would fade me to black and then fail to do the transition. This turned out to be caused by the problem above (see item 2), but this also highlighted another problem: What to do for a player left in "BLACK" after some other potential failed fade operation. To this end, I added a quick FadeFromBlack (which allows the player to see again) if they hit escape. This would be useful, as it allows the player to continue with the game at least. In this example, it would have even allowed them to do the transition again, which worked the second time around.

4) SOUND FILE FAILED (INTERCEPTED): Again, while working to resolve issue 5 (below), I discovered that a certain sound file was failing to fire as expected. I won't go into (spoiler) details, but I ended up having to move the sound file to play from a conversation rather than the script that called for the conversation. I believe it was just a matter of timing again. Although, there was also the issue of GetFirstPC not correctly calling a player (but the DM instead), which added to the problem.

5) GetFirstPC CALLS (INTERCEPTED): The issue with using GetFirstPC was highlighted in my testing this time around. I never experienced issues with it before, as I have never tested the campaign with a DM as host before. However, I believe it can be a problem because I think the function can sometimes return the DM rather than a PC player. This can be a problem when trying to then run faction member loops after using the GetFirstPC to "get" a PC. In the end I wrote a personal function to check if the first GetFirstPC was a DM, and grab the next PC if it was. It is a simple wrapper function that I call GetAPlayer. I ended up changing a number of both MODULE and CAMPAIGN scripts to use this wrapper function to be on the safe side of what was being used. The altered module files were added to the hak for our future sessions. (The latest version does not need the hak.) The NWN Lexicon says this about the function: "If you are building for multiplayer, be aware of uses of this function. You could be performing tasks on a player that was not your intended target." I think I experienced this and is why I now use my wrapper function when definitely requiring a player PC.

6) FRANK/KATHY CONVERSATIONS: Now this was the original problem (prior to all those above) that I had been aiming to "fix". The problem with this conversation came to light when the players noticed the journal had said it updated, but when checked, had not changed. The problem was confirmed as an issue when the players duly visited the apothecary as instructed, but were unable to ask Kathy for help. (The failed journal update did not unlock the chat option.) It turned out to be due to the way GetFirstPC and the QUEST node in a conversation work, especially with respect to lower quest states overwriting higher ones in a MP game hosted by a DM. I believe I have this issue sorted now, by keeping track of the player speaker when doing the journal update. (NB: This problem required fixes to MODULE scripts and dialogues, which meant I have had to introduce a patch hak for our sessions. Furthermore, I have also had to fix journal entry via the "alb_althea_patchscript", which is commented out in the latest public release.) There was also a second problem with Frank's conversation related to logic flow; this was also fixed. (Although there may be a minor issue with PCs already knowing Scraps name, which I may try to address later.)

7) CHAT WINDOW (AGAIN): This version of the earlier issue was "accidentally" discovered when one of the player's (Graham on WAN) chose to UPDATE MAP PINS by mistake. The option is quite legitimate, but had not been required at this time. However, it's process of leaving and returning to the same area demonstrated that some code was still needed for the exit/return exercise. E.g. The CHAT WINDOW needed closing again according to the player's setting. The missing application of some code was also the reason why the player had to now click twice to open their inventory - a variable had not been set.

Threska Seemed A Little Uneasy In This Sanctuary to Boran

The Adventure Continues ... 4. A Day In The Village!

So many problems ... ?

NB: Contains spoilers for Option 1 background.

The session started a little later than we hoped due to Graham having difficulty starting his copy of the NWN2. However, once up and running, things progressed relatively smoothly, even if the list of reported issues did look longer this week.

We catch up with our heroes just having had a spending spree at the local stores. Before continuing on familiarizing themselves with New Edgeton again (it is their home village in option 1 background, but they had not been here for many years), the heroes caught up with a little gossip from the store vendors (item 1 fix last blog).

After the quick chat, Helden then took the lead, taking a circular route around the village. First stop was at the local smithy, where they met Todd. The blacksmith had a problem with disgruntled ex-employees and asked the heroes to retrieve a combination to his chest from them so that he could get back to his equipment. Myara did try to help the smith by attempting a lock pick for him, but was unable to crack the code at her current level of ability. Instead, the heroes said they would keep their eyes open for Joss and Billy, the two scoundrels who had messed with Todd's chest.

Continuing along the way, the heroes called in at the local Apothecary run by Kathy. They had noticed a strange pedestal before entering and quickly asked her all about it. It turned out to have once been the base of a statue called The Angel, which now stood as the headstone to Sophie's (her daughter) grave.

Kathy should have been able to offer help with Ant Poison, but the heroes were told to come back later. (Due to item 6 problem above.) Apart from that Kathy offered the heroes various items for a little gold, especially in crafting, and the use of her table for crafting (should they need one). She also offered help in solving Chameleon Puzzles for a price.

Moving around the village, Helden occasionally banged at a few doors of local houses, but most owners appeared out (probably at work). Myara thought about a bit of pilfering after listening to be sure, but thought better of it for now.

Towards the edge of the village, the heroes entered the tower garden of the local wizard, Astend the Wise. They had barely entered when Aeriol popped out from behind a tree and introduced himself to them. The elf wizard had been trying to gain entrance to the tower to meet Astend, but had not been successful. The heroes offered to help gain entrance, but came up against the same resistance as the elf, in the form of an odious talking door. The heroes made no inroads either, and so Aeriol tagged along with them for the time being.

Continuing on, the heroes eventually came upon the Sanctuary of the village: a holy place dedicated to the good god, Boran. Orechin was still the clergyman at the sanctuary and recognized the party of heroes as they came in. The group chatted about old times ... and the new ones ... and the heroes ended up buying a book from Orechin to learn more about the changes. Orechin had only just given them some gold to help them along though ... for old time sake.

The clergyman had a lot to talk about, especially pertaining to the sanctuary crypts, which had apparently been overrun with undead. Orechin asked the heroes if they could retrieve the legendary sword of Ragnor Oran from the crypts for him, but  warned them of potential necromancy involvement too.

There was also the local Mercy Board that the heroes looked at in the sanctuary. A number of people  had posted requests for help, and the heroes spoke to Orechin for more details about each. There were a lot of problems about the village it seemed, and it seemed the heroes had arrived at the right time!

The heroes had spent the whole of the morning shopping, and now the whole of the afternoon exploring the local area. It was already gone 8.00 pm, and the group were growing more and more tired and needed to rest. Who would have thought "normal life" could be so tiring?

TOTAL SESSION TIME: 1 Hrs 20 Minutes. (Late start.)

There are a couple of things to remember for the next session:-

1) Frank and Kathy have both had conversation fixes (and may have more to say).
2) Use the "Z" key to highlight items in the area with which to interact.
3) You will be warned if you are about to do anything "evil" like steal, so it's safe to explore.
4) You have only just arrived at the Sanctuary and have yet to "explore" it further.

No comments: