Jump to content

Stutter while shapeshifting with SCSII installed


Recommended Posts

A long time ago, I noticed an strange stutter effect while using druidic shapeshifting whenever SCSII is installed. After some testing, I think I've finally discovered the cause.

 

Apparently, some shapeshift form template CREs have AI scripts assigned to them even in the unmodded game (i.e. WEREWODR.CRE has WTASIGHT.BCS) and it would seem that the engine attempts to load those scripts upon executing the polymorph effect. As SCSII increases the size of most scripts, their load times are increased as well, which in term causes a stutter effect whenever a polymorph into such a creature is attempted. The solution is simple - remove AI scripts from CREs which are used solely for shapeshifting purposes and the stutter dissapears.

Link to comment

For clarity, this stutter occurs only when normal shapeshifting abilities are used (i.e. those from the unmodded game).

 

I don't think it will happen when using SCSII's Improved Shapeshifting component and equipping the shapeshift tokens because they don't use the polymorph opcode.

Link to comment

Update: I've written a small piece of code which should resolve the problem:

 

// Remove AI scripts from creatures who serve only as polymorph templates (prevents lag while polymorphing when using AI enhancing mods)

COPY_EXISTING   ~BEARBR.CRE~ ~override/PLYBEAR1.CRE~                               // Druid Brown Bear form (cloning, the original CRE is used in-game)
COPY_EXISTING   ~BEARBL.CRE~ ~override/PLYBEAR2.CRE~                               // Druid Black Bear form (cloning, the original CRE is used in-game)
COPY_EXISTING   ~JELLMU.CRE~ ~override/PLYJELL1.CRE~                               // Polymorph Self Mustard Jelly form (cloning, the original CRE is used in-game)

COPY_EXISTING ~WOLFCHAR.CRE~ ~override~                                            // Druid Wolf form
            ~PLYBEAR1.CRE~  ~override~                                            // Druid Brown Bear form (cloned version)
            ~PLYBEAR2.CRE~  ~override~                                            // Druid Black Bear form (cloned version)
             ~PLYSPID.CRE~  ~override~                                            // Avenger kit Sword Spider form
            ~PLYWYVRN.CRE~  ~override~                                            // Avenger kit Baby Wyvern form
             ~PLYSALA.CRE~  ~override~                                            // Avenger kit Fire Salamander form
            ~WEREWODR.CRE~  ~override~                                            // Shapeshifrer kit Werewolf form
            ~WEREGRDR.CRE~  ~override~                                            // Shapeshifrer kit Greater Werewolf form
            ~DRUFIR01.CRE~  ~override~                                            // HLA Fire Elemental form
            ~DRUEAR01.CRE~  ~override~                                            // HLA Earth Elemental form
            ~PLYFLIND.CRE~  ~override~                                            // Polymorph Self Flind form
             ~PLYOGRE.CRE~  ~override~                                            // Polymorph Self Ogre form
            ~PLYJELL1.CRE~  ~override~                                            // Polymorph Self Mustard Jelly form (cloned version)
             ~PLYWOLF.CRE~  ~override~                                            // Polymorph Self Wolf form
              ~SHMIND.CRE~  ~override~                                            // Shapechange Mind Flayer form
              ~SHIRON.CRE~  ~override~                                            // Shapechange Iron Golem form
             ~SHTROLL.CRE~  ~override~                                            // Shapechange Giant Troll form
              ~SHWOLF.CRE~  ~override~                                            // Shapechange Greater Wolfwere form
              ~SHFIRE.CRE~  ~override~                                            // Shapechange Fire Elemental form
             ~SHEARTH.CRE~  ~override~                                            // Shapechange Earth Elemental form
             ~POLYRAT.CRE~  ~override~                                            // Cloak of the Sewers Rat form
            ~PLYTROLL.CRE~  ~override~                                            // Cloak of the Sewers Troll form
            ~POLYOCHR.CRE~  ~override~                                            // Cloak of the Sewers Mustard Jelly form
PATCH_IF (%SOURCE_SIZE% > 0x2d3) THEN BEGIN                                        // file size sanity check (filters out 0 byte files i.e. ALLOW_MISSING)
 WRITE_ASCII 0x248 ~None~ #8                                                      // override AI script
 WRITE_ASCII 0x250 ~None~ #8                                                      // class AI script
 WRITE_ASCII 0x258 ~None~ #8                                                      // race AI script
 WRITE_ASCII 0x260 ~None~ #8                                                      // general AI script
 WRITE_ASCII 0x268 ~None~ #8                                                      // default AI script
END                                                                                // end file size sanity check
BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING ~SPCL611.SPL~ ~override~                                             // Druid shapeshift Brown Bear
             ~SPCL613.SPL~ ~override~                                             // Druid shapeshift Black Bear
             ~SPWI496.SPL~ ~override~                                             // Polymorph Self shapeshift Mustard Jelly
             ~SPWI497.SPL~ ~override~                                             // Polymorph Self shapeshift Brown Bear
             ~SPWI498.SPL~ ~override~                                             // Polymorph Self shapeshift Black Bear
READ_LONG  0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
READ_LONG  0x6a "fx_off"
 FOR (index = 0 ; index < abil_num ; index = index + 1 ) BEGIN // cycle through abilities
   READ_SHORT  ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
   READ_SHORT  ("%abil_off%" + 0x20 + (0x28 * "%index%")) "abil_fx_idx"
   FOR (index2 = 0 ; index2 < abil_fx_num ; index2 = index2 + 1) BEGIN
     READ_SHORT ("%fx_off%" +        (0x30 * ("%index2%" + "%abil_fx_idx%"))) "opcode"
     READ_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%index2%" + "%abil_fx_idx%"))) "resref"
     PATCH_IF ("%opcode%" = 135 AND "%resref%" STRING_EQUAL_CASE ~BEARBR~) BEGIN  // effect #135: Polymorph into Specific
      WRITE_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%index2%" + "%abil_fx_idx%"))) "PLYBEAR1" #8 // use the cloned Brown Bear form
     END
     PATCH_IF ("%opcode%" = 135 AND "%resref%" STRING_EQUAL_CASE ~BEARBL~) BEGIN  // effect #135: Polymorph into Specific
      WRITE_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%index2%" + "%abil_fx_idx%"))) "PLYBEAR2" #8 // use the cloned Black Bear form
     END
     PATCH_IF ("%opcode%" = 135 AND "%resref%" STRING_EQUAL_CASE ~JELLMU~) BEGIN  // effect #135: Polymorph into Specific
      WRITE_ASCII ("%fx_off%" + 0x14 + (0x30 * ("%index2%" + "%abil_fx_idx%"))) "PLYJELL1" #8 // use the cloned Mustard Jelly form
     END
   END
 END
BUT_ONLY_IF_IT_CHANGES

 

As noted earlier, this issue is not caused directly by SCSII, but rather by the fact that the Bioware developers forgot to remove generic AI scripts from creatures who only serve as templates for the polymorph line of spells and abilities. As SCSII greatly increases the size of the generic AI scripts (such as WTASIGHT.BCS) their loading times are increased as well, and that's what actually causes the stutter. This code removes all AI scripts from such creatures and thereby entirely eliminates the issue.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...