Jump to content

Script performance optimization


mastahbossu

Recommended Posts

I want to improve the scripting in my Simple DLC Delay mod and I'm curious about functions and conditions etc. to avoid using in a script that is constantly running to improve performance.

 

For example in the upcoming version I have switched from GetInGrid to GetMapMarkerVisible for when the player is near the entrances to the DLC areas and so forth, which I assume i much less taxing on the CPU.

 

The ones I'm more curious about however are GetInWorldSpace, GetQuestCompleted and calling local variables assigned in Quest scripts from other scripts.. is there anything I should worry about with these?

 

Thanks!

Link to comment
Share on other sites

Switching to using a primitive trigger box / plane ... would keep it from always checking the player position / view to said map marker. With a script like this ...

 

~~~~~~~~~~~~~~

 

Begin OnTriggerEnter Player

 

StartQuest ; enable dlc ??? However you are delaying the dlc ?

 

Disable

MarkForDelete

 

End

~~~~~~~~~~~~~

 

Of course you would probably have to surround an area with a bunch of long thin triggers ... Which could be refs of 1 base-ID with all using the same script.

But after 1 gets disable , marked for delete. Would have to disable the others for that map marker surround. Which I guess the easiest is to name the refs , and call them all in the same script.

Edited by Mktavish
Link to comment
Share on other sites

I assume i much less taxing on the CPU.

I doubt that most of users scripts would have any noticeable impact on performance, since most scripts in one or another way working in game "thicks", and have priority optimization inside game engine. In fact many of vanilla script in f3 and NV, in always on mode. Ofc it is possible to break the game with one simple script and there some problems which must to be avoided. But for the most part you probably safe with how your scripts are atm.

Link to comment
Share on other sites

Well there is a difference between "GetInGrid" banging away with the gamemode block.

And "GetMapMarkerVisible "

 

But my point was to take away that script ... piling on to the always running even the simple map marker check. To a 1 time event upon situational happening.

 

It really depends on how many of those you have going ... 1 doesn't make a difference ... but 20 of them does.

And considering a long list of mods ... it helps to cut the cpu cycles when you can.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...