Saturday, 15 December 2018

The Adventure Continues .... 7. Unearthing Lies & Treasures! (Module Scripts Removal)

The last session went relatively well, albeit still requiring some essential fixes along the way. However, the fact that I was able to quickly save the game, load the toolset to apply the fix and then reload a game so we could continue, should demonstrate how minimal these alterations were. Essential, but small.

The important thing to note with the next v2.22 release, however, is not just the fixes, which I will address below in a moment, but that I have now moved some dialogues and scripts that were once in the module folder, into the campaign folder. What this does, is allow me to continue to update the campaign folder alone, without having to add a hak for our session with each module update; as all the module fixes to date (as opposed to campaign fixes), has only required dialogue and script updates. This also speeds things up when it comes to overall fixes, as I do not keep having to check if the dialogue or script being fixed is a module one that required putting into the hak to check if the fix even worked! This should be a win-win for everybody. And now to this session fixes ...

The List of Fixes

1) ACCUSATION GUI: At the end of the quest involving a murder, the heroes are given the results of their investigation in a GUI. Unfortunately, however, the GUI (which is offered to all players), had inadvertently been left in a state where even the player who activated the GUI could not close the GUI for themselves (and others). This may sound similar to last session's bug, but differs in that the button selection was disabled even for the main player and so they did not even reach the point of closing it even for themselves. (This, in turn, would have closed it for the remaining players, which was the bug fixed last time).

2) RIPPED PUZZLE FEEDBACK: If a PC has the Expert Decoder feat, they are supposed to receive feedback in a ripped puzzle as to how many pieces were in the correct position after moving them around. Unfortunately, while the Notice Text was working, it was hidden behind the main puzzle GUI. (We missed that point while playing.) And the Chat Box feedback had only worked for the host, so I had to give feedback as they worked the puzzle. The feedback has now been fixed to display to all players.

3) GOLD MONEY BAG TRANSFER: I have a new GUI that allows players to much more easily be able to transfer items between the party members. A simple right click on an item, choose "Give To" option and a GUI presents a list of PCs to whom the item can be transferred, with weight allowances remaining. Items with inventories and money bags are transferred slightly differently to other items and I noticed that when one player transferred a single bag to another PC, that their remaining gold bag also disappeared. (It was destroyed.) This problem was caused if a player has a Target highlighted (in the box at the top of the screen), and then applies the transfer. In this case, a valid object was perceived because of the above targeting and caused the code to go awry. If the player did not have a target highlighted, all went well. To fix this, I ensured the object (even if targeted) was later set as an INVALID OBJECT when referring to items with inventories or gold money bags. (I refunded Myara the 500 gp that went missing this way.)

4) SCRAP SCRAPPING PCS: This was a faction problem. When the player temporarily dismissed Scraps from the party, Scraps turned and attacked the PC. (Abandonment problems I guess.) A quick edit of the script relating to the henchman removal ensured Scraps (and other henchmen) would not turn aggressive in future. How or why this had happened is not clear, as I had not had this experience in my own testing ... ever.

5) PLATFORM SPEECH: A very minor issue relating to player click timing. Basically, when a player clicked on the platform to give their accusation speech, they could click again before the script had finished firing and stop the action. As their is a two second delay between click and conversation, a player may think nothing is happening and try clicking again .... and so on. Now, I have made it so once clicked the first time, the player loses control of further commands until the speech is underway. As a point of interest, it was while fixing these scripts that I decided to move all the module dialogues and scripts to the campaign folder. It made it much easier to test, especially after I realised that all my alterations were for nothing because I was working with module scripts that required being placed into the hak before being able to test properly.

6) CONVERSATION TRANSITIONS: Apart from Scraps giving us aggro when leaving the party, this was probably the worst issue on the night. Whenever the heroes tried to transition via a conversation, they failed due to a check that stopped transition if anybody was in a conversation. Well, this transition was from a conversation, so that went nowhere fast! However, that was not the only issue with this path of area transition: I also discovered that the current PC rather than the Main PC was being jumped, which gave all sorts of delays and transition issues. This issue has now been fixed in both areas, and testing shows all works fine now.

The Heroes Finally Gain Entrance To The Guild Hall

