Guest Posted July 5, 2014 Posted July 5, 2014 Kids need a better-motivated education. I never studied anything. That was boring and I had more important things to do. You always can find more important things to do, school is worse than work because they don't pay you but still you must go there and waste a lot of time every day... at least that was in my mind when I was teenie, and only the years changed my perspective of things... I never regret the past, wonderful things happened and if I were dedicating more time to the study probably they wouldn't have happened. But well... I completely agree, kids need more motivation or they often will think that algebra and stuff like that are a waste of time...
Guest tomm434 Posted July 5, 2014 Posted July 5, 2014 You have a point. the engine could be smart enough to do it only once since the value won't change when it will be executed the second time in a row. I... don't know if I explained well my feeling... The question whether -people were smart enought to make it understand. They might have not expected someone calling multiple getdistance in 1 frame. P.S.And even in the empthy cell you can't guarantee that experiment will be clear. You need to switch off all vanilla quests first.
nyaalich Posted July 5, 2014 Posted July 5, 2014 My concern (because I can't get it straight or don't know how to magically gauge how much of something can take place in one frame) is cycling (looping) through an array of references to determine the one that is closest to the player. I was going to do this with a UDF.
Guest Posted July 5, 2014 Posted July 5, 2014 P.S.And even in the empthy cell you can't guarantee that experiment will be clear. You need to switch off all vanilla quests first. You will never have a 100% clean environment, the engine works on its own, below. But at least you can do your best to reduce the possibilities of external interferences. As I said I took very seriously Cipscis tests but it would be nice to know the environment where he tested them, he only specifies a couple of times the differences if there are many or few npcs. And repeating the same test many times, comparing the results and doing a mathematic average of them (which is different than simply increasing the number of operations in my opinion)
Guest Posted July 5, 2014 Posted July 5, 2014 My concern is cycling (looping) through an array of references to determine the one that is closest to the player. I was going to do this with a UDF. That's exactly what I was meaning. In my opinion it cycles on the loaded refs in the current cell, does the math (involving sin and position) and then repeats, but not continuously. Since doing that should be still heavy, it cycles it with a certain timing / delay, which is small at the point that you will see an enemy taking instantly the aggro on you, but is big concerning the number of operations it could make in a second. Just like if you put a 0.1 on a quest delay time, just to make an example. I also think that calling GetDistance will force it to re-do the operation instantly, that's why GetDistance is considered slow. But as I said, these are just my feelings.
nyaalich Posted July 5, 2014 Posted July 5, 2014 SetQuestDelay: Does anyone know if the script runs at least once every load/reload, or does it continue from the amount of time that has elapsed since it last ran from the previous load? I have a script that I need to run only at load/restart to make sure that an item is in the PC's inventory. If I set the delay to 99 (or higher), will it run at load/restart?
jaam Posted July 5, 2014 Posted July 5, 2014 yes, but after 99s You're better leaving the questdelay as the default. GetGameRetstarted and GetGameLoaded are probably faster than whatever you can come up to avoid them
nyaalich Posted July 5, 2014 Posted July 5, 2014 I just don't want unnecessary script runs, even though it'll clearly fail the restarted/load check every time after the first. : P
nyaalich Posted July 5, 2014 Posted July 5, 2014 There isn't a way to force the player to put their pip-boy down (as in...pip-boy up and looking at inventory...back to game), is there?
Guest tomm434 Posted July 5, 2014 Posted July 5, 2014 Yep. http://www.gribbleshnibit.com/projects/NVSEDocs/#TapKey http://www.gribbleshnibit.com/projects/NVSEDocs/#MenuTapKey and tapcontrol is even better(because some people don't use default keyboard settings) http://www.gribbleshnibit.com/projects/NVSEDocs/#TapControl
nyaalich Posted July 5, 2014 Posted July 5, 2014 Doesn't have a direct correlation to the pip-boy unless "MenuMode" == Pip-Boy. EDIT: About to test a script with it now, so I'll let you know.
Halstrom Posted July 5, 2014 Author Posted July 5, 2014 I just don't want unnecessary script runs, even though it'll clearly fail the restarted/load check every time after the first. : PIn my experience I wouldn't be checking any non-vanilla formlists or for non-vanilla items in formlists or inventories till 10 seconds after GameRestart/Reload as I've noticed a lot of things return <NULL> references or 0 in GetDistance etc. The NV DLC's take around 7 secs to be added, for that reason I have a startup counter global in SCR that my SCR dependant mods wait for to reach 11-13sec before fully starting up the mod, before that I only add stuff to formlists not read them
nyaalich Posted July 6, 2014 Posted July 6, 2014 I'm guessing that it's more efficient to use more variables and assign a function's output to it rather than including the function in an if, etc. In the particular case, I'm looking at essentially While num < ar_size array. Better to assign ar_size array to a variable prior to the while loop, yes? Is that a thing to do in general, or is it better to not bother with things like that (if player.itemcount vs. int := player.item count; if int == X)?
nyaalich Posted July 6, 2014 Posted July 6, 2014 Weirdness: Was trying to add a "set variable" statement to an On End result script for a package. Let CompanionREF.varname := X kept bitching at me that it couldn't find the varname. Set CompanionREF.varname to X worked fine. Oddity of packages or needed a block w/ compiler override?
Guest Posted July 6, 2014 Posted July 6, 2014 Weirdness: Was trying to add a "set variable" statement to an On End result script for a package. Let CompanionREF.varname := X kept bitching at me that it couldn't find the varname. Set CompanionREF.varname to X worked fine. Oddity of packages or needed a block w/ compiler override? When I setted them last time I still didn't switch to NVSE 4. Nice to know if you found that one, if you or someone else could confirm. That's important to know, if you consider that in end dialogue you won't use CO
Guest tomm434 Posted July 6, 2014 Posted July 6, 2014 Nyaalich, "let" doesn't work with references in NPC's object script directly. Had the same issue.
nyaalich Posted July 6, 2014 Posted July 6, 2014 Funny. When I used Let, I exchanged the name of the ref with the name of the base just to see what would happen, and it bitched at me that it wanted a reference. If you want to work with reference, do us all a favor and actually work with the references. Good to know. Thanks, tomm.
Guest tomm434 Posted July 6, 2014 Posted July 6, 2014 I exchanged the name of the ref with the name of the base How did you manage to do that? GECK throws an error when you try to give ref the same name as base object
nyaalich Posted July 6, 2014 Posted July 6, 2014 No, I swapped the ref for the base in the statement, not the actual names of the base and the ref objects.
prideslayer Posted July 6, 2014 Posted July 6, 2014 Tomm (and others), There's such a thing as too much optimization for performance, especially when you're working from your gut and not from hard data. However 'heavy' any native or NVSE function is, you can almost guarantee it will be lighter than anything you can come up with in GECK script. If you're going to be calling something a lot and think it might hurt performance, just write a quick loop script and test it. Preemptively optimizing at best just wastes your time (usually), and at worst has exactly the opposite effect. As far as what is 'heavy' vs 'light', there's a much easier distinction. Anything that (potentially) modifies the 3D scene graph should be considered heavy. These are function calls that almost always don't actually take effect until several frames after they're called. Removing clothing items, adding/removing visual effects, placing/removing items in the world (rather than inventory), and so on. Everything else is very light by comparison. Even the heaviest of the light calls are still lighter than doing something as simple as 'placeatme'. Getdistance in particular I bet is very high performance, as the code behind it (the actual distance calculation) is used heavily within the engine for checking range to activators of various kinds and so on.
jaam Posted July 6, 2014 Posted July 6, 2014 I'm guessing that it's more efficient to use more variables and assign a function's output to it rather than including the function in an if, etc. In the particular case, I'm looking at essentially While num < ar_size array. Better to assign ar_size array to a variable prior to the while loop, yes? Is that a thing to do in general, or is it better to not bother with things like that (if player.itemcount vs. int := player.item count; if int == X)? As long as array size does not change during the loop, accessing the variable will be faster
Guest tomm434 Posted July 6, 2014 Posted July 6, 2014 Tomm (and others), There's such a thing as too much optimization for performance, especially when you're working from your gut and not from hard data. However 'heavy' any native or NVSE function is, you can almost guarantee it will be lighter than anything you can come up with in GECK script. If you're going to be calling something a lot and think it might hurt performance, just write a quick loop script and test it. Preemptively optimizing at best just wastes your time (usually), and at worst has exactly the opposite effect. As far as what is 'heavy' vs 'light', there's a much easier distinction. Anything that (potentially) modifies the 3D scene graph should be considered heavy. These are function calls that almost always don't actually take effect until several frames after they're called. Removing clothing items, adding/removing visual effects, placing/removing items in the world (rather than inventory), and so on. Everything else is very light by comparison. Even the heaviest of the light calls are still lighter than doing something as simple as 'placeatme'. Getdistance in particular I bet is very high performance, as the code behind it (the actual distance calculation) is used heavily within the engine for checking range to activators of various kinds and so on. Ok, message received .I'll stop grumbling about unoptimised scripts from now on.
prideslayer Posted July 6, 2014 Posted July 6, 2014 There are good reasons to put function results you call a lot in vars. It makes things more readable for one (if you name the var sanely), and it also makes it easier to change how the var gets set. I'm not suggesting anyone not do it for those reasons, but don't be too worried about performance. As script languages go the geck is pretty slow. That said, in the eyes of a CPU, a frame is a *looooong* time. At 100 fps, a modernish CPU can easily do a billion floating point operations every frame. Things like arctan, sqrt, and simple value lookups like getting an actor value are peanuts. It's the virtual call stack that's slow -- lots of function calls in a loop, regardless of them being native or nvse, math or lookup. This is why 10,000 sqrt's in a loop is 'bad' even though that isn't 1/100,000th the capability of the machine.
jaam Posted July 6, 2014 Posted July 6, 2014 The Let issue is the symptom of a bigger issue. Looks like I will have to research it. At least it is caught by the compiler.
Guest tomm434 Posted July 6, 2014 Posted July 6, 2014 The Let issue is the symptom of a bigger issue. Looks like I will have to research it. At least it is caught by the compiler. Sounds serious as hell.Care to explain it please?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now