Description of the problem
Ok, serious mode on. I have encountered this issue since BWP 9.0 and every time *that* starts I am forced to restart the game/do or do shaman-like things like loading a few other savegames. I am not posting WeiDU log, because, the problem was both in BWP 9.0, 9.1, 9.4, 9,6 standard and now in 10.3 tactical. All mods are from the preset. Actually it can even appear in a lightly-modded or vanilla game, but in later stages. It affects BG1, SoA, ToB, BGT in the same way.
We all know that there are different kinds of stuttering: containers sometimes cause the game to stutter, bugged scripts, a lot of stuff in "override", that weird kind of stuttering which vanishes after loading a few games you played before and so on. Now I am going to discuss a particular kind of stuttering related to a strange state, when regular scripts start executing slower than they normally do.
When you play and *this* kind of stuttering starts, symptoms are following:
- It seems to start after about 10-25 hours of gameplay in SoA. The more mods you have installed, the less it takes to start stuttering.
- The game goes for about 1 second, then freezes for about 0.5 seconds. Goes for 1 more second, freezes for 0.5 more seconds.
- It gradually becomes worse and worse. If I continue playing, it will freeze for 1 second and probably more.
- Modded game especially suffers from such lags, but they can appear in later stages of vanilla too.
- Only happens when the game is unpaused. Everything goes smooth when paused.
- Debugging the scripts shows nothing. It just seems like some scripts/blocks start executing about 100 times slower(actually they can be executed up to 1024 or 2048 times slower).
- The game will run faster if you load earlier savegame.
Reason of such stuttering
GLOBAL variables which are used in various scripts are stored inside a hashmap which is resized only when it's full. When there are many variables and hash table is nearly full, its performance degrades to O(n) instead of average case O(1). As a result under certain point of gameplay, when number of variables is close to 1024/2048 or even 4096, some GetGlobal's will be executed in linear time instead of O(1). And some script variables will be accessed by far longer than the others.
As a workaround you can try this:
Spoiler
If you encounter such kind of stuttering, you can do following steps:
1) Download this archive: Stutter Remover.7z 764bytes 463 downloads
2) Unzip a text file in it anywhere you want. Alternatively you can just copy-paste it from here:
3) Open your baldur.bcs or any other script that is executed with Near Infinity and add contents of "Stutter Remover.txt"(or copy-paste that spoiler) at the end of it. Compile and save your script.
4) Load your stuttering savegame, press ctrl+space and type:
5) If the stuttering disappeared, proceed to step 6). Otherwise try setting other variable blocks:
6) If the stuttering disappeared, DO NOT save your game and DO NOT continue playing it. Re-load the same savegame again instead. If all goes right, after reloading the game there should be no stuttering.
7) If you close the game and launch it again, you'll have to do steps 1-6.
Why this works
The scrips I have attached adds a bunch of dummy variables to the map, forcing to overflow and get rehashed. Each block adds 100 new variables. Script looks like this:
Once the map is enlarged, it will remain with the same size if you load your game again and it will not stutter. However, if you close BGMain, upon launching it again the map will be "stuffed" again and you'll have to repeat this procedure.
Why you should reload your game after executing the script
If you save, all those dummy variables will be added to your savegame globals section. There's nothing lethal in it, but you probably don't want it.
If you encounter such kind of stuttering, you can do following steps:
1) Download this archive: Stutter Remover.7z 764bytes 463 downloads
2) Unzip a text file in it anywhere you want. Alternatively you can just copy-paste it from here:
Spoiler
IF Global("AddVariableBlock0","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock0","global",0) SetGlobal("TempVariable0","global",2) SetGlobal("TempVariable1","global",2) SetGlobal("TempVariable2","global",2) SetGlobal("TempVariable3","global",2) SetGlobal("TempVariable4","global",2) SetGlobal("TempVariable5","global",2) SetGlobal("TempVariable6","global",2) SetGlobal("TempVariable7","global",2) SetGlobal("TempVariable8","global",2) SetGlobal("TempVariable9","global",2) SetGlobal("TempVariable10","global",2) SetGlobal("TempVariable11","global",2) SetGlobal("TempVariable12","global",2) SetGlobal("TempVariable13","global",2) SetGlobal("TempVariable14","global",2) SetGlobal("TempVariable15","global",2) SetGlobal("TempVariable16","global",2) SetGlobal("TempVariable17","global",2) SetGlobal("TempVariable18","global",2) SetGlobal("TempVariable19","global",2) SetGlobal("TempVariable20","global",2) SetGlobal("TempVariable21","global",2) SetGlobal("TempVariable22","global",2) SetGlobal("TempVariable23","global",2) SetGlobal("TempVariable24","global",2) SetGlobal("TempVariable25","global",2) SetGlobal("TempVariable26","global",2) SetGlobal("TempVariable27","global",2) SetGlobal("TempVariable28","global",2) SetGlobal("TempVariable29","global",2) SetGlobal("TempVariable30","global",2) SetGlobal("TempVariable31","global",2) SetGlobal("TempVariable32","global",2) SetGlobal("TempVariable33","global",2) SetGlobal("TempVariable34","global",2) SetGlobal("TempVariable35","global",2) SetGlobal("TempVariable36","global",2) SetGlobal("TempVariable37","global",2) SetGlobal("TempVariable38","global",2) SetGlobal("TempVariable39","global",2) SetGlobal("TempVariable40","global",2) SetGlobal("TempVariable41","global",2) SetGlobal("TempVariable42","global",2) SetGlobal("TempVariable43","global",2) SetGlobal("TempVariable44","global",2) SetGlobal("TempVariable45","global",2) SetGlobal("TempVariable46","global",2) SetGlobal("TempVariable47","global",2) SetGlobal("TempVariable48","global",2) SetGlobal("TempVariable49","global",2) SetGlobal("TempVariable50","global",2) SetGlobal("TempVariable51","global",2) SetGlobal("TempVariable52","global",2) SetGlobal("TempVariable53","global",2) SetGlobal("TempVariable54","global",2) SetGlobal("TempVariable55","global",2) SetGlobal("TempVariable56","global",2) SetGlobal("TempVariable57","global",2) SetGlobal("TempVariable58","global",2) SetGlobal("TempVariable59","global",2) SetGlobal("TempVariable60","global",2) SetGlobal("TempVariable61","global",2) SetGlobal("TempVariable62","global",2) SetGlobal("TempVariable63","global",2) SetGlobal("TempVariable64","global",2) SetGlobal("TempVariable65","global",2) SetGlobal("TempVariable66","global",2) SetGlobal("TempVariable67","global",2) SetGlobal("TempVariable68","global",2) SetGlobal("TempVariable69","global",2) SetGlobal("TempVariable70","global",2) SetGlobal("TempVariable71","global",2) SetGlobal("TempVariable72","global",2) SetGlobal("TempVariable73","global",2) SetGlobal("TempVariable74","global",2) SetGlobal("TempVariable75","global",2) SetGlobal("TempVariable76","global",2) SetGlobal("TempVariable77","global",2) SetGlobal("TempVariable78","global",2) SetGlobal("TempVariable79","global",2) SetGlobal("TempVariable80","global",2) SetGlobal("TempVariable81","global",2) SetGlobal("TempVariable82","global",2) SetGlobal("TempVariable83","global",2) SetGlobal("TempVariable84","global",2) SetGlobal("TempVariable85","global",2) SetGlobal("TempVariable86","global",2) SetGlobal("TempVariable87","global",2) SetGlobal("TempVariable88","global",2) SetGlobal("TempVariable89","global",2) SetGlobal("TempVariable90","global",2) SetGlobal("TempVariable91","global",2) SetGlobal("TempVariable92","global",2) SetGlobal("TempVariable93","global",2) SetGlobal("TempVariable94","global",2) SetGlobal("TempVariable95","global",2) SetGlobal("TempVariable96","global",2) SetGlobal("TempVariable97","global",2) SetGlobal("TempVariable98","global",2) SetGlobal("TempVariable99","global",2) END IF Global("AddVariableBlock1","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock1","global",0) SetGlobal("TempVariable100","global",2) SetGlobal("TempVariable101","global",2) SetGlobal("TempVariable102","global",2) SetGlobal("TempVariable103","global",2) SetGlobal("TempVariable104","global",2) SetGlobal("TempVariable105","global",2) SetGlobal("TempVariable106","global",2) SetGlobal("TempVariable107","global",2) SetGlobal("TempVariable108","global",2) SetGlobal("TempVariable109","global",2) SetGlobal("TempVariable110","global",2) SetGlobal("TempVariable111","global",2) SetGlobal("TempVariable112","global",2) SetGlobal("TempVariable113","global",2) SetGlobal("TempVariable114","global",2) SetGlobal("TempVariable115","global",2) SetGlobal("TempVariable116","global",2) SetGlobal("TempVariable117","global",2) SetGlobal("TempVariable118","global",2) SetGlobal("TempVariable119","global",2) SetGlobal("TempVariable120","global",2) SetGlobal("TempVariable121","global",2) SetGlobal("TempVariable122","global",2) SetGlobal("TempVariable123","global",2) SetGlobal("TempVariable124","global",2) SetGlobal("TempVariable125","global",2) SetGlobal("TempVariable126","global",2) SetGlobal("TempVariable127","global",2) SetGlobal("TempVariable128","global",2) SetGlobal("TempVariable129","global",2) SetGlobal("TempVariable130","global",2) SetGlobal("TempVariable131","global",2) SetGlobal("TempVariable132","global",2) SetGlobal("TempVariable133","global",2) SetGlobal("TempVariable134","global",2) SetGlobal("TempVariable135","global",2) SetGlobal("TempVariable136","global",2) SetGlobal("TempVariable137","global",2) SetGlobal("TempVariable138","global",2) SetGlobal("TempVariable139","global",2) SetGlobal("TempVariable140","global",2) SetGlobal("TempVariable141","global",2) SetGlobal("TempVariable142","global",2) SetGlobal("TempVariable143","global",2) SetGlobal("TempVariable144","global",2) SetGlobal("TempVariable145","global",2) SetGlobal("TempVariable146","global",2) SetGlobal("TempVariable147","global",2) SetGlobal("TempVariable148","global",2) SetGlobal("TempVariable149","global",2) SetGlobal("TempVariable150","global",2) SetGlobal("TempVariable151","global",2) SetGlobal("TempVariable152","global",2) SetGlobal("TempVariable153","global",2) SetGlobal("TempVariable154","global",2) SetGlobal("TempVariable155","global",2) SetGlobal("TempVariable156","global",2) SetGlobal("TempVariable157","global",2) SetGlobal("TempVariable158","global",2) SetGlobal("TempVariable159","global",2) SetGlobal("TempVariable160","global",2) SetGlobal("TempVariable161","global",2) SetGlobal("TempVariable162","global",2) SetGlobal("TempVariable163","global",2) SetGlobal("TempVariable164","global",2) SetGlobal("TempVariable165","global",2) SetGlobal("TempVariable166","global",2) SetGlobal("TempVariable167","global",2) SetGlobal("TempVariable168","global",2) SetGlobal("TempVariable169","global",2) SetGlobal("TempVariable170","global",2) SetGlobal("TempVariable171","global",2) SetGlobal("TempVariable172","global",2) SetGlobal("TempVariable173","global",2) SetGlobal("TempVariable174","global",2) SetGlobal("TempVariable175","global",2) SetGlobal("TempVariable176","global",2) SetGlobal("TempVariable177","global",2) SetGlobal("TempVariable178","global",2) SetGlobal("TempVariable179","global",2) SetGlobal("TempVariable180","global",2) SetGlobal("TempVariable181","global",2) SetGlobal("TempVariable182","global",2) SetGlobal("TempVariable183","global",2) SetGlobal("TempVariable184","global",2) SetGlobal("TempVariable185","global",2) SetGlobal("TempVariable186","global",2) SetGlobal("TempVariable187","global",2) SetGlobal("TempVariable188","global",2) SetGlobal("TempVariable189","global",2) SetGlobal("TempVariable190","global",2) SetGlobal("TempVariable191","global",2) SetGlobal("TempVariable192","global",2) SetGlobal("TempVariable193","global",2) SetGlobal("TempVariable194","global",2) SetGlobal("TempVariable195","global",2) SetGlobal("TempVariable196","global",2) SetGlobal("TempVariable197","global",2) SetGlobal("TempVariable198","global",2) SetGlobal("TempVariable199","global",2) END IF Global("AddVariableBlock3","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock3","global",0) SetGlobal("TempVariable200","global",2) SetGlobal("TempVariable201","global",2) SetGlobal("TempVariable202","global",2) SetGlobal("TempVariable203","global",2) SetGlobal("TempVariable204","global",2) SetGlobal("TempVariable205","global",2) SetGlobal("TempVariable206","global",2) SetGlobal("TempVariable207","global",2) SetGlobal("TempVariable208","global",2) SetGlobal("TempVariable209","global",2) SetGlobal("TempVariable210","global",2) SetGlobal("TempVariable211","global",2) SetGlobal("TempVariable212","global",2) SetGlobal("TempVariable213","global",2) SetGlobal("TempVariable214","global",2) SetGlobal("TempVariable215","global",2) SetGlobal("TempVariable216","global",2) SetGlobal("TempVariable217","global",2) SetGlobal("TempVariable218","global",2) SetGlobal("TempVariable219","global",2) SetGlobal("TempVariable220","global",2) SetGlobal("TempVariable221","global",2) SetGlobal("TempVariable222","global",2) SetGlobal("TempVariable223","global",2) SetGlobal("TempVariable224","global",2) SetGlobal("TempVariable225","global",2) SetGlobal("TempVariable226","global",2) SetGlobal("TempVariable227","global",2) SetGlobal("TempVariable228","global",2) SetGlobal("TempVariable229","global",2) SetGlobal("TempVariable230","global",2) SetGlobal("TempVariable231","global",2) SetGlobal("TempVariable232","global",2) SetGlobal("TempVariable233","global",2) SetGlobal("TempVariable234","global",2) SetGlobal("TempVariable235","global",2) SetGlobal("TempVariable236","global",2) SetGlobal("TempVariable237","global",2) SetGlobal("TempVariable238","global",2) SetGlobal("TempVariable239","global",2) SetGlobal("TempVariable240","global",2) SetGlobal("TempVariable241","global",2) SetGlobal("TempVariable242","global",2) SetGlobal("TempVariable243","global",2) SetGlobal("TempVariable244","global",2) SetGlobal("TempVariable245","global",2) SetGlobal("TempVariable246","global",2) SetGlobal("TempVariable247","global",2) SetGlobal("TempVariable248","global",2) SetGlobal("TempVariable249","global",2) SetGlobal("TempVariable250","global",2) SetGlobal("TempVariable251","global",2) SetGlobal("TempVariable252","global",2) SetGlobal("TempVariable253","global",2) SetGlobal("TempVariable254","global",2) SetGlobal("TempVariable255","global",2) SetGlobal("TempVariable256","global",2) SetGlobal("TempVariable257","global",2) SetGlobal("TempVariable258","global",2) SetGlobal("TempVariable259","global",2) SetGlobal("TempVariable260","global",2) SetGlobal("TempVariable261","global",2) SetGlobal("TempVariable262","global",2) SetGlobal("TempVariable263","global",2) SetGlobal("TempVariable264","global",2) SetGlobal("TempVariable265","global",2) SetGlobal("TempVariable266","global",2) SetGlobal("TempVariable267","global",2) SetGlobal("TempVariable268","global",2) SetGlobal("TempVariable269","global",2) SetGlobal("TempVariable270","global",2) SetGlobal("TempVariable271","global",2) SetGlobal("TempVariable272","global",2) SetGlobal("TempVariable273","global",2) SetGlobal("TempVariable274","global",2) SetGlobal("TempVariable275","global",2) SetGlobal("TempVariable276","global",2) SetGlobal("TempVariable277","global",2) SetGlobal("TempVariable278","global",2) SetGlobal("TempVariable279","global",2) SetGlobal("TempVariable280","global",2) SetGlobal("TempVariable281","global",2) SetGlobal("TempVariable282","global",2) SetGlobal("TempVariable283","global",2) SetGlobal("TempVariable284","global",2) SetGlobal("TempVariable285","global",2) SetGlobal("TempVariable286","global",2) SetGlobal("TempVariable287","global",2) SetGlobal("TempVariable288","global",2) SetGlobal("TempVariable289","global",2) SetGlobal("TempVariable290","global",2) SetGlobal("TempVariable291","global",2) SetGlobal("TempVariable292","global",2) SetGlobal("TempVariable293","global",2) SetGlobal("TempVariable294","global",2) SetGlobal("TempVariable295","global",2) SetGlobal("TempVariable296","global",2) SetGlobal("TempVariable297","global",2) SetGlobal("TempVariable298","global",2) SetGlobal("TempVariable299","global",2) END IF Global("AddVariableBlock4","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock4","global",0) SetGlobal("TempVariable300","global",2) SetGlobal("TempVariable301","global",2) SetGlobal("TempVariable302","global",2) SetGlobal("TempVariable303","global",2) SetGlobal("TempVariable304","global",2) SetGlobal("TempVariable305","global",2) SetGlobal("TempVariable306","global",2) SetGlobal("TempVariable307","global",2) SetGlobal("TempVariable308","global",2) SetGlobal("TempVariable309","global",2) SetGlobal("TempVariable310","global",2) SetGlobal("TempVariable311","global",2) SetGlobal("TempVariable312","global",2) SetGlobal("TempVariable313","global",2) SetGlobal("TempVariable314","global",2) SetGlobal("TempVariable315","global",2) SetGlobal("TempVariable316","global",2) SetGlobal("TempVariable317","global",2) SetGlobal("TempVariable318","global",2) SetGlobal("TempVariable319","global",2) SetGlobal("TempVariable320","global",2) SetGlobal("TempVariable321","global",2) SetGlobal("TempVariable322","global",2) SetGlobal("TempVariable323","global",2) SetGlobal("TempVariable324","global",2) SetGlobal("TempVariable325","global",2) SetGlobal("TempVariable326","global",2) SetGlobal("TempVariable327","global",2) SetGlobal("TempVariable328","global",2) SetGlobal("TempVariable329","global",2) SetGlobal("TempVariable330","global",2) SetGlobal("TempVariable331","global",2) SetGlobal("TempVariable332","global",2) SetGlobal("TempVariable333","global",2) SetGlobal("TempVariable334","global",2) SetGlobal("TempVariable335","global",2) SetGlobal("TempVariable336","global",2) SetGlobal("TempVariable337","global",2) SetGlobal("TempVariable338","global",2) SetGlobal("TempVariable339","global",2) SetGlobal("TempVariable340","global",2) SetGlobal("TempVariable341","global",2) SetGlobal("TempVariable342","global",2) SetGlobal("TempVariable343","global",2) SetGlobal("TempVariable344","global",2) SetGlobal("TempVariable345","global",2) SetGlobal("TempVariable346","global",2) SetGlobal("TempVariable347","global",2) SetGlobal("TempVariable348","global",2) SetGlobal("TempVariable349","global",2) SetGlobal("TempVariable350","global",2) SetGlobal("TempVariable351","global",2) SetGlobal("TempVariable352","global",2) SetGlobal("TempVariable353","global",2) SetGlobal("TempVariable354","global",2) SetGlobal("TempVariable355","global",2) SetGlobal("TempVariable356","global",2) SetGlobal("TempVariable357","global",2) SetGlobal("TempVariable358","global",2) SetGlobal("TempVariable359","global",2) SetGlobal("TempVariable360","global",2) SetGlobal("TempVariable361","global",2) SetGlobal("TempVariable362","global",2) SetGlobal("TempVariable363","global",2) SetGlobal("TempVariable364","global",2) SetGlobal("TempVariable365","global",2) SetGlobal("TempVariable366","global",2) SetGlobal("TempVariable367","global",2) SetGlobal("TempVariable368","global",2) SetGlobal("TempVariable369","global",2) SetGlobal("TempVariable370","global",2) SetGlobal("TempVariable371","global",2) SetGlobal("TempVariable372","global",2) SetGlobal("TempVariable373","global",2) SetGlobal("TempVariable374","global",2) SetGlobal("TempVariable375","global",2) SetGlobal("TempVariable376","global",2) SetGlobal("TempVariable377","global",2) SetGlobal("TempVariable378","global",2) SetGlobal("TempVariable379","global",2) SetGlobal("TempVariable380","global",2) SetGlobal("TempVariable381","global",2) SetGlobal("TempVariable382","global",2) SetGlobal("TempVariable383","global",2) SetGlobal("TempVariable384","global",2) SetGlobal("TempVariable385","global",2) SetGlobal("TempVariable386","global",2) SetGlobal("TempVariable387","global",2) SetGlobal("TempVariable388","global",2) SetGlobal("TempVariable389","global",2) SetGlobal("TempVariable390","global",2) SetGlobal("TempVariable391","global",2) SetGlobal("TempVariable392","global",2) SetGlobal("TempVariable393","global",2) SetGlobal("TempVariable394","global",2) SetGlobal("TempVariable395","global",2) SetGlobal("TempVariable396","global",2) SetGlobal("TempVariable397","global",2) SetGlobal("TempVariable398","global",2) SetGlobal("TempVariable399","global",2) END IF Global("AddVariableBlock5","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock5","global",0) SetGlobal("TempVariable400","global",2) SetGlobal("TempVariable401","global",2) SetGlobal("TempVariable402","global",2) SetGlobal("TempVariable403","global",2) SetGlobal("TempVariable404","global",2) SetGlobal("TempVariable405","global",2) SetGlobal("TempVariable406","global",2) SetGlobal("TempVariable407","global",2) SetGlobal("TempVariable408","global",2) SetGlobal("TempVariable409","global",2) SetGlobal("TempVariable410","global",2) SetGlobal("TempVariable411","global",2) SetGlobal("TempVariable412","global",2) SetGlobal("TempVariable413","global",2) SetGlobal("TempVariable414","global",2) SetGlobal("TempVariable415","global",2) SetGlobal("TempVariable416","global",2) SetGlobal("TempVariable417","global",2) SetGlobal("TempVariable418","global",2) SetGlobal("TempVariable419","global",2) SetGlobal("TempVariable420","global",2) SetGlobal("TempVariable421","global",2) SetGlobal("TempVariable422","global",2) SetGlobal("TempVariable423","global",2) SetGlobal("TempVariable424","global",2) SetGlobal("TempVariable425","global",2) SetGlobal("TempVariable426","global",2) SetGlobal("TempVariable427","global",2) SetGlobal("TempVariable428","global",2) SetGlobal("TempVariable429","global",2) SetGlobal("TempVariable430","global",2) SetGlobal("TempVariable431","global",2) SetGlobal("TempVariable432","global",2) SetGlobal("TempVariable433","global",2) SetGlobal("TempVariable434","global",2) SetGlobal("TempVariable435","global",2) SetGlobal("TempVariable436","global",2) SetGlobal("TempVariable437","global",2) SetGlobal("TempVariable438","global",2) SetGlobal("TempVariable439","global",2) SetGlobal("TempVariable440","global",2) SetGlobal("TempVariable441","global",2) SetGlobal("TempVariable442","global",2) SetGlobal("TempVariable443","global",2) SetGlobal("TempVariable444","global",2) SetGlobal("TempVariable445","global",2) SetGlobal("TempVariable446","global",2) SetGlobal("TempVariable447","global",2) SetGlobal("TempVariable448","global",2) SetGlobal("TempVariable449","global",2) SetGlobal("TempVariable450","global",2) SetGlobal("TempVariable451","global",2) SetGlobal("TempVariable452","global",2) SetGlobal("TempVariable453","global",2) SetGlobal("TempVariable454","global",2) SetGlobal("TempVariable455","global",2) SetGlobal("TempVariable456","global",2) SetGlobal("TempVariable457","global",2) SetGlobal("TempVariable458","global",2) SetGlobal("TempVariable459","global",2) SetGlobal("TempVariable460","global",2) SetGlobal("TempVariable461","global",2) SetGlobal("TempVariable462","global",2) SetGlobal("TempVariable463","global",2) SetGlobal("TempVariable464","global",2) SetGlobal("TempVariable465","global",2) SetGlobal("TempVariable466","global",2) SetGlobal("TempVariable467","global",2) SetGlobal("TempVariable468","global",2) SetGlobal("TempVariable469","global",2) SetGlobal("TempVariable470","global",2) SetGlobal("TempVariable471","global",2) SetGlobal("TempVariable472","global",2) SetGlobal("TempVariable473","global",2) SetGlobal("TempVariable474","global",2) SetGlobal("TempVariable475","global",2) SetGlobal("TempVariable476","global",2) SetGlobal("TempVariable477","global",2) SetGlobal("TempVariable478","global",2) SetGlobal("TempVariable479","global",2) SetGlobal("TempVariable480","global",2) SetGlobal("TempVariable481","global",2) SetGlobal("TempVariable482","global",2) SetGlobal("TempVariable483","global",2) SetGlobal("TempVariable484","global",2) SetGlobal("TempVariable485","global",2) SetGlobal("TempVariable486","global",2) SetGlobal("TempVariable487","global",2) SetGlobal("TempVariable488","global",2) SetGlobal("TempVariable489","global",2) SetGlobal("TempVariable490","global",2) SetGlobal("TempVariable491","global",2) SetGlobal("TempVariable492","global",2) SetGlobal("TempVariable493","global",2) SetGlobal("TempVariable494","global",2) SetGlobal("TempVariable495","global",2) SetGlobal("TempVariable496","global",2) SetGlobal("TempVariable497","global",2) SetGlobal("TempVariable498","global",2) SetGlobal("TempVariable499","global",2) END IF Global("AddVariableBlock5","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock5","global",0) SetGlobal("TempVariable500","global",2) SetGlobal("TempVariable501","global",2) SetGlobal("TempVariable502","global",2) SetGlobal("TempVariable503","global",2) SetGlobal("TempVariable504","global",2) SetGlobal("TempVariable505","global",2) SetGlobal("TempVariable506","global",2) SetGlobal("TempVariable507","global",2) SetGlobal("TempVariable508","global",2) SetGlobal("TempVariable509","global",2) SetGlobal("TempVariable510","global",2) SetGlobal("TempVariable511","global",2) SetGlobal("TempVariable512","global",2) SetGlobal("TempVariable513","global",2) SetGlobal("TempVariable514","global",2) SetGlobal("TempVariable515","global",2) SetGlobal("TempVariable516","global",2) SetGlobal("TempVariable517","global",2) SetGlobal("TempVariable518","global",2) SetGlobal("TempVariable519","global",2) SetGlobal("TempVariable520","global",2) SetGlobal("TempVariable521","global",2) SetGlobal("TempVariable522","global",2) SetGlobal("TempVariable523","global",2) SetGlobal("TempVariable524","global",2) SetGlobal("TempVariable525","global",2) SetGlobal("TempVariable526","global",2) SetGlobal("TempVariable527","global",2) SetGlobal("TempVariable528","global",2) SetGlobal("TempVariable529","global",2) SetGlobal("TempVariable530","global",2) SetGlobal("TempVariable531","global",2) SetGlobal("TempVariable532","global",2) SetGlobal("TempVariable533","global",2) SetGlobal("TempVariable534","global",2) SetGlobal("TempVariable535","global",2) SetGlobal("TempVariable536","global",2) SetGlobal("TempVariable537","global",2) SetGlobal("TempVariable538","global",2) SetGlobal("TempVariable539","global",2) SetGlobal("TempVariable540","global",2) SetGlobal("TempVariable541","global",2) SetGlobal("TempVariable542","global",2) SetGlobal("TempVariable543","global",2) SetGlobal("TempVariable544","global",2) SetGlobal("TempVariable545","global",2) SetGlobal("TempVariable546","global",2) SetGlobal("TempVariable547","global",2) SetGlobal("TempVariable548","global",2) SetGlobal("TempVariable549","global",2) SetGlobal("TempVariable550","global",2) SetGlobal("TempVariable551","global",2) SetGlobal("TempVariable552","global",2) SetGlobal("TempVariable553","global",2) SetGlobal("TempVariable554","global",2) SetGlobal("TempVariable555","global",2) SetGlobal("TempVariable556","global",2) SetGlobal("TempVariable557","global",2) SetGlobal("TempVariable558","global",2) SetGlobal("TempVariable559","global",2) SetGlobal("TempVariable560","global",2) SetGlobal("TempVariable561","global",2) SetGlobal("TempVariable562","global",2) SetGlobal("TempVariable563","global",2) SetGlobal("TempVariable564","global",2) SetGlobal("TempVariable565","global",2) SetGlobal("TempVariable566","global",2) SetGlobal("TempVariable567","global",2) SetGlobal("TempVariable568","global",2) SetGlobal("TempVariable569","global",2) SetGlobal("TempVariable570","global",2) SetGlobal("TempVariable571","global",2) SetGlobal("TempVariable572","global",2) SetGlobal("TempVariable573","global",2) SetGlobal("TempVariable574","global",2) SetGlobal("TempVariable575","global",2) SetGlobal("TempVariable576","global",2) SetGlobal("TempVariable577","global",2) SetGlobal("TempVariable578","global",2) SetGlobal("TempVariable579","global",2) SetGlobal("TempVariable580","global",2) SetGlobal("TempVariable581","global",2) SetGlobal("TempVariable582","global",2) SetGlobal("TempVariable583","global",2) SetGlobal("TempVariable584","global",2) SetGlobal("TempVariable585","global",2) SetGlobal("TempVariable586","global",2) SetGlobal("TempVariable587","global",2) SetGlobal("TempVariable588","global",2) SetGlobal("TempVariable589","global",2) SetGlobal("TempVariable590","global",2) SetGlobal("TempVariable591","global",2) SetGlobal("TempVariable592","global",2) SetGlobal("TempVariable593","global",2) SetGlobal("TempVariable594","global",2) SetGlobal("TempVariable595","global",2) SetGlobal("TempVariable596","global",2) SetGlobal("TempVariable597","global",2) SetGlobal("TempVariable598","global",2) SetGlobal("TempVariable599","global",2) END IF Global("AddVariableBlock6","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock6","global",0) SetGlobal("TempVariable600","global",2) SetGlobal("TempVariable601","global",2) SetGlobal("TempVariable602","global",2) SetGlobal("TempVariable603","global",2) SetGlobal("TempVariable604","global",2) SetGlobal("TempVariable605","global",2) SetGlobal("TempVariable606","global",2) SetGlobal("TempVariable607","global",2) SetGlobal("TempVariable608","global",2) SetGlobal("TempVariable609","global",2) SetGlobal("TempVariable610","global",2) SetGlobal("TempVariable611","global",2) SetGlobal("TempVariable612","global",2) SetGlobal("TempVariable613","global",2) SetGlobal("TempVariable614","global",2) SetGlobal("TempVariable615","global",2) SetGlobal("TempVariable616","global",2) SetGlobal("TempVariable617","global",2) SetGlobal("TempVariable618","global",2) SetGlobal("TempVariable619","global",2) SetGlobal("TempVariable620","global",2) SetGlobal("TempVariable621","global",2) SetGlobal("TempVariable622","global",2) SetGlobal("TempVariable623","global",2) SetGlobal("TempVariable624","global",2) SetGlobal("TempVariable625","global",2) SetGlobal("TempVariable626","global",2) SetGlobal("TempVariable627","global",2) SetGlobal("TempVariable628","global",2) SetGlobal("TempVariable629","global",2) SetGlobal("TempVariable630","global",2) SetGlobal("TempVariable631","global",2) SetGlobal("TempVariable632","global",2) SetGlobal("TempVariable633","global",2) SetGlobal("TempVariable634","global",2) SetGlobal("TempVariable635","global",2) SetGlobal("TempVariable636","global",2) SetGlobal("TempVariable637","global",2) SetGlobal("TempVariable638","global",2) SetGlobal("TempVariable639","global",2) SetGlobal("TempVariable640","global",2) SetGlobal("TempVariable641","global",2) SetGlobal("TempVariable642","global",2) SetGlobal("TempVariable643","global",2) SetGlobal("TempVariable644","global",2) SetGlobal("TempVariable645","global",2) SetGlobal("TempVariable646","global",2) SetGlobal("TempVariable647","global",2) SetGlobal("TempVariable648","global",2) SetGlobal("TempVariable649","global",2) SetGlobal("TempVariable650","global",2) SetGlobal("TempVariable651","global",2) SetGlobal("TempVariable652","global",2) SetGlobal("TempVariable653","global",2) SetGlobal("TempVariable654","global",2) SetGlobal("TempVariable655","global",2) SetGlobal("TempVariable656","global",2) SetGlobal("TempVariable657","global",2) SetGlobal("TempVariable658","global",2) SetGlobal("TempVariable659","global",2) SetGlobal("TempVariable660","global",2) SetGlobal("TempVariable661","global",2) SetGlobal("TempVariable662","global",2) SetGlobal("TempVariable663","global",2) SetGlobal("TempVariable664","global",2) SetGlobal("TempVariable665","global",2) SetGlobal("TempVariable666","global",2) SetGlobal("TempVariable667","global",2) SetGlobal("TempVariable668","global",2) SetGlobal("TempVariable669","global",2) SetGlobal("TempVariable670","global",2) SetGlobal("TempVariable671","global",2) SetGlobal("TempVariable672","global",2) SetGlobal("TempVariable673","global",2) SetGlobal("TempVariable674","global",2) SetGlobal("TempVariable675","global",2) SetGlobal("TempVariable676","global",2) SetGlobal("TempVariable677","global",2) SetGlobal("TempVariable678","global",2) SetGlobal("TempVariable679","global",2) SetGlobal("TempVariable680","global",2) SetGlobal("TempVariable681","global",2) SetGlobal("TempVariable682","global",2) SetGlobal("TempVariable683","global",2) SetGlobal("TempVariable684","global",2) SetGlobal("TempVariable685","global",2) SetGlobal("TempVariable686","global",2) SetGlobal("TempVariable687","global",2) SetGlobal("TempVariable688","global",2) SetGlobal("TempVariable689","global",2) SetGlobal("TempVariable690","global",2) SetGlobal("TempVariable691","global",2) SetGlobal("TempVariable692","global",2) SetGlobal("TempVariable693","global",2) SetGlobal("TempVariable694","global",2) SetGlobal("TempVariable695","global",2) SetGlobal("TempVariable696","global",2) SetGlobal("TempVariable697","global",2) SetGlobal("TempVariable698","global",2) SetGlobal("TempVariable699","global",2) END
3) Open your baldur.bcs or any other script that is executed with Near Infinity and add contents of "Stutter Remover.txt"(or copy-paste that spoiler) at the end of it. Compile and save your script.
4) Load your stuttering savegame, press ctrl+space and type:
If the game is paused, unpause it. Then check if the script worked:CLUAConsole:SetGlobal("AddVariableBlock0", "GLOBAL", 1)
It should return 0. Otherwise you have done wrong some of the steps above.CLUAConsole:GetGlobal("AddVariableBlock0", "GLOBAL")
5) If the stuttering disappeared, proceed to step 6). Otherwise try setting other variable blocks:
In my tests one block was always enough, but who knows.CLUAConsole:SetGlobal("AddVariableBlock1", "GLOBAL", 1)
CLUAConsole:SetGlobal("AddVariableBlock2", "GLOBAL", 1)
...
6) If the stuttering disappeared, DO NOT save your game and DO NOT continue playing it. Re-load the same savegame again instead. If all goes right, after reloading the game there should be no stuttering.
7) If you close the game and launch it again, you'll have to do steps 1-6.
Why this works
The scrips I have attached adds a bunch of dummy variables to the map, forcing to overflow and get rehashed. Each block adds 100 new variables. Script looks like this:
Spoiler
IF Global("AddVariableBlock0","global",1) THEN RESPONSE #100 SetGlobal("AddVariableBlock0","global",0) SetGlobal("TempVariable0","global",2) SetGlobal("TempVariable1","global",2) SetGlobal("TempVariable2","global",2) SetGlobal("TempVariable3","global",2) SetGlobal("TempVariable4","global",2) SetGlobal("TempVariable5","global",2) SetGlobal("TempVariable6","global",2) SetGlobal("TempVariable7","global",2) SetGlobal("TempVariable8","global",2) SetGlobal("TempVariable9","global",2) SetGlobal("TempVariable10","global",2) SetGlobal("TempVariable11","global",2) SetGlobal("TempVariable12","global",2) SetGlobal("TempVariable13","global",2) SetGlobal("TempVariable14","global",2) SetGlobal("TempVariable15","global",2) SetGlobal("TempVariable16","global",2) SetGlobal("TempVariable17","global",2) SetGlobal("TempVariable18","global",2) SetGlobal("TempVariable19","global",2) SetGlobal("TempVariable20","global",2) SetGlobal("TempVariable21","global",2) SetGlobal("TempVariable22","global",2) SetGlobal("TempVariable23","global",2) SetGlobal("TempVariable24","global",2) SetGlobal("TempVariable25","global",2) SetGlobal("TempVariable26","global",2) SetGlobal("TempVariable27","global",2) SetGlobal("TempVariable28","global",2) SetGlobal("TempVariable29","global",2) SetGlobal("TempVariable30","global",2) SetGlobal("TempVariable31","global",2) SetGlobal("TempVariable32","global",2) SetGlobal("TempVariable33","global",2) SetGlobal("TempVariable34","global",2) SetGlobal("TempVariable35","global",2) SetGlobal("TempVariable36","global",2) SetGlobal("TempVariable37","global",2) SetGlobal("TempVariable38","global",2) SetGlobal("TempVariable39","global",2) SetGlobal("TempVariable40","global",2) SetGlobal("TempVariable41","global",2) SetGlobal("TempVariable42","global",2) SetGlobal("TempVariable43","global",2) SetGlobal("TempVariable44","global",2) SetGlobal("TempVariable45","global",2) SetGlobal("TempVariable46","global",2) SetGlobal("TempVariable47","global",2) SetGlobal("TempVariable48","global",2) SetGlobal("TempVariable49","global",2) SetGlobal("TempVariable50","global",2) SetGlobal("TempVariable51","global",2) SetGlobal("TempVariable52","global",2) SetGlobal("TempVariable53","global",2) SetGlobal("TempVariable54","global",2) SetGlobal("TempVariable55","global",2) SetGlobal("TempVariable56","global",2) SetGlobal("TempVariable57","global",2) SetGlobal("TempVariable58","global",2) SetGlobal("TempVariable59","global",2) SetGlobal("TempVariable60","global",2) SetGlobal("TempVariable61","global",2) SetGlobal("TempVariable62","global",2) SetGlobal("TempVariable63","global",2) SetGlobal("TempVariable64","global",2) SetGlobal("TempVariable65","global",2) SetGlobal("TempVariable66","global",2) SetGlobal("TempVariable67","global",2) SetGlobal("TempVariable68","global",2) SetGlobal("TempVariable69","global",2) SetGlobal("TempVariable70","global",2) SetGlobal("TempVariable71","global",2) SetGlobal("TempVariable72","global",2) SetGlobal("TempVariable73","global",2) SetGlobal("TempVariable74","global",2) SetGlobal("TempVariable75","global",2) SetGlobal("TempVariable76","global",2) SetGlobal("TempVariable77","global",2) SetGlobal("TempVariable78","global",2) SetGlobal("TempVariable79","global",2) SetGlobal("TempVariable80","global",2) SetGlobal("TempVariable81","global",2) SetGlobal("TempVariable82","global",2) SetGlobal("TempVariable83","global",2) SetGlobal("TempVariable84","global",2) SetGlobal("TempVariable85","global",2) SetGlobal("TempVariable86","global",2) SetGlobal("TempVariable87","global",2) SetGlobal("TempVariable88","global",2) SetGlobal("TempVariable89","global",2) SetGlobal("TempVariable90","global",2) SetGlobal("TempVariable91","global",2) SetGlobal("TempVariable92","global",2) SetGlobal("TempVariable93","global",2) SetGlobal("TempVariable94","global",2) SetGlobal("TempVariable95","global",2) SetGlobal("TempVariable96","global",2) SetGlobal("TempVariable97","global",2) SetGlobal("TempVariable98","global",2) SetGlobal("TempVariable99","global",2) END
Once the map is enlarged, it will remain with the same size if you load your game again and it will not stutter. However, if you close BGMain, upon launching it again the map will be "stuffed" again and you'll have to repeat this procedure.
Why you should reload your game after executing the script
If you save, all those dummy variables will be added to your savegame globals section. There's nothing lethal in it, but you probably don't want it.
Solution
I have implemented my own hashmap and injected it into BGMain via Ascension64's TobEx. I have removed the link since Ascension64 has implemented pretty the same thing in his TobEx 0.24.
Edited by Suslik, 23 April 2012 - 05:08 PM.