Jump to content


Photo

Another stutter thread, please help


  • Please log in to reply
29 replies to this topic

#1 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 02 August 2009 - 04:51 PM

EDIT: Please see edits for progress so far in clearing up what is causing the stutter.

Hi all,
So I have recently had my game start to stutter very badly.
Now I'm not an idiot so I have checked the following:

1) Biffing - I have 40MB in my override folder, everything else has been biffed.
2) Defrag - defragged the hard drive
3) Bottomless bags of holding - in my test save to try to get rid of stuttering I dismissed all my NPCs, dropped all my bags and items and CLUAed to another location and rested. I have nothing on me, am wearing nothing, and the only bags are in the Rod of Refuge place and in random locations in Athkatla. I also cleared my cache so it wouldn't have to hold onto them.
4) NPCs - I dismissed all of them. I even killed my familiar.
5) Ambient sounds - turned off.

So here I am, naked, no items or status effects, in some random location (Order of the Radiant Heart, as it happens) with all my bags and things far from he, and I am still stuttering.

EDIT: I notice in Shadowkeeper I have a large number of State Flags and Affects listed, and of course a massive pile of Global Variables
EDIT 2: At the same time, I have started noticing battle music appearing much more often, when there are no enemies around for certain.
EDIT 3: It is definitely my baldur.bcs, (506kb, as I am runing the "tactical" install of the BWP) but the fact that it remains while I have no items or NPCs should help narrow it down.
EDIT 4: Working on finding where this happens. It seems to happen shortly after I go to the Windspear Hills for the first time.
Things of note that happen there (apart from the regular BG2 events):
1) Getting the Golden Globe aspect of the Ajantis BG2 mod
2) Meeting General Chang (unknown mod) and a few odd dwarves at the entrance to Firkraag's dungeon.
3) Rukh was a blue circle, didn't speak or attack me.
4) Meeting Lilith and co. from the Dark Ritual mod
5) Finding Sheena, though she doesn't speak to me because I have not killed Firkraag yet.

I have been testing this by going to my regular save games and getting rid of all other stutter by undressing, dismissing NPCs etc.
It seems that just before I go to Windspear, I can get rid of everyone & everything and have perfectly smooth play. At the point where I am freeing Garren's son, if I do the same I still have severe stutter.

EDIT 5: I think it might relate to the Golden Globe. Things get worse as they go along while in Firkraag's dungeon, but after the guy from the Ajantis mod gives me the globe, they definitely get worse again.

Please help!

Cheers
Vandervecken

Attached File  baldurbcs.txt   506.57K   727 downloadsAttached File  Weidu.log   65.55K   221 downloads
v2.1

Edited by Vandervecken, 02 August 2009 - 06:20 PM.


#2 Kaeloree

Kaeloree

    Head Molder

  • Administrator
  • 9198 posts

Posted 03 August 2009 - 12:07 AM

I don't understand why it has to be baldur.bcs that's causing the lag; while you do have a very large file, that doesn't necessarily mean its the cause.

A stutter generally occurs because a script loop cannot close; this could be baldur.bcs, sure, but it could also be any number of other scripts. Hopefully someone with more knowledge on the subject than I can help you.

#3 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 03 August 2009 - 12:51 AM

I don't understand why it has to be baldur.bcs that's causing the lag; while you do have a very large file, that doesn't necessarily mean its the cause.

A stutter generally occurs because a script loop cannot close; this could be baldur.bcs, sure, but it could also be any number of other scripts. Hopefully someone with more knowledge on the subject than I can help you.


Thanks for taking a look.
One of the things I tried, referenced in thread:
http://www.shsforums...;hl=stutter bug
is to take your baldur.bcs and simply start deleting large chunks of it.
When I cut out either the top or bottom halves of the baldur.bcs, the stutter went away completely.
That's why I think the problematic script is in there.
I'm hoping someone will be able to help me find the problem script(s).

What kind of scripts can there be except the baldur.bcs?
There are NPC and Area scripts - my stutter occurs with no npcs, items, and in several different areas, though it gets noticeably worse as I progress in Windspear.
Are there any other scripts that run constantly?

#4 Ranadiel

Ranadiel
  • Member
  • 174 posts

Posted 03 August 2009 - 02:09 AM

