Persistent References vs. GameMode scripts

Post » Fri May 04, 2012 11:37 am

In my current mod making exploits I managed to run into a performance dilemma. So here I am asking the question:

Which does affect game performance greater, persistent references or references running Begin GameMode scripts?

I can't rule out either of those completely - either one or the other has to be used - and we are talking about major numbers (hundreds of instances). Has anyone tested which of these two does a greater impact on game performance?
User avatar
JR Cash
 
Posts: 3441
Joined: Tue Oct 02, 2007 12:59 pm

Post » Fri May 04, 2012 7:30 am

An Object script won't run on a non-persistent REF when it isn't loaded, IIRC, so I'd go that route and script the objects calling the functions implicitly rather than setting them all as "Persistent" and managing them from elsweyr.
User avatar
darnell waddington
 
Posts: 3448
Joined: Wed Oct 17, 2007 10:43 pm

Post » Fri May 04, 2012 7:37 pm

Short answer: Gamemode impacts performance more.

Long answer: It depends...

Persistent references are saved into the player's savegame. Normal usage (i.e. only the items that you place in the CS without using a script) shouldn't be an issue. But if you are running a script that keeps creating persistent references every frame, you can quickly cause major savegame bloat that is often irreparable. Once a save is larger then what the game or player's computer can handle, the save will be unplayable.

In theory, it's possible to run hundreds of Gamemode scripts every frame without a noticeable framerate drop. This of course depends on what is in those scripts. Setting a variable has a negligible performance impact and an "if" statement a little more. It's known that MoveTo is very processor intensive and if several of them are run every frame, noticeable stuttering will occur.

As for what JustinOther said above, I'm not sure that GameMode blocks on persistent refs are run when you're not in the same cell. I'll do a test and find out.

The last thing to consider is lighting - multiple overlapping light sources will cause framerate drops very quickly.

EDIT: I just ran a test: Gamemode blocks on objects won't run if the object isn't loaded (i.e. different interior cell, or outdoor cell not loaded into memory). This is regardless of whether the object is persistent or not.
User avatar
Elina
 
Posts: 3411
Joined: Wed Jun 21, 2006 10:09 pm

Post » Fri May 04, 2012 5:04 am

I can't rule out either of those completely - either one or the other has to be used . . .

I am curious why you say that. They are two completely different things. I can't imagine a situation where they would be mutually exclusive.



EDIT: I just ran a test: Gamemode blocks on objects won't run if the object isn't loaded (i.e. different interior cell, or outdoor cell not loaded into memory). This is regardless of whether the object is persistent or not.
True, but beware of http://cs.elderscrolls.com/index.php/Script_Processing.
User avatar
sally coker
 
Posts: 3349
Joined: Wed Jul 26, 2006 7:51 pm

Post » Fri May 04, 2012 2:05 pm

I am curious why you say that. They are two completely different things. I can't imagine a situation where they would be mutually exclusive.

Nope, they are truly not mutually exclusive and I'll probably end up using both solutions. What I was trying to say there is, that I have a choice between a solution which uses only GameMode scripts, or another which uses only Persistent References. The question was, which one of these should I use to a greater extend in order not to create performance problems or massive save file bloating.


True, but beware of http://cs.elderscrolls.com/index.php/Script_Processing.

Thank you for pointing this out. I don't think I could create unintentional heartbeating, but it definitely seems like something I will have to use at some point, since the remote containers and objects with OnUnequip and OnDrop blocks are of interest to me.


=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=


Thanks for the input and advices. I did some tests of my own to find out how bad the Persistent References are at bloating save files. From what I found out, it seems that a 100 Persistent References used the way I intend to manage to bloat the save file by 10kB. In the light of this I don't think players will have to worry about gargantuan save files caused by me. There will be more testing involved to make sure I did not make a mistake, but so far all seems safe for use.

If anyone has more to say about the impact of GameMode scripts and Persistent References on the game I am all ears and will gladly take any advice I can get from you wonderful people!
User avatar
Anna S
 
Posts: 3408
Joined: Thu Apr 19, 2007 2:13 am

Post » Fri May 04, 2012 7:32 pm

Not sure we are using the same terminology:

The only thing the Persistent flag does is to keep the Reference data in memory, while non-persistent references get unloaded with the cell.

Just turning the flag on should not add a single byte to the savegame and would have absolutely no impact on performance (except the fact that it will use 100-200 bytes of memory all the time).
The vanilla game keeps thousands of such data in memory all the time (cells, doors, NPCs etc)

What you do with it is what may use savegame space and or affect performance.

For example, if you have a script that moves the reference from its original CS location, the engine has to save the new position in the savegame, but this is also true for non-persistent references.

And if you do loops within loops in your gamemode blocks, you may affect performance, but, again, it does not matter if the reference is persistent or not.

Maybe if you give more details of your implementation alternatives, we may be more specific in our comments.
User avatar
Stephanie Valentine
 
Posts: 3281
Joined: Wed Jun 28, 2006 2:09 pm


Return to IV - Oblivion

cron