Difference between revisions of "User talk:ShadowDancer"
imported>ShadowDancer (Possible ways to minimize performance drops) |
imported>DragoonWraith (an idea) |
||
Line 27: | Line 27: | ||
::::::::[[User:ShadowDancer|ShadowDancer]] 04:52, 8 July 2006 (EDT): Ah, I can see why. Damn, thats going to be a massive script. Well, on the bright side, you could make it only fire when the player comes within some range of an NPC. Its not like you need to do all of the NPCs at once. I suppose it could bog down in some instances like the final Oblivion gate in Bruma perhaps. You would have to test it and see. The trick doing it that way would be to keep track of whether or not someone's name has been changed. Set a flag on the NPC? Possibly add a dummy faction like the NameFaction? It seems like that would probably be the easiest way to track the NPCs. That should actually cut down on the performance issues. | ::::::::[[User:ShadowDancer|ShadowDancer]] 04:52, 8 July 2006 (EDT): Ah, I can see why. Damn, thats going to be a massive script. Well, on the bright side, you could make it only fire when the player comes within some range of an NPC. Its not like you need to do all of the NPCs at once. I suppose it could bog down in some instances like the final Oblivion gate in Bruma perhaps. You would have to test it and see. The trick doing it that way would be to keep track of whether or not someone's name has been changed. Set a flag on the NPC? Possibly add a dummy faction like the NameFaction? It seems like that would probably be the easiest way to track the NPCs. That should actually cut down on the performance issues. | ||
[[User:DragoonWraith|<font face="Oblivion,Daedric" size=3>D</font>ragoon <font face="Oblivion,Daedric" size=3>W</font>raith]] [[User_talk:DragoonWraith|<font face="Oblivion,Daedric" size=2>TALK</font>]] 14:41, 8 July 2006 (EDT): (going back to the left margin) I can already check to make sure that I'm not renaming someone who's already been named. That would mess things up. And I'll only do everyone in a given cell, though in Exteriors that still could be a lot of people. I have several ideas on keeping performance hits to a minimum, I'm not overly worried about it. | |||
Here's a thought: | |||
float random ;between 1-1000 | |||
[...] | |||
if ( random < 500 ) | |||
if ( random < 100 ) | |||
if ( random < 50 ) | |||
if ( random == 1 ) | |||
[...] | |||
elseif ( random == 2 ) | |||
[...] | |||
elseif ( random == 3 ) | |||
[...] | |||
elseif ( random == 49 ) | |||
[...] | |||
endif | |||
else | |||
if ( random == 50 ) | |||
[...] | |||
elseif ( random == 100 ) | |||
[...] | |||
endif | |||
endif | |||
elseif ( random < 200 ) | |||
[...] | |||
elseif ( random < 300 ) | |||
[...] | |||
elseif ( random < 400 ) | |||
[...] | |||
else | |||
[...] | |||
endif | |||
else | |||
if ( random < 600 ) | |||
if ( random < 550 ) | |||
[...] | |||
else | |||
[...] | |||
endif | |||
elseif ( random < 700 ) | |||
[...] | |||
elseif ( random < 800 ) | |||
[...] | |||
elseif ( random < 900 ) | |||
[...] | |||
else | |||
[...] | |||
endif | |||
endif | |||
At most, 59 If checks to run. Comparing a number to a variable produces negligible performance hit - I think the computer can handle 59 variable-number comparisons when the player first enters a cell. |
Revision as of 13:41, 8 July 2006
Dragoon Wraith TALK 11:59, 22 June 2006 (EDT): Regarding update to Effect Shader at 7:40 June 22, 2006, which you marked a minor edit - that is not a minor edit. Please, only mark spelling/grammar fixes and formatting changes as minor. Any time you add or change the information in an article, that is a major change, and should not be marked as minor. Thank you.
- Dragoon Wraith TALK 01:00, 4 July 2006 (EDT): Ah, don't worry about it, just letting you know.
Dragoon Wraith TALK 15:16, 6 July 2006 (EDT): Thanks for looking into CreateFullActorCopy and SetActorFullName. I'm wondering, you mentioned in my talk page that something contradicted what was in the article - which of the articles, and what was contradictory?
- ShadowDancer 19:32, 6 July 2006 (EDT): In the SetActorFullName article it says "Note that while the function is called on a reference, it actually changes the name of the base object, so all instances of that NPC/creature will have a new name." Maybe I am misreading what its saying, but to me it reads as if I were to change the display name on a skeleton to 'George the Skeleton', it changes every instance of the display name on skeletons in the game to display 'George the Skeleton'.
- Out of curiousity....Is this like a spell effect that will effect random characters? Or is it something that will only effect a few specific individuals? Because you could always create a "shadow world" containing a few copies to be brought out on command if that's the case, and then could just shuttle them back into the "shadow world" when done with them for the moment.
- Dragoon Wraith TALK 22:14, 6 July 2006 (EDT): Actually, the idea is that I'll automatically hit every NPC with a scripted spell that will check if they are any one of a list of IDs (namely, the list of every NPC in the game whose name is "Bandit" or "Guard" or whatever), and based on which ID they are, add a scripted ability to them which will randomly choose a name and apply it to them. This would be awesome, if SetActorFullName only affected references, but if it affects objects, I have a problem (namely, every Necromancer in the game will be "Kiriaden the Foul" or something, instead of all of them getting a unique name).
- Your tests show that either CreateFullActorCopy creates a new object or that SetActorFullName in fact only affects each reference (or both, which works just fine for me). Unfortunately for me, I suspect the former is true, which makes the latter less likely. More testing will have to be done. I'll have access to an Oblivion-capable computer soon... I hope.
- ShadowDancer 22:41, 6 July 2006 (EDT): Ah I see what you are saying. I think it will depend on how you hit each NPC. If you can check the xxxRef of the NPC, I think you can do a SetActorFullName without to much trouble (aside from hitting all the correct NPCs). Now that I am thinking about it, I wonder if maybe the name change for all objects is due to trying to do a name change on the base model NPC/creature??? I will have to see about it when I get home tonight and have access to Oblivion.
- ShadowDancer 04:59, 7 July 2006 (EDT): OK, I have checked through the NPCs and most of them are unique with all of the city guards with more than one copy having an editor ID reference (there are only a couple of them however). Most of the NPCs occur only once, with exceptions like the Blackwood Company Guards and some Mythic Dawn Assassins. These do not have any editor ID reference so changing the name on any will indeed change the name on all of them. There are only a few that are done this way in various places. This also won't take into account any created actors off of the base reference model if someone duplicates them someplace in the game. I may also have inadvertantly missed some so you might want to double check and see when you get access to Oblivion.
- Dragoon Wraith TALK 10:03, 7 July 2006 (EDT): Thanks again for your help. Regarding the number of copies of the 'generic' NPCs, most of them are in levelled lists, meaning they spawn all over the place, but you wouldn't get that information from the Use Info page. Use Info will tell you what levelled lists they appear in, and then you'd have to check each list to see how often each is used. Basically, it comes down to a lot of references of the same object (the NPC) over and over again. This is kind of sad (Morrowind had names for just about everyone, only guards didn't get their own names, because they respawned and there were infinite guards). I don't like the generic names.
- It looks like I'll have to CreateFullActorCopy each one, delete the original, and name the copy. The obvious problem with this is that the copy isn't a completely accurate copy, which is a great shame. The good thing is that I'm dealing with a limited number of objects, so it's do-able. It's just going to take a long time to do.
- The other issue is that this could theoretically cause serious lag, since these scripts will have to run on just about everyone in the game. The good thing is that there's a lot of room for optimization, and they only have to run once.
- ShadowDancer 14:57, 7 July 2006 (EDT): OK, now you have me curious about another thing. How are you creating a list of names? I can't find anything about using string values anywhere which is what is necessary for the names. Or were you going to set a random number in a variable and have a large number of if-then statements?
- Dragoon Wraith TALK 21:36, 7 July 2006 (EDT): The latter, hence my worry about performance...
- ShadowDancer 04:52, 8 July 2006 (EDT): Ah, I can see why. Damn, thats going to be a massive script. Well, on the bright side, you could make it only fire when the player comes within some range of an NPC. Its not like you need to do all of the NPCs at once. I suppose it could bog down in some instances like the final Oblivion gate in Bruma perhaps. You would have to test it and see. The trick doing it that way would be to keep track of whether or not someone's name has been changed. Set a flag on the NPC? Possibly add a dummy faction like the NameFaction? It seems like that would probably be the easiest way to track the NPCs. That should actually cut down on the performance issues.
Dragoon Wraith TALK 14:41, 8 July 2006 (EDT): (going back to the left margin) I can already check to make sure that I'm not renaming someone who's already been named. That would mess things up. And I'll only do everyone in a given cell, though in Exteriors that still could be a lot of people. I have several ideas on keeping performance hits to a minimum, I'm not overly worried about it.
Here's a thought:
float random ;between 1-1000 [...] if ( random < 500 ) if ( random < 100 ) if ( random < 50 ) if ( random == 1 ) [...] elseif ( random == 2 ) [...] elseif ( random == 3 ) [...] elseif ( random == 49 ) [...] endif else if ( random == 50 ) [...] elseif ( random == 100 ) [...] endif endif elseif ( random < 200 ) [...] elseif ( random < 300 ) [...] elseif ( random < 400 ) [...] else [...] endif else if ( random < 600 ) if ( random < 550 ) [...] else [...] endif elseif ( random < 700 ) [...] elseif ( random < 800 ) [...] elseif ( random < 900 ) [...] else [...] endif endif
At most, 59 If checks to run. Comparing a number to a variable produces negligible performance hit - I think the computer can handle 59 variable-number comparisons when the player first enters a cell.