What kind of scripts can there be except the baldur.bcs?
There are NPC and Area scripts - my stutter occurs with no npcs, items, and in several different areas, though it gets noticeably worse as I progress in Windspear.
Are there any other scripts that run constantly?

If I'm not mistaken, there are a lot of scripts that run constantly(which I guess is sort of the problem). I know that one thing that I've seen people mention as being the source of lag like this is having too many unresolved quests. I don't know how you would go about fixing that though other than completing quests.

#5 Azazello

Azazello

    The Anti-Spammer

  • Staff
  • 1912 posts

Posted 03 August 2009 - 03:45 AM

I don't understand why it has to be baldur.bcs that's causing the lag; while you do have a very large file, that doesn't necessarily mean its the cause.

A stutter generally occurs because a script loop cannot close; this could be baldur.bcs, sure, but it could also be any number of other scripts. Hopefully someone with more knowledge on the subject than I can help you.


Thanks for taking a look.
One of the things I tried, referenced in thread:
http://www.shsforums...;hl=stutter bug
is to take your baldur.bcs and simply start deleting large chunks of it.
When I cut out either the top or bottom halves of the baldur.bcs, the stutter went away completely.
That's why I think the problematic script is in there.
I'm hoping someone will be able to help me find the problem script(s).

In that thread, editing the baldur.bcs was an experiment, not a recommendation--and certainly not something that should be done by those who aren't experienced with how scripting works.

Have you tried Jarno's recommendations? Also, the bigg's How to gather clues when debugging stuttering ?

"I gladly simp for jastey" -- Aza
==========================================================
"You ever notice that "What the hell?!" is the answer to just about everything?"
==========================================================

"Girls are like phones, they like to be held and talked too, but if you press the wrong button, you will be disconnected!" DJ Nikodemus
================================================================
Community Contributions
* Level 1 NPCs * gMinion: expanded TP2 for MegaInstalls * PSM (PSQM): expanded scripts for Melanthium * Shar Nadal (DSotSC-BGT) revision * non-detectable Cloak of Non-Detection ?? * Weimer's-Tactics: revised TP2 for MegaInstalls * a directory of Mega-Installation Guides *

   
   
   


#6 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 03 August 2009 - 05:43 AM

Also, the bigg's How to gather clues when debugging stuttering ?

This should show what's the problem. So to use it Vandervecken need to take a .txt file, rename it as setup-stutter_test.tp2 and then copy the exact content of this code box into it and save it as.
BACKUP ~stutter_test/backup~
AUTHOR ~Vandervecken~

BEGIN ~Test stuttering~
COPY_EXISTING ~baldur.bcs~ ~override~ //hi hi. 
	SET x = 0 - 1
	DECOMPILE_BCS_TO_BAF
		REPLACE_EVALUATE ~\(RESPONSE #[0-9]+\)~ BEGIN
						x += 1
				END "\1
		ActionOverride(Player1,DisplayString(Myself,~Running block %x% of %SOURCE_RES%.BCS~))"
	COMPILE_BAF_TO_BCS
Then he needs to make a folder called "stutter_test" and then copy the WeiDU.exe from the game directory and rename it as setup-stutter_test.exe and then run it, it should take a few seconds to finish the WeiDU window action and then when the game is runned and the save is loaded, the text box should give new lines that reffer to the problemic lines in the baldur.bcs file, at least if they show up multiple times inside a few seconds... then Vandervecken need to copy the info to a paper and then post them in a post so we can look at them...

Now, if there is no lines shown in blue that run constantly, it only means that you have diacnosed the problem wrong, and you need to add the correct .bcs file names after the COPY_EXISTING ~baldur.bcs~ ~override~ //hi hi
~filename.bcs~ ~override~ ... lines so you can see their content. What I would suggest, is to add the ar1200.bcs, ar1201.bcs, ar1202.bcs and ar1203.bcs as those are the area scripts in the Windspear Dungeons... so it looks like this:
BACKUP ~stutter_test/backup~
AUTHOR ~Vandervecken~

BEGIN ~Test stuttering~
COPY_EXISTING ~baldur.bcs~ ~override~ //hi hi. 
		~ar1200.bcs~ ~override~ 
		~ar1201.bcs~ ~override~ 
		~ar1202.bcs~ ~override~ 
		~ar1203.bcs~ ~override~ 
	SET x = 0 - 1
	DECOMPILE_BCS_TO_BAF
		REPLACE_EVALUATE ~\(RESPONSE #[0-9]+\)~ BEGIN
						x += 1
				END "\1
		ActionOverride(Player1,DisplayString(Myself,~Running block %x% of %SOURCE_RES%.BCS~))"
	COMPILE_BAF_TO_BCS

Edited by Jarno Mikkola, 03 August 2009 - 06:52 AM.

Deactivated account. The user today is known as The Imp.


#7 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 03 August 2009 - 10:22 AM

Thanks all,
I had seen the debug thread but didn't know how to make tp2 files, thought it was mostly for modders debugging their specific mods.
Thanks to Jarno's instructions I have found the block, but I'm not sure which script it is.
The stuttering game is constantly running Block 1557.

The following analysis was performed on the baldur.bcs that was extracted from the game using NearInfinity.
The baldur.bcs that was put into my override as a result of the stutter_test is twice as big but not notepad readable. I attach it here.
Attached File  baldur.bcs   1.13MB   460 downloads

I went into NearInfinity and refreshed the tree, found baldur.bcs and output it to a text file.
Attached File  baldurbcs2.txt   659.84K   984 downloads

It seems to have started considerably before Windspear though, maybe just now became really noticeable.

Edited by Vandervecken, 03 August 2009 - 10:41 AM.


#8 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 03 August 2009 - 09:54 PM

I have found the first bug. It comes from this set of commands:

IF
Global("RandallJoin","GLOBAL",4)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,327715)) // Running block 1554 of baldur.BCS
SetGlobal("RandallJoin","GLOBAL",5)
SetGlobalTimer("RandallQuest","GLOBAL",FIVE_DAYS)
END

