Questions about OBSE function scripts and the game engine

Post » Thu Dec 08, 2011 3:28 am

Can anyone give me an idea of what kinds of runtime limitations I should consider when using OBSE function scripts? I'm trying to find a balance between what I want to do and what should be a reasonable load on the game engine given the fact that the player is probably going to be running other mods at the same time, possibly dozens of them, all competing for resources.

The reason I ask is that I'm working on a scripting project that I suspect is becoming rather large and complex for a mod, weighing in @ ~5000 lines of code over ~60 scripts, only four of which are not function scripts. I want to understand the constraints I'm working under and at what point I can expect things to start to break down. Considering how hobbled vanilla scripting is to begin with and what that implies about the game engine, I'm a little worried about my project eventually blowing up in my face if I keep adding to it.

Some things I'd like to know, specifically:
  • Is OBSE able to arrange loading/unloading of function script assemblies (or whatever I should call them)? To all appearances the game engine loads everything in when a game is loaded or started and keeps it all in memory until the player exits.
  • Is there a cap I should be aware of on how many scripts can be loaded in (across all mods) regardless of their collective memory load, and how do function scripts figure into it?

Function scripts seem like a great way to streamline your overhead since they appear to be completely temporary, but that's probably only going to be true for memory load if there are some runtime optimizations being made in the background. Frankly, I'm a novice at this despite having programming skills. I have ZERO experience with game engine architecture so I can only guess at what goes on under the hood.
User avatar
Dagan Wilkin
 
Posts: 3352
Joined: Fri Apr 27, 2007 4:20 am

Post » Thu Dec 08, 2011 9:43 am

I don't have any real technical details on user function limitations, but from personal experience I don't think there's anything to be concerned about, other than deleting string variables when using them.
User avatar
CHANONE
 
Posts: 3377
Joined: Fri Mar 30, 2007 10:04 am

Post » Thu Dec 08, 2011 9:19 am

If memory serves, it has been mentioned by engine experts that scripts are all loaded with the game, so no worries about loading/unloading them dynamically.

I have a 'basic set' of 150+ user function scripts (and growing) and my main project has another 200+. As in your case, 95% of my code is in function scripts.

I've been using them since they came out and never noticed any problem at all.

I can't think of any other restriction other than the string var destruction MatH mentioned.
User avatar
Meghan Terry
 
Posts: 3414
Joined: Sun Aug 12, 2007 11:53 am

Post » Thu Dec 08, 2011 1:56 am

Thanks MatH, QQuix for the feedback.

If memory serves, it has been mentioned by engine experts that scripts are all loaded with the game, so no worries about loading/unloading them dynamically.

I have a 'basic set' of 150+ user function scripts (and growing) and my main project has another 200+. As in your case, 95% of my code is in function scripts.

...


[Note: Edited for clarity]

I was originally hoping that OBSE did (silently) load/unload/reload function scripts. Loading function scripts as-needed, unloading them when they become stagnant and loading them back in when they're needed again would be a good way to keep them from piling up in the game engine's memory pools and choking them. Those memory pools are also storing all the other loaded game entities, after all. Straw that breaks the camel's back.

So from what you're both saying, overhead from scripts is fairly negligible, so it doesn't matter nearly as much as I was imagining. That's good enough for me :)

If anyone else has anything to add, please do. Even if it's just context, I'd like to have a better idea of what's going on behind the scenes.
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Thu Dec 08, 2011 7:48 am

So from what you're both saying, overhead from scripts is fairly negligible, so it doesn't matter nearly as much as I was imagining. That's good enough for me :)
Pretty much this. Besides, OBSE caches function script metadata on first run to reduce overhead from subsequent calls to the same function.
User avatar
Reanan-Marie Olsen
 
Posts: 3386
Joined: Thu Mar 01, 2007 6:12 am


Return to IV - Oblivion