The Adventure Continues ... 7. Unearthing Lies & Treasures!

And the murderer is ....

NB: Contains spoilers for Option 1 background.

The heroes found nearly 500 gold coins inside the bag that was left in the statue that stood atop Sophie's grave. It was a hefty sum, and before heading back to Kathy to break her the news, the heroes decided to take a look at some of the other nearby graves, wondering, if they too may hold some secret perhaps?

It wasn't long before Myara believed that she may well have discovered something on a nearby grave belonging to somebody by the name of Josiah Clacks. The text appeared to be some sort of cipher. The rogue sat studying it for a while, with Helden offering some advice here and there, but eventually the heroes decided they need to do some research on ciphers before continuing here.

The rest of the graveyard was otherwise quiet and as one would expect, and so Helden led the group back to Kathy's where they delivered the news of what they had been working on and what they had found for her as a legacy from Sophie. Kathy was bemused, but thankful, and even gave the heroes 200 gp from the stash they had recovered.

Back at the Bloated Buckle,  the heroes now had to push their investigation and interrogate the two suspects they had discovered from Sophie's diary. Helden and Myara wasted no time and confronted Sandy and Doug. After the interrogations, Helden confessed that he felt they both had good reasons to be guilty, but Myara said her gut feeling was that Doug Millerson was the guilty party. The heroes asked around some more, and after speaking with Karl (Kathy's wife), Myara was even more convinced that Doug was their man, as Kathy appeared to have an alibi as to her whereabouts, whereas Doug did not. After reviewing what they had discovered, Helden was finally persuaded to take to the stand and speak to the patrons of the inn about the matter.

Helden was not long into his speech when Orechin turned up with some guards, ready to support whatever the party had determined to do. And when Helden pointed the blame to Doug, the guards made a quick arrest before the miller's son had chance to make his escape. A quick search of Doug revealed a bloodied dagger and more gold than expected, and so the case was considered closed, and the party handsomely rewarded for their efforts. In a short while, the activity at the inn returned to normal, and the heroes finally had time to rest.

While the clerics studied their holy books and the wizard his spell book, Myara studied the art of deciphering code, and by the morning she felt more prepared to have another go at the strange text upon Josiah Clack's grave.

Although the heroes spent some time working on the text, it was worth the time as they learned of a treasure horde located somewhere just north of the village. Helden wasted no time, readied the shovel he had found nearby, and strode off in the direction that the decoded text suggested they would find the treasure. In only a few moments, Helden had dug up Josiah's buried treasure chest, and Myara began to put her newly acquired skills to work on the colourful and elaborate lock that sealed the chest tightly shut. In a short while, Myara had cracked the lock and had access to the horde. And what a horde! There were gems and over a 1000 gold coins! Her newly acquired feat was already paying back dividends.

Along with the treasure, there was another letter  from the long dead Josiah speaking of a sword he once carried as an adventurer: A sword he had called "Betsy", which Josiah had apparently hidden in a secret compartment within the local Guild Hall. This was a too good of an opportunity to ignore, and the heroes immediately headed for the guildhall, hoping it may now be open, having been shut two days ago.

On the way there, Helden spied another sewer entry, which reminded him of the missing workers and the job they still had to do with respect to the Guild Hall anyway. On closer inspection, the heroes noticed that this sewer entrance appeared "broken open". Metal fatigue perhaps? The hole was quite large, however, and the heroes found they could easily fit into the sewers from here, although Scraps refused to go with them. However, rather than continue the search of the sewer hands this way, Helden determined they ought to try to speak with the authorities at the Guild Hall first, and so turned back. Thankfully, when they were stopped by the Empire Guardian this time around and offered to help with the sewer problem they had discovered a couple of days ago, the guardian let them enter.

GAME TIME SINCE START: 9 Hours 53 Minutes.

Thursday, 13 December 2018

The Adventure Continues .... 6. The Heroes Go Batty! (Damaging XML Scripts)

Our group finally managed to get a session played after the week of problems with corrupted saved games. I did manage to introduce a couple of others (while trying to improve the DM code), but after recognizing the issue, we pulled the two XML files causing the leveling problems and managed to play a full 1 hour and 17 minutes. This was slightly shorter than we set out to play, but a GUI issue, followed by a computer problem by the guy on the WAN (Windows wanted to update), brought us to an early night.