IF
GlobalTimerExpired("RandallQuest","GLOBAL")
Global("RandallJoin","GLOBAL",5)
!Global("Chapter","GLOBAL",4)
!Global("Chapter","GLOBAL",5)
!Global("Chapter","GLOBAL",7)
!AreaType(CITY)
AreaType(OUTDOOR)
!AreaCheck("AR2500")
!AreaCheck("AR1901")
XPGT(Player1,250000)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,327716)) // Running block 1555 of baldur.BCS
Wait(2)
SetGlobal("RandallJoin","GLOBAL",6)
CreateCreatureObjectOffScreen("RanNec1",Player1,0,0,0) // Necromancer
CreateCreatureObjectOffScreen("RanSke1",Player1,0,0,0) // Strong Skeleton
CreateCreatureObjectOffScreen("RanSke2",Player1,0,0,0) // Strong Skeleton
CreateCreatureObjectOffScreen("RanSke3",Player1,0,0,0) // Strong Skeleton
CreateCreatureObjectOffScreen("RanSke4",Player1,0,0,0) // Strong Skeleton
CreateCreatureObjectOffScreen("RanSke5",Player1,0,0,0) // Strong Skeleton
CreateCreatureObjectOffScreen("RanSke6",Player1,0,0,0) // Strong Skeleton
END

IF
Global("RandallJoin","GLOBAL",6)
!Dead("Randall")
Dead("RanNec1") // Necromancer
CombatCounter(0)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,327717)) // Running block 1556 of baldur.BCS
SetGlobal("RandallJoin","GLOBAL",7)
END

IF
Global("RandallJoin","GLOBAL",7)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,327718)) // Running block 1557 of baldur.BCS
ActionOverride("Randall",StartDialog("RandallJ",[PC]))
END

IF
Global("RandallJoin","GLOBAL",8)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,327719)) // Running block 1558 of baldur.BCS
SetGlobal("RandallJoin","GLOBAL",9)
SetGlobalTimer("RandallQuest2","GLOBAL",TEN_DAYS)
END


Somehow we got on this train while Randall was NOT in the party. I had dropped him off at some point I'm not sure of.
I do now recall that I have kept having necromancer encounters.
Attempting to initiate conversations with people who aren't there causes difficulties.
I went to see Randall and let 1557 fire, and now it has cleared.
I can't get randall to join me (he has nothing to say to me) but I'm sure that's not too hard to force an NPC into your party.
If not, I can always go back and see him in 10 days, or manipulate the variables. This is a bug for the RoT team.

