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.)
As usual, there is more to read at the blog in the synopsis where you can catch up on how the heroes did in the last session … https://worldofalthea.blogspot.com/2018/12/the-adventure-continues-5-freewill-v.html
I will also endeavour to try to upload the latest version (v2.15) as soon as I have gone over the code one more time looking for other potential GetAPlayer issues (MP variables) and OnUpdate instances (in XML code) that may potentially cause other TMI problems. Once I have uploaded it, I will update this post with the link. Here is the latest v2.15: https://neverwintervault.org/project/nwn2/module/scroll (Very much worth the download as many improvements to the code have been made to improve performance, especially with MP game.) NB: I just had to upload v2.15 again, as the ripped scroll puzzle had broken. This is now fixed in the new version of 2.15b now uploaded. (Apologies to the one person who may have downloaded the v2.15 faulty version.)