So, without more intro, here follows the fixes, updates and adventure!

The List of Fixes

1) CORRUPTING XML FILES: The first problem we encountered was shortly after Graham decided to bring on board a fighter (a dwarf called Flint) to replace Aeriol, the elf wizard companion. The process went according to plan until Graham went to level the PC, to catch up with the current level of PCs. At which point the Level Up button refused to work for the PC, and when he did manage to get a little further, the PC's skill points were corrupted, preventing the player from taking the PC any further. To keep the game moving, I quickly decided to remove two potentially offending XML files (one that altered the DM Party Bar to show PC hit points and another to disable the Class Recommend button on the Level Up screens). Once removed from all computers and reloaded, the PC leveled fine. However, I can add that on later testing, it appears another roster PC has been corrupted, but thankfully, is an easy fix because we have the original BIC that can be re-imported into the game. Suffice to say, these two XML files were only added last week, and then only for cosmetic alterations, and so I decided to leave them out now.

2) TB COMBAT EQUIPPING: While not a show-stopper of a problem, it was an issue I wanted to fix, as this problem caused the Turn-Based combat system to unpause for longer than expected when using the 0.1 second advancement (using the Show Info GUI box) or when swapping the equipped weapon. Both of these very brief "unpause" options clashed with the point that you are not meant to pause again in a TB round after unpausing. Therefore, I needed to add some variable checks to allow these options during a TB paused moment in the game. They are now added and work well. On a side note, the TB Combat System now works very well in MP, as well as SP since I improved the code a couple of weeks back.

3) CHOICE GUI CLOSING: The bug that led to the session ending was due to a GUI that was presented to all players in the session. It was only "active" to the lead player who caused the GUI to be displayed. After taking action with the GUI, the GUI then closed for the player taking the action, but, unfortunately, I had not yet coded to close for a MP environment (even though I had coded it to open for a MP one). Therefore, the GUI remained in place and could not even be escaped (that was the correct nature of this GUI), and so the game had to be saved and reloaded. Unfortunately, my friend on the WAN who was presented with the GUI issue has been having his own issues with his computer not starting NWN properly sometimes. This happened tonight; and was probably due to the fact that Windows required an update and restart. So, we decided that would be it for the night.

4) MAIN PC FOLLOW ERROR (INTERCEPTED): While testing, I noted that the Main PC would NOT always listen to (hear) commands shouted by the player when possessing a created PC. I had to go back to an older build to help locate the issue. It appeared to be related to some "new" code I had added to help prevent another follow issue. Once I reinstated the older code, it fixed the new problem, but, thankfully, in testing to date, the old problem has not returned! Go figure.

5) OTHER MINOR FIXES: Other fixes included: A return to the DM Map failing to open, which I hope I have addressed this time; DM stats figures showing incorrectly fixed; a return of the double Party Bar after a toggle, which again, I hope to have addressed this time; and incorrect GAME PAUSE message for the DM.

Game Update

There was only one update this week (which could be called a fix I suppose): I changed one variable to ensure that every member of the party present was compared to when giving feedback on the PARTY CRAFT tab on the character sheet. Previously, the crafting scores only checked the values of the PCs that a player controlled, as opposed to those also controlled by another player. As the tab is entitled "PARTY" and already returned the best/highest feat in the party, it was only proper to do the same with party skills as well.

The Heroes Search Sophie's Room For Clues

The Adventure Continues ... 6. The Heroes Go Batty!

Who needs garlic!

NB: Contains spoilers for Option 1 background.

Helden felt more comfortable knowing they had the backing of another fighter in the group before they faced .... the Belfry Bats! To be fully prepared, the heroes spent what little gold they had remaining to help equip Flint, the sturdy dwarf, with better armour and weapons. Then, weapons in hand, the heroes strode boldly towards the Sanctuary.