However, I still have stutter, and it still persists despite removing all items, npcs, and transporting to a random area from BG1.
Currently no scripts seem to be firing with a block number.

Definitely getting somewhere though.

jarno - you said add appropriate .bcs files.
If I am in a random area from BG1 (ie no appropriate script is likely) and have no current npcs or items, what other bcs files would be possible? Can I add all bcs files somehow? ~*.bcs~ ~override~ doesn't work.
It would be slow but at least I would see what is firing.

Additionally, despite the fact that nothing from baldur.bcs is now firing, I still get rid of all stutter whenever I replace it with that fake empty baldur.bcs.

Edited by Vandervecken, 03 August 2009 - 10:59 PM.


#9 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 04 August 2009 - 05:42 AM

However, I still have stutter, and it still persists despite removing all items, npcs, and transporting to a random area from BG1.
Currently no scripts seem to be firing with a block number.

Definitely getting somewhere though.

jarno - you said add appropriate .bcs files.
If I am in a random area from BG1 (ie no appropriate script is likely) and have no current npcs or items, what other bcs files would be possible? Can I add all bcs files somehow? ~*.bcs~ ~override~ doesn't work.
It would be slow but at least I would see what is firing.

Well you could replace all the .bcs lines with this:
COPY_EXISTING_REGEXP ~.*\.bcs~ ~override~
Or at least so I would remember it to have gone :unsure: :unsure: :unsure: :unsure: . If the mod is installed, it should give you every reference there is in the game of the happenings surrounding you, so it will give you a lot and lot and lot of info and some might be false positives.
So basically when you have uninstalled the previous mod by starting the setup-stutter_test.exe and pushing the u ... you correct the setup-stutter_test.tp2 so it looks like this:
BACKUP ~stutter_test/backup~
AUTHOR ~Vandervecken~

BEGIN ~Test stuttering~
COPY_EXISTING_REGEXP ~.*\.bcs~ ~override~ 
	SET x = 0 - 1
	DECOMPILE_BCS_TO_BAF
		REPLACE_EVALUATE ~\(RESPONSE #[0-9]+\)~ BEGIN
						x += 1
				END "\1
		ActionOverride(Player1,DisplayString(Myself,~Running block %x% of %SOURCE_RES%.BCS~))"
	COMPILE_BAF_TO_BCS
You install it and play the game, look for repeating lines, and then log the line numbers and .bcs names. This will mostlikelly make the game unplayable as the dialog screen runs it's magic all the time, but that doesn't really matter as you can then uninstall the stutter test once you have solved the existing issues...

PS, post the list of line numbers and bcs names so we can take look too.

Edited by Jarno Mikkola, 04 August 2009 - 05:43 AM.

Deactivated account. The user today is known as The Imp.


#10 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 04 August 2009 - 10:46 AM

Here is the offending script, running constantly:

BPMAG12A.BCS
IF
!Detect(NearestEnemyOf(Myself))
!HPPercentLT(Myself,100)
!Global("inafight","LOCALS",1)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,388408)) // Running block 135 of BPMAG12A.BCS
NoAction()
END

It seems to do absolutely nothing, all the time.
It is running on my later game test case, where I have divested of everything and everyone.
Why would you have scripts with no action in them?
Can I safely remove it, and if so, how?

Another culprit?
I notice that at an earlier save, when I am in a dangerous place but no enemies are around, the script that constantly runs is:

BPGOLIRO.BCS
IF
ActionListEmpty()
!Range(NearestEnemyOf(Myself),5)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,376846)) // Running block 3 of BPGOLIRO.BCS
EquipRanged()
SelectWeaponAbility(SLOT_WEAPON,1)
SelectWeaponAbility(SLOT_WEAPON1,1)
AttackReevaluate(NearestEnemyOf(Myself),15)
END

Moving to a safe location stops this script.
This seems to be NPCs trying to equip ranged weapons.
It attaches to all the NPCs except CHARNAME. When I move them all out of the unsafe location it stops (from Academy of Kuldin (CtB) to the Ulgoth's Beard Tavern (TotSC)). It occurs despite their AI scripts being set to None.
NPCs in the current party are Drizz't and Wulfgar (Region of Terror), Yoshimo, Kachiko (Tortured Souls), and Jaheira. Drizz't, Wulfgar and Kachiko do not have any ranged weapons in their weapon slots. Jaheira and Yoshimo are already using theirs (with case/quivers of plenty).
At this earlier point in the game, the BPMAG12A script does not appear to be running. Switching to Ulgoth's Beard shows a noticeable speed improvement.
When I move all those NPCs away from the academy, leaving just myself, the only script running (which has a significant effect on speed) is this one:
IF
NumInParty(6)
LevelPartyLT(49)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,340866)) // Running block 21 of AR3544.BCS
SetGlobal("CbParty6Cat1","MYAREA",1)
END

which perhaps should include in the IF condition a check on Global Variables, but this probably has to do with upgrading the enemies in the area. Either way it wouldn't affect the global game, just possibly bad coding on CtB's part.

Cheers
Vandervecken

Edited by Vandervecken, 04 August 2009 - 10:48 AM.


#11 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 05 August 2009 - 02:47 AM

Here is the offending script, running constantly:

BPMAG12A.BCS
IF
!Detect(NearestEnemyOf(Myself))
!HPPercentLT(Myself,100)
!Global("inafight","LOCALS",1)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,388408)) // Running block 135 of BPMAG12A.BCS
NoAction()
END

It seems to do absolutely nothing, all the time.
It is running on my later game test case, where I have divested of everything and everyone.
Why would you have scripts with no action in them?
Can I safely remove it, and if so, how?

That's an enemy mage script that's perhaps invisible, sees no party members, and having less than 100% hitpoints doesn't want to reveal themselves, thus takes no action... or it's run by a neutral character. Killing that character will remove the lag...

Deactivated account. The user today is known as The Imp.


#12 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 05 August 2009 - 09:05 AM

Here is the offending script, running constantly:

BPMAG12A.BCS
IF
!Detect(NearestEnemyOf(Myself))
!HPPercentLT(Myself,100)
!Global("inafight","LOCALS",1)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,388408)) // Running block 135 of BPMAG12A.BCS
NoAction()
END

It seems to do absolutely nothing, all the time.
It is running on my later game test case, where I have divested of everything and everyone.
Why would you have scripts with no action in them?
Can I safely remove it, and if so, how?

That's an enemy mage script that's perhaps invisible, sees no party members, and having less than 100% hitpoints doesn't want to reveal themselves, thus takes no action... or it's run by a neutral character. Killing that character will remove the lag...


Ok, makes sense, but I can't find him.
I load up a save game where I am in Ulgoth's beard tavern. It is a tiny place, I load up True Seeing, I rest, I wander around, I kill every character in there with Ctrl-Y. No-one's there.
I killed the cache before doing it, so it shouldn't be in any other area, but it persists.
How can I find out more about who is running this script and where?

Cheers
Vandervecken

#13 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 05 August 2009 - 10:09 AM

Ok, makes sense, but I can't find him.
I load up a save game where I am in Ulgoth's beard tavern. It is a tiny place, I load up True Seeing, I rest, I wander around, I kill every character in there with Ctrl-Y. No-one's there.
I killed the cache before doing it, so it shouldn't be in any other area, but it persists.
How can I find out more about who is running this script and where?

Yeah, but you make the assumption that the creature needs to be in your 'visible sector' of the map that you occupy, but some maps are interconnected to each others, and so all of their creature scripts are run at the same time.

Deactivated account. The user today is known as The Imp.


#14 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 05 August 2009 - 10:22 AM

That does make sense.
However, the script follows me as I CLUA jump from Ulgoth's beard tavern, to the 2nd floor of Ramazith's Tower, to the Demonknight chamber of Durlag's tower.
Just about anywhere I go.
What map could be interconnected with all those?

EDIT:
Actually I think CLUA-ing around the place doesn't wipe previous areas from the buffer, as opposed to regular travelling.

EDIT 2:
I have located another save game in which the same script is running but I am much earlier in the game. It comes from BPMAG14A.BCS.
Same script, same frequency, but this time the stutter being caused is MUCH less. For reference I am in the guard barracks in Riativin (The Darkest Day).
Going even further back, my save at the start of BG 2 (I am using BGT) runs smoothly even though it too has a Block 135 running (this time of BPMAG8.BCS).

So it seems it's not really the script that is the problem. The stutter problem has been slowly worsening.
Could it be that it has to do with the accumulation of Global Variables, which causes the scripts to run slower even when they are not being executed? If you suddenly have to search through masses of global variables for each script with an IF, this might slow things down over time.
I tried to find a way to compute the number of global variables, but Shadowkeeper and NI let you look at them, not count them.
On the other hand, I have no shortage of GlobalVariables in my save from Chateau Irenicus, but that save runs smoothly.

So it is clearly not the response aspect of the script itself that is causing the stutter.

In summary - Yes, Randall was a definite problem, but there is something underlying here.

Thanks for your help so far Jarno. Hopefully we can lick this thing.

EDIT 3: Trying now to take a look at the difference between an early save in Chateau Irenicus when there is no stutter (it's just me and Imoen, saved at the very start of the game), and my late save with no items, npcs etc.
Difference 1:
In Near Infinity, loading my save games, and looking at Stats/Effects on CHARNAME
86 in the late save game (mostly Modify Script State (282)'s), versus 24 in the start save game. Also in the late save game I seem to have acquired DAKKON1.BCS as a "Race" script.
Difference 2:
A lot more areas in the Baldur.sav for the late game save, as expected. Still large numbers of them in the start game save (it's BGT after all).

Edited by Vandervecken, 05 August 2009 - 01:27 PM.


#15 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 06 August 2009 - 09:04 PM

I have managed to shake myself of all scripts, and the stutter remains. I am alone, in a small area (Monzuma's Cave entrance), with no items, and stuttering like crazy.
I emptied my Cache, and my HDD is pretty well defragged.
I tried modifying saves to remove all Innate abilities, and all Status effects, no help.
What could cause one to stutter like this, with no scripts executing?
And yet, if I put the fake baldur.bcs which is empty in, the stutter disappears.
If baldur.bcs is still the problem, could it be because an IF statement is having problems?
If so, how would we find out?

I think if we can solve this we can learn much!

Additional Info:
I have started using WeiDu/DLCTEP to directly modify the baldur.bcs. Shrinking the file does have improvement on the stutter. Further, if I keep the first 7500 or so lines of baldur.bcs, the stutter improves significantly (though still not smooth). If I keep the last 7500 or so lines, stutter improves hardly at all.
In other words, this isn't general. Since no scripts are executing, it must be IF statements that are a problem. But currently, I only have my eye for stutter to help me narrow down what is obviously more than one problematic IF statement.
Does anyone know a way to insert for example timing information r some way of detecting which IF statements are taking way too long?
Note:
Removing all global variables with DLCTEP also removes the stutter.
Maybe it's not that a Globalvariable is set improperly, maybe it just takes AGES to run through all those IF statements.
But if that's the case what can be done? Surely it doesn't take that long to run though a save game with a couple hundred KB devoted to global variables. But if this is the case, there were 150KB worth of Global Variables in the save I had at the start of BG2, and only about 280kb of them in my stuttering save. It's not like it massively ballooned. The difference shouldn't be that severe.

Edited by Vandervecken, 06 August 2009 - 11:38 PM.


#16 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 07 August 2009 - 12:20 AM

If baldur.bcs is still the problem, could it be because an IF statement is having problems?
If so, how would we find out?

Well, we would adjust the previous method somehow...

Darn, it needs to be have been with:
COPY_EXISTING_REGEXP GLOB ~.*\.bcs~ ~override~
The GLOB is important... so the whole code is actually:
BACKUP ~stutter_test/backup~
AUTHOR ~Vandervecken~

BEGIN ~Test stuttering~
COPY_EXISTING_REGEXP GLOB ~.*\.bcs~ ~override~
	SET x = 0 - 1
	DECOMPILE_BCS_TO_BAF
		REPLACE_EVALUATE ~\(RESPONSE #[0-9]+\)~ BEGIN
						x += 1
				END "\1
		ActionOverride(Player1,DisplayString(Myself,~Running block %x% of %SOURCE_RES%.BCS~))"
	COMPILE_BAF_TO_BCS
Now it might give you a little bit more info... let's hope. And BTW, never load a save that has been saved after the stutter test... so uninstall it first.

I would also advice to making a --change-log from the original baldur.bcs ... the link to the making of it is in my signature. This is cause I see a few these in the baldurbcs.txt:
IF
	Kit(Player6,trueres)
	Class(Player6,MAGE)
THEN
	RESPONSE #100
		ActionOverride(Player6,AddKit(truerestF))
END
And I see no reference to them in the WeiDU.log at least to my understanding... that's bad.

Edited by Jarno Mikkola, 07 August 2009 - 12:44 AM.

Deactivated account. The user today is known as The Imp.


#17 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 07 August 2009 - 09:11 AM

First of all, here is the ChangeLog attached.

Attached File  log1.txt   4.13K   233 downloads

The addition of GLOB hasn't been giving me any more info I'm afraid. What does it do?

I think my best guess atm is that there are too many Global Variables. I don't know how many because I haven't found a tool to easily extract and edit them. Shadowkeeper and DLTCEP/WeiDu only allow you to clear them or edit one by one. Something to extract them all to a text file would be good.
By clearing them and comparing save game files, it seems to me that in my stuttering save they occupy about 280KB. In my non-stuttering save they occupy about 150KB.
Removing all Global Variables removes all the stutter, as does replacing baldur.bcs with an empty fake baldur.bcs.
However, given that my non-stuttering early save is operating with exactly the same baldur.bcs, it's probably the Global Variables' fault.
Is there a tool to more powerfully examine Global Variables?

Additionally, the GLOB seems to have affected printout of baldur.bcs.
With the old stutter-test I would get the 1557 printout from a save which still had the Randall problem. In the new stutter-test, this printout doesn't occur. Since the problem def. seems to be baldur.bcs, and since the GLOB addition seems to produce no helpful information, I am going back to the old stutter-test.

I have a test in mind, and I will post when I have done it.

Edited by Vandervecken, 07 August 2009 - 11:42 AM.


#18 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 07 August 2009 - 04:30 PM

I am trying to change the baldur.bcs file in oder to test something, using WeiDu and DLCTEP.

I start with a bcs file which has items like:
ActionOverride(Player1,DisplayString(Myself,348552))

When I Save & Compile with DLCTEP they turn into:
ActionOverride([INANIMATE.21],DisplayString([INANIMATE.HUMANOID],348552))

I have made no changes, I just opened it, then saved and compiled it. What can I do to DLCTEP or another compiling tool to make them recompile exactly how they were?

EDIT: Sorted this problem by using the WeiDu compiler, not the internal compiler.
What I attempted to do was to insert this:
IF
Global("TEST_VAR","GLOBAL",1)
THEN
RESPONSE #100
ActionOverride(Player1,DisplayString(Myself,348552))
SetGlobal("TEST_VAR","GLOBAL",1)
END

at the start of baldur.bcs.
I tested on 3 saves, 1 where TEST_VAR is not defined, one with "1" and one with "0".
Both zero and not defined showed stuttering, but the one with "1" was smooth.
This appears to be because as soon as it fines an IF that registers true, it executes the response and starts again at the beginning.

Then I put it at the end of baldur.bcs. This allowed me to time baldur.bcs and calculate simply how long it takes the script to execute.
To execute 10 times took 5 seconds at the start of BG2, 14 seconds at the heavy stuttering stage.
If I can mass edit global variables I can make a more accurate comparison.

Another thing I looked at was whether baldur.gam is being read constantly from disk. It is not. It is written into temp and only read once. I'm pretty sure it is nicely residing in RAM.

Edited by Vandervecken, 07 August 2009 - 05:31 PM.


#19 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 08 August 2009 - 09:48 PM

It looks like about 4000-4500 global variable sin my late game save, about 2000 in my early game save.
Could it be just a numbers game?
I'm working on getting mass control of global variables atm. I would like to test what happens when I remove 50% of the global variables, roughly, what happens to the stutter.
Can anyone else tell me if they have large numbers of global variables and things still run smoothly?

Cheers
Vandervecken

#20 Vandervecken

Vandervecken
  • Member
  • 176 posts

Posted 09 August 2009 - 03:13 PM

A new update.

I have extracted the set of Global Variables. I attach one set from early in BG2, and one from a lot of stuttering.
I had a look for timing variables, and I guessed that anything with a value over 10,000 is a timing variable. There are 96 such variables in the early save (out of 2076 variables), 284 in the late one (out of 4086 total).
Can the presence of 200 more timing variables account for stutter?

However, it does not look like I can copy the new variable set to the save game. At least not yet.

Thoughts?
Vandervecken