The forum has been set to read-only mode. For community discussion and questions, head over to our Discord: https://discord.taleoftwowastelands.com

Stutter in CASM

General help and troubleshooting.
Post Reply
User avatar
jlf65
Posts: 1535
Joined: Wed Aug 10, 2016 9:10 pm

Stutter in CASM

Post by jlf65 » Sun Sep 04, 2016 5:31 pm

Moved this to its own thread...


When using CASM with the save on reach location, the game stutters pretty bad. Turn it off and it's nice and smooth again. So I looked at the scripts - here's the key part of the main script for that function:


[quote]


        if CASMSaveLocationsReached > 0

            let rTemp := Call CASMFindNearestMarkerFunction ar_markers

            if rTemp != rLastMarker && (rTemp != 0 && rLastMarker != 0)

        dbprintc "CASM: Location Reached Save"

                let bSave := CASMSaveLocationsReached

            endif

        endif[/quote]


And here's the function:


[quote]scn CASMFindNearestMarkerFunction

 

ref rMarker

array_var ar_markers

array_var ar_element

 

BEGIN Function {ar_markers}

    if eval ar_markers != ar_Null

        ForEach ar_element <- ar_markers

            let rMarker := ar_element["value"]

            if IsFormValid rMarker

                if rMarker.gbo == MapMarker

                    let rMarker := ar_element["value"]

                    if (Player.GetDistance rMarker) <= 2000 && rMarker.GetMapMarkerVisible == 2

    ;    printc "CASM: Marker in range and found, %i" rMarker

                        SetFunctionValue rMarker

                        Break

                    endif

                endif

            endif

        Loop

    endif

END[/quote]


 


First off, there's a deprecated call in the main script:


[quote]   


if Player.IsInInterior == 0

        if rPrevCell != Player.GetParentCell

            let rPrevCell := Player.GetParentCell

            let ar_markers := GetCellRefs 32 2

    dbprintc "CASM: Changed cell, updating map marker list: Current cell is %n" rPrevCell

        endif

    endif[/quote]

 


[quote](array) GetCellRefs typeID:int celldepth:int includeTaken:bool targetCell:cell (deprecated by GetRefs/GetRefsInCell in NVSE 4.5.7)

Replaces ref-walking loops with a single function call that returns an array_var of refs in a cell. If no cell is specified, the player's current cell is used.[/quote]


I don't think that's the cause of the stutter, but it really should be updated to use the NVSE function. In fact, if that's the only Lutana call, Lutana could be eliminated as a depency.


The stutter is probably in finding the closest marker to the player. The function looks through all the static refs around the player. If the ref is a MapMarker, then it checks the distance to the player. it does this every time for every static ref. This is ridiculously heavy on computation unless you just happen to be in an area with few statics.


One way to help this would be to change the routine in the main script that gets the cell refs. After getting the refs, go through the list making a new list of ONLY MapMarker refs! There's no reason to go through EVERY ref every single time. Pare that list down to only those refs you care about. That alone may be enough to get rid of the stutter.


 


EDIT: Is there a code tag that actually WORKS on the forum? The "standard" code tag inserts visible html markers and tries to color code functions.



Deathclaw_Mayor16
Posts: 122
Joined: Thu Jun 30, 2016 2:45 am

I havent really notice it

Post by Deathclaw_Mayor16 » Sun Sep 04, 2016 6:41 pm

I havent really notice it stuttering.What I have noticed is that when CASM does save,it freezes the game for about a split second.Which is odd since the Fallout 3 version never did that.



User avatar
jlf65
Posts: 1535
Joined: Wed Aug 10, 2016 9:10 pm

Deathclaw_Mayor16 wrote:

Post by jlf65 » Sun Sep 04, 2016 7:04 pm

[quote=Deathclaw_Mayor16]


 


I havent really notice it stuttering.What I have noticed is that when CASM does save,it freezes the game for about a split second.Which is odd since the Fallout 3 version never did that.


[/quote]


 


It's more like Skyrim save, where it halts the game for a second so that the game data doesn't change right in the middle of a save. It means less chance of save corruption.


And try turning on and off the save on location reached a few times and see how it feels on your system. If you don't feel a noticeable stutter, your system is a lot more powerful than mine.


Be sure to try it in an area with a LOT of stuff, like just outside Megaton or around Springvale. You won't notice it inside because it doesn't run inside, and inside Megaton is too small to notice anything.



User avatar
RoyBatty
Gary
Posts: 7742
Joined: Sun Apr 27, 2014 10:26 am
Location: Vault 108

That's not casm, it's making

Post by RoyBatty » Mon Sep 05, 2016 1:38 am

That's not casm, it's making full saves not "quick saves" which often become corrupted. So yeah it makes the game pause for a moment, the pause gets longer the bigger your save is. Blame bethesda and their terrible code, such a thing should be instant and transparent.


Image

Royhr
Posts: 386
Joined: Tue Mar 03, 2015 3:33 am

This problem is even worse in

Post by Royhr » Mon Sep 05, 2016 2:09 pm

This problem is even worse in FO4. Granted not with CASM since as far as I know that mod isn't yet available for FO4. But other mods that do auto saves that I have used or am using are really horrible as far causing the game to temporarily freeze for a second while executing the save.


As far as freezing in TTW? I haven't notice it myself either currently or in the past.



Gribbleshnibit8
Posts: 481
Joined: Sun Nov 04, 2012 2:06 am

Royhr wrote:

Post by Gribbleshnibit8 » Tue Sep 06, 2016 2:46 pm

[quote=Royhr]


This problem is even worse in FO4. Granted not with CASM since as far as I know that mod isn't yet available for FO4. [/quote]


There is a spiritual successor in Jax's Incremental Save Manager.



Royhr
Posts: 386
Joined: Tue Mar 03, 2015 3:33 am

Gribbleshnibit8 wrote:

Post by Royhr » Tue Sep 06, 2016 8:22 pm

[quote=Gribbleshnibit8]


 


Royhr wrote:



This problem is even worse in FO4. Granted not with CASM since as far as I know that mod isn't yet available for FO4.



There is a spiritual successor in Jax's Incremental Save Manager.


[/quote]


Yes I actually tried that but had issues with it for some reason. So I just use  

[url=http://www.nexusmods.com/fallout4/mods/10920/?] Automatic Save [/url] by Xylozi. Works pretty good for me except for those little freezes when doing an auto save. I've actually gotten sort of use to them so they don't bother me as much any more.



Post Reply