Pausing for just one moment at the notice that warned about carrying garlic to ward off the bats, Helden pushed forward boldly, preferring his axe to defeat the creatures than the waft of an herb. No sooner had he led his party to the upper floor of the Sanctuary when the group were instantly swamped by half a dozen bats. Thankfully, both Helden and Flint made up for the lack of garlic and along with Myara and her bow, the heroes swiftly disposed of the belfry squatting creatures.

"It's bat poo!" said Myara as she examined the guano near the bell rope, which Helden decided to pull, much to Orechin's annoyance. Clearing up the remains of the bats, the heroes discovered their first Life Essence: the mystical substance they had recently learned about in the book they had recently found. Furthermore, Orechin was pleased with the heroes work and paid them with 2 healing potions each.

After discussing the picture of the woman they had found on the murder victim, Orechin asked the heroes to confirm with Kathy at the Apothecary who he believed it may be: her daughter! He also advised caution when dealing with Kathy, as it appeared that Sophie had also been murdered only a couple of weeks earlier.

A few minutes later, after confirming with Kathy that the woman in the picture was her daughter, the heroes found themselves wrapped up in a deeper mystery involving a man called Theodore Peach (the man who was recently murdered) who, according to Sophie's diary, was set to wed her in the near future. To this end, the man, affectionately called "Peachy" by Sophie had been collecting gold for their wedding and bringing it to Sophie. Sophie, it seemed, had gone to the trouble of sculpturing a statue with a secret compartment, where she hid the gold, which nobody knew about, not even "Peachy".

In the same diary, Sophie spoke of concerns regarding two people: Sandy, the local serving girl at the Bloated Buckle Inn and Doug Millerson, estranged son of Frank Millerson of the local barn, who had caught her discreetly speaking with Theodore, or the statue. Now both Sophie and Theodore are dead, and the heroes also now have two suspects to investigate. After reporting their suspicions to Orechin, the local clergyman encouraged the heroes to follow up on the suspects and try to learn the truth. He said that he would catch up with them at the tavern after informing the authorities of their discoveries.

Stepping out of the Sanctuary into the warm evening breeze, the heroes looked at each other before deciding to check a theory they had about the gold that Sophie wrote about and the secret compartment that was built into the statue. So, before heading to the tavern to confront their suspects, they decided to head to the graveyard to look for more evidence of secreted gold! The graveyard was only a few paces from the sanctuary, and the statue stood out quite prominently.

"Leave this to me," said Myara, and the halfling rogue stepped up to the statue and placed her arms in the statue's arms, as she had understood from Sophie's diary as the means of opening the secret department. There was a small click, and the statue revealed its secret: a large pouch of gold! Myara, paused for just a few moments, a moral dilemma screaming in her mind, not helped by Helden's eager look at the sight of the treasure: Do we keep the gold and say nothing, or take it to Kathy?

Thankfully, the heroes passed the test of conscience and decided to keep the gold to one side for Kathy and not for themselves.

(And this is where the GUI would not close for Graham and the session came to a close.)

GAME TIME SINCE START: 7 Hours 52 Minutes.

Tuesday, 11 December 2018

MP Save Game Corruption Finally Resolved (v2.20 Available)

The MP save game corruption has been the bane of our gaming over the last week, preventing our group from being able to get anywhere at all. After many restarts and investigations, I finally managed to write a GUI that helped me to have some feedback when a player's PC had become "corrupted". In my search for the problem, I managed to discover that the playerlist.ifo file within the MP save game directory was beginning to show two entries for one of the players. It was this double entry that was giving us so many problems even after the initial problems had been clearly resolved.

Within the file, I could see that the WAN player had two player character entries for himself: one with both the first and the last name, and another with just a first name. At this stage, I had no idea what was causing the sudden dropping of the last name. However, after doing some more testing, we discovered that the problem occurred in a fairly standard way when my wife joined as a second player. I then checked the code to determine if there were any scripts firing (by her) that may have had something to do with the last name. Then I found it! I had indeed, only in the last couple of weeks, made one minor tweak to the code with respect to deleting the last name of (what I thought was) creatures other than the PCs. Sadly, I had forgotten all about this, and even on first checking, it obviously bypassed companions. However, there was no check in place to ensure another player PC did not have their last name deleted!

That error was, in fact, in two places; and once the check against deleting a PC's last name was put in place, the save games from that point onward were no longer corrupted. Evidence that such a small innocuous fix can have devastating consequences. Thankfully, that one now in the past!



I have been working in one or two other issues that have come up while testing:-

1) DM map fixed. (Was not opening.)
2) DM Examine fixed. (Was causing terrible issues with memory leaks and overflows.)
3) Companion recovery after combat (with Companion Protector feat). If a party died and the player re-spawned and went on to defeat the enemy, the companions were not recovering. They do now.
4) Turn-Based combat button is working better, and has GAME PAUSED fixed after usage.
5) Trickster Jewellery (some items) had failed to register in the database. A check was removed (which appeared to not do as expected anyway), and the database now fills correctly.
6) Ensured GetAPlayer home brew function does  return a valid object, even if it is a DM.


More code tightening, especially on the "On Enter" scripts with respect to areas. Some routines that duplicated work have been removed, with respect to setting up the database.

Reduced the number of weather units created to help improve performance.

Ensured newly created PCs would no longer be forced to take the default package after the player had taken time to setup as they wanted. (This is the case for 1st level PCs anyway.)

As a result of the above, I have disabled the RECOMMEND button for CLASS SELECTION when clicking on the LEVEL UP button, as it crashes the client if this is done.

Saturday, 8 December 2018

Here We (Don't) Go Again!

Unfortunately, the dreaded save game issue that I last reported reappeared again. BUT, there is some good news: This time around, although we sadly did not get any gaming in, we did manage to spend the time doing enough "debugging" to help me to be able to reliably duplicate the problem (as far as I can tell) on just the LAN to be able to allow me to continue trying to find/overcome the issue before we next play. And, from that debugging, I believe I truly have found the route of the problem!

The issue stems back to the day I tried to resolve a "minor" issue where a player (upon returning to a saved game) would have to DISMISS a companion and then have to ask them to rejoin again, because the companion had not re associated itself with the player, but thought it was part of the party. It was simple enough to dismiss/re invite to work around the problem, but somewhere around v2.14, I wrote the piece of code that would "automatically dismiss" the companion "properly" when a player returned to their saved game, so that the player only had to re-invite the companions again.

In testing, this all appeared to work well and good, but it was the process of dismissing the companion that introduced the SAVE GAME issue, because when a player would rejoin the game, their own heartbeat script fired (which is the same as the companion's), and thereby "remove" themselves from the game that they were about to load back into. At that point, the game thought it was a new PC entering the game that shared the same name (which is not allowed in the campaign) and threw up the warning refusing them entry. It also explains why if we tried to disable this warning (to allow the player in anyway), that the session then treated them as a new PC entering the game, stripping the character of their equipment, which then triggered a second warning that the PC had "Missing Equipment" for their saved PC. Allowing a player to be able to examine their character by bypassing this check as well, confirmed all their equipment had indeed been removed.

After adding the simple && oPCORCOMP != oMainPC piece of code, to ensure the player PC was not removing itself from the party/session/game, the player was then allowed to rejoin the session, which was now recognizing the PC was still in  the game. So far, I have tested this locally, and it does appear fixed. I hope to be able to confirm for sure after my friend joins and reloads via WAN. However, I reasonably confident that this has indeed resolved the problem this time around.

I am hoping that we may be able to continue from our last successful saved game (where the player can still reload), but there is a slim chance that we may have to go to one save game earlier, if the "damage" was done in the session prior to the last save. At the very worst, we will only be one session behind, which can actually be "fast played" in about five minutes, as the players will not have to reread the material they had in the session before (which had been more than the usual amount).

So, version 2.18 is now available, which contains the fix. It also includes a couple of other minor fixes that stop some debug feedback (left in from previous testing of this issue) ; stops the guard from interrupting a "Rallying Party" action; stops the targeting GUI from accidentally starting when there is no combat taking place; and lastly, fixes Wilf and Gavin's conversations to allow a player to ask a question again if it was aborted half way through. (These conversations are MODULE changes, requiring fresh start or added to the patch hak.)

Friday, 7 December 2018

All Fixes & No Play - Start Saved Game Issues

Well, I need to add another apology. From our own play testing, there was another problem with talking with STORE OWNERS to open the store when their conversation is exhausted. I thought the bug was squashed a few fixes back, but it was back on our last session, which did not last very long at all. More on that in a moment. So, the latest version 2.17 fixes the store issue, and also addresses some other issues that we experienced in our last play.


Here is what happened: Graham (on WAN) wanted to bring in another PC to replace Aeriol, because he felt that another fighter would balance the party rather than with two wizards as it currently stood. After a quick mid game fix to repair skill/feat selections Graham had made for the fighter (which is also in the latest v2.17 campaign folder fix), we continued to play. However, we only got as far as leaving the Bloated Buckle Inn and talking to a store owner when we encountered the store problem, mentioned above. No problem we thought, as we could reload the game and continue without taking the conversation path until it was fixed. However, when we went to reload, Graham (on WAN) had no end of difficulties trying to rejoin the game with the latest save.

The previous save appeared to work still, but (just to be on the safe side) we decided to make sure we could save/reload again having just restarted the session. Then, even that basic step of save and reload gave the same issues as he had experienced previously. We then spent the remaining time we had trying to establish why this had happened without any successful reload for him. In the end, it looked like even Jennifer (on LAN) could not join the session either, experiencing the same error messages.

In the end we ran out of time and I had a new issue to resolve. After checking the code, I thought there were some potential issues that needed addressing (which I did) and by the time I came to test it (the following day), the problem appeared resolved. Then, just out of interest, I went back to the previous version and tried to reload the LAN character again … and it worked!

So, although I made a number of alterations that I believed may have contributed to the issue, in the end, it may have simply been some form of corrupt server data that was cleared after a computer reboot. (I know I should have tried that first, but it’s great with hindsight.) However, those additional alterations I have made did clear up some inefficient code, and (hopefully) ensured a better establishment of variables upon a reload - so that it may help towards ensuring the loaded game did not confuse some variables, including such things as who was the host. NB: The older code still looked good to me, but I am happier with the alterations I have made to help alleviate similar problems (that may have contributed) anyway.

So, no gaming news to report other than these experiences. Hopefully, we will have a decent session tonight. I will report back as usual.

Monday, 3 December 2018

The Adventure Continues .... 5. Freewill v Predestination. (Combat TMI)

Since the last session, I have been concentrating on streamlining the code to improve performance ... again. It has come to light that what works well in a SP game does not always translate to a MP game. In particular, if a player has a GUI open that is making "Update" calls, that GUI instance may work well for one player having it open, but as soon a you have more players accessing the same GUI at the same time, the number of update calls from any such GUI requires paring back or else we end up with a Too Many Instructions (TMI) problem, railroading the server to a quick termination. We experienced this in two cases last time we played, one with the (altered) Character Sheet GUI, and the worst case with the home brew Targeting GUI, which was the last thing we tested before ending the session. Although, the TMIs with that GUI would have insisted such anyway. More on this below. On the back of this experience, I am going to look at the remaining XML scripts and try to alter/fix any remaining scripts that may cause a similar MP issue with TMIs.

Other than that, the session went reasonably smoothly for the 1 hour 37 minutes of unpaused play that we had. (We also started slightly later.) You can catch up on the heroes actions further below. Also note, there are a couple of GAME UPDATES of which to be aware.

The List of Fixes

1) CHARACTER SHEET (TMI): This was our first experience of a GUI opened by more than one player at a time causing an issue. A quick check of the characterscreen.xml showed the alteration I had made for displaying temporary hit points was the likely cause of the issue. It worked using an OnUpdate call without any restriction to that update, meaning it was making the same server call dozens, if not hundreds of time per second. Furthermore, the script it called, gui_fixtemp, had no limit set to the number of times the call would update the GUI, which meant the GUI was calling and updating many times for each player that had it open. The XML now has a limit set to a call only every 0.5 seconds. Furthermore, that call does nothing now, unless there is a need to update the GUI. This problem had escaped our attention until now, because each player was unlikely to have the same GUI open at the same time. However, the players had just leveled and so both players were now trying to look at their Character Sheets at the same time. To workaround the problem on the night, we simply did one player at a time.

2) DOOR LOCKED PCS INSIDE: This problem arose due to a door heartbeat check no longer allowing a DM presence to keep a door unlocked. However, the code was wrong in another way too, so it has now been fixed to ensure interior doors do not lock (if not locked) anyway. Workaround: As a DM was present, the DM simply unlocked the door to allow the players to exit.

3) TACTICAL GUI FEEDBACK (TMI): As the session drew to a close, I asked my players to consider performing one last action that we knew would involve combat, so that I could test that the new TARGETING GUI would work in a MP session as well as it did in SP. (I had not yet been able to test this in a MP environment.) I am glad we tried it, as the test showed there was a problem: the game stuttered and ground to a halt. At least now I could examine the issue and have it fixed before the next session. It turned out the problem was similar to the Character Sheet problem (item 1 above), but much worse. In this case, it was due to the altered noticewindow.xml that was being automatically called at the same time for all players (3 in our case) and had an OnUpdate set at maximum (no limit) to call a reasonably large script (involving multiple loops) dozens of times per second for every player. It was no wonder that the server ground to a halt and crashed. As I stated above, this kind of multiple call may work for a SP game, but it is just too much in a MP game. This is what I did to fix the problem: Firstly, as the main script call (gui_updatetargets) involved loops for all PCs anyway, there was little point calling the same script for every player (to do exactly the same thing each time), and so I restricted the called script to work from the host player only. Secondly, I limited the OnUpdate call to 0.1 seconds (meaning to call only every 0.1 seconds). The combination of these two fixes alone limited the instructions for the TARGETING GUI feedback by hundreds of times. Furthermore, I put in place some other checks that helped alleviate script execution when it was called anyway. The result: A smooth operation. (I have yet to test the system with the player on WAN, but testing locally has shown good results.)

4) MISSING HOLY BOOK: When Graham rested his PCs at the Bloated Buckle, one of his PCs (Elana the cleric) failed to learn any prayers, even though they had paid for expensive accommodation. It turned out that the cleric had "lost" her holy book. It was no longer in her inventory. My suspicion at this stage is that this was related to the COMPANION and their equipment bug on a player leaving the game. (See last blog post.) This was fixed with the last update, but Elana's missing holy book may have been collateral damage with respect to that bug and the fix at the time. Now that the companion equipment bug has been fixed (and Elana was given a new book by the DM), that problem should (hopefully) be gone. On reloading with the DM only (as a test), the cleric appeared to still have her book then. Next session we will know for sure.

5) COMPANION FOLLOW (INTERCEPTED): During some testing, I discovered there was a problem with companions following the correct player if both players controlled more than one PC. This had not been noticed prior to my own testing, as my wife (up to now) had only ever been playing a single main PC, and only Graham controlled more than one companion. The problem was due to variables NOT accommodating a MP environment. I have addressed these now and will try to locate situations where variables should also be updated to accommodate a MP environment. (My own MP testing is limited to a MP environment without a DM as host, which means I do sometimes miss MP issues depending on how I am testing at the time.)

6) OTHER MINOR STUFF: A TYPO was fixed in the Death and Raising rule. The DM calendar did not update immediately from party resting, but did on the hour. A fix has been applied but not yet tested.

Game Updates

1) AUTO-PAUSE REWORDING: The Main Menu currently has "AUTO PAUSE IF ATTACKED". This will be changed to "AUTO PAUSE IF ENEMY SENSED". This is because it more accurately describes the situation of the game pausing on enemy contact rather than any actual attack. i.e. The game can and often does pause before the player is actually aware of what the PCs have perceived. In such situations, the player may need to allow the game to be unpaused until the beginning of another round before they can target or take any action. (See next update.)

2) NO PAUSE COMBAT ROUND: If a player uses the campaign's Tactical Turn-Based Combat System, the game will now NOT allow additional pausing between combat rounds. i.e. Once the player has released the paused action, the game will not be able to be paused again until the six second round has completed, at which time the game will automatically pause itself. NB: This only applies when a player is using the Turn-Based system, which is automatically entered if they use the "AUTO-PAUSED IF ENEMY SENSED" option. (See above.)

The Heroes Return To The Bloated Buckle For A Night's Rest

The Adventure Continues ... 5. Freewill v Predestination

Did we choose to come here, or was it always meant to be?

NB: Contains spoilers for Option 1 background.

Tired as they were, the heroes were fascinated by the scriptures they found around the Sanctuary of Boran. They discovered four ancient texts that spoke of an old argument of the different religions that discussed whether one was in control of their own actions or had always been destined to carry them out. There were the Sovereignites who believed in predestination and the Kingdomites, who believed in freewill.

Shortly after musing over the topic of freewill versus predestination, Helden picked up yet more texts in a nearby bookcase. One spoke of the horrendous disease called The Scourge, which caused living beings to turn into what resembled the undead. The second book went into details about a substance called the Life Essence and discussed the nature of good and evil. It was yet another fascinating read and one that nearly caused division in the party, had not Threska decided that the rest of the party may be right after all, and determined to take on board a change of religion. A rare thing indeed to witness such a change of heart in a person. The heroes decided they would aim to be Channelers, an action that asserted goodness in nature. However, in the light of what they had just been reading regarding freewill versus predestination, there was more than one hero that paused just a moment to consider whether it really was their choice or something predestined?

It was approaching midnight by the time the heroes decided to return to the Bloated Buckle and turn in for the night. The group were already quite fatigued, and Orechin, who had already locked up the sanctuary for the night, had to unlock the door before seeing them out. (See item 2 fix above.)

As the heroes made their way to the inn, they heard a scream. It was a blood-curdling sound that sent their hearts racing, and they paused briefly deciding whether to investigate it or not. After all, they were truly tired and did not want to run the risk of falling foul of night crime while in such a state. Then a voice in their conscience alerted them to the fact that they were supposed to be the heroes, and maybe it was their place to investigate. Clearly, it sounded like somebody was in need of help. So, they made the decision to run towards the scene. They arrived just at the same time as one of the guards turned up and all witnessed that a male figure had been murdered! 

Helden was a little hesitant to get involved and wanted to get back to the inn, but Myara was curious and wanted to investigate a bit more. She examined the body and found a picture of a woman on it. The guard quizzed Myara about it, but said they could hang onto it if they would try to do a bit more investigating, and report back to Taloy or Orechin on their findings. The heroes agreed.

Eventually, the heroes did make it back to the inn, and Myara wasted no time in quizzing both Karl and Sandy about the girl in the picture. Karl had not recalled seeing her (after a little persuasion to talk about it), while Sandy was reasonably certain it was Sophie, the daughter of Kathy, the trader at the Apothecary. She said to check with Taloy, which when they did, appeared to confirm this was quite possible. However, Taloy was reluctant to speak about her due to the way she had only recently died herself under suspicious circumstances. He recommended that they speak with Orechin, as he dealt with her death.

So, as the heroes turned in for another night at the local inn, they had managed to gather more tasks under their belt. And as the heroes settled down for the night, Myara's thoughts went to solving the murder mystery, Karasten wondered more about the Arcaene Lore spells he had read about in the book that the heroes bought from Orechin, Helden considered and imagined himself taking up a little crafting, and Elana thought long and hard about whether she was making the decisions in her life ... or whether somebody else really was controlling her actions. In all, every party member had their own reason to start afresh the next day ... as long as their thoughts did not distract them from sleeping.

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

There were also a couple of questions raised about the mechanics, which I will answer for the record here too:-

1) When Do Henchmen Level? Henchmen level at a rate of a level or two behind the PC they follow.

2) What About the Level of Late Comers? If a companion or henchman is asked to leave the party: at the next time they are asked to join, they will level (gain experience) to a comparable level to the party average. The player can then level that character if required.

3) Automatic Storage of Keys: Every player in a MP game can own a key ring. The same is true of any auto-storage item. (Auto-storage items place items they carry automatically in them when acquired. E.g. If a player has one of their PCs pick up a key and any one of their PCs owns a key ring, the key will automatically be placed into the key ring item.) Note, however, items passed from player to player are NOT automatically placed into such containers and must be done so manually.

Sandy Speaks To the Heroes About Sophie, The Girl In The Picture

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.