Ilias38rus 5 Posted January 17, 2016 How much resources do |getvariable command on unit| using? Share this post Link to post Share on other sites
whiztler 137 Posted January 17, 2016 Why don't you check it out yourself? https://community.bistudio.com/wiki/Code_Optimisation http://killzonekid.com/arma-scripting-tutorials-code-performance/ Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 17, 2016 Why don't you check it out yourself? https://community.bistudio.com/wiki/Code_Optimisation http://killzonekid.com/arma-scripting-tutorials-code-performance/ What, without making another useless thread first? 2 Share this post Link to post Share on other sites
zapat 56 Posted January 17, 2016 Can this be measured somehow at all? It might be a lot more problematic than it seems at first: eg: http://www.flounder.com/exceptions.htm but why do you care about such? "Wether checking nearestObjects in a 200 meter radius onEachFrame worth it" - would be a valid question, but unless you write something bigger than ACE3, I doubt such things will have any effect on your performance. Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 Can this be measured somehow at all? It might be a lot more problematic than it seems at first: eg: http://www.flounder.com/exceptions.htm but why do you care about such? "Wether checking nearestObjects in a 200 meter radius onEachFrame worth it" - would be a valid question, but unless you write something bigger than ACE3, I doubt such things will have any effect on your performance. Some precise question like: 1. while {true} do { { { if (_x in at) then { hint "t"; }; } foreach nearestObjects [_x, ["men"], 70]; } foreach atu; }; 2. while {true} do { { { _lv = at find _x; if (_lv != -1) then { hint "t"; }; } foreach nearestObjects [_x, ["men"], 70]; } foreach atu; }; 3. while {true} do { { { if (_x getvariable "pvt") then { hint "t"; }; } foreach nearestObjects [_x, ["men"], 70]; } foreach atu; }; What's better? Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 17, 2016 Your post doesn't make sense (who would have thought...) What kind of code is this? inarray, getvalue are script commands that currently do not exist in the game. Also, zapat already said more than needs to be said on this topic. Unless you call getvariable for hundreds (if not thousands) of units on each frame I doubt you'll notice any difference. Cheers Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 Your post doesn't make sense (who would have thought...) What kind of code is this? inarray, getvalue are script commands that currently do not exist in the game. Also, zapat already said more than needs to be said on this topic. Unless you call getvariable for hundreds (if not thousands) of units on each frame I doubt you'll notice any difference. Cheers Few mistakes in command's names, for how much units you think the code will be executed for? that you stupid posts without any purpose junking topics showing you like an idiots Share this post Link to post Share on other sites
nikiller 18 Posted January 17, 2016 hi, Few mistakes in command's names, for how much units you think the code will be executed for? that you stupid posts without any purpose junking topics showing you like an idiots Did you try to be more respectful towards people who are trying to help you by any chance? cya. Nikiller. Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 hi, Did you try to be more respectful towards people who are trying to help you by any chance? cya. Nikiller. I am to they who are is it? | \/ What, without making another useless thread first? Your post doesn't make sense (who would have thought...) What kind of code is this? inarray, getvalue are script commands that currently do not exist in the game. Also, zapat already said more than needs to be said on this topic. Unless you call getvariable for hundreds (if not thousands) of units on each frame I doubt you'll notice any difference. Cheers `````They think they know situation and do not trying to help with question (if i'm asking the question, it have cense). Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 17, 2016 Few mistakes in command's names, for how much units you think the code will be executed for? that you stupid posts without any purpose junking topics showing you like an idiots `````They think they know situation and do not trying to help with question (if i'm asking the question, it have cense). You seem to take things literally. Despite the obvious language barrier, I'm not the one throwing around insults. You can either keep your attitude and see where this will get you, or try to rephrase your problem so that someone else except you can make some sense out of it. I mean this in the least offensive way possible. Cheers Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 ~500 units, what's better `````(lowest resources taking, not the script's execution speed):0. adding them to array, add checking alive or isnull to all of them to remove from the array and for ~100 of them checking to all units in ~70m. presents in the array? 1. add variable to all of them, changing the variables, and for ~100 of them checking the variable at all units in ~70m.? Share this post Link to post Share on other sites
zapat 56 Posted January 17, 2016 Well, if you have 500 units, using getvariable or not will be your smallest performance concern. But use your brain: which command do you think needs less operations? Getting a variable (most basic thing in any environment) or looping through an array to get an element? Anyhow it seems that you'll need to performance meter more parts of your ideas, so do not start with what you should ask last. Read whiztler's links, there is a performance script in there. **saying KK or GOM not knowing the situation is a bit khmm. I know the situation too from the title alone, I am just a dead patient man. Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 Well, if you have 500 units, using getvariable or not will be your smallest performance concern. But use your brain: which command do you think needs less operations? Getting a variable (most basic thing in any environment) or looping through an array to get an element? Anyhow it seems that you'll need to performance meter more parts of your ideas, so do not start with what you should ask last. Read whiztler's links, there is a performance script in there. Thnk you for answer "Getting a variable (most basic thing in any environment)" the |'thinking link'| all what was needeble to write here. Share this post Link to post Share on other sites
zapat 56 Posted January 17, 2016 Man, then start with Coding for Dummies or something. You are coding. You ask coders about the highest levels of coding (usually the top level coders care about these questions). And you get upset when they don't care about you without you trying to understand the most basic things? Well, I may be not as patient as I think. :) Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 And one more question, why the script's execution speed counter on |"debug" interface| crashing game after checking: vt = 1; if (vt == 0) then { hint "t"; } else { if (vt == 1) then { hint "t1"; }; }; Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 Man, then start with Coding for Dummies or something. You are coding. You ask coders about the highest levels of coding (usually the top level coders care about these questions). And you get upset when they don't care about you without you trying to understand the most basic things? Well, I may be not as patient as I think. :) I'm do not trying to understand any of it, i'm thinking about thousands of other things, special about the situation: i meeted systems, even in the programming world, when in environment with multitudinous unsystematized entities they hadn't personal |information storages|, i didn't need to understand how it is here, just to think about it. Share this post Link to post Share on other sites
Greenfist 1863 Posted January 17, 2016 Might crash because of the 10000 hints. Or not. Doesn't crash for me. Share this post Link to post Share on other sites
Ilias38rus 5 Posted January 17, 2016 Might crash because of the 10000 hints. Or not. Doesn't crash for me. ))) at mine crashing every time i'm checking ) Share this post Link to post Share on other sites
Maio 293 Posted January 18, 2016 Stop throwing punches. If you fell like being snarky, at least do it via PM and not on the public boards. Good? Good! Have a beautiful day! Share this post Link to post Share on other sites
dreadedentity 278 Posted January 19, 2016 nearestObjects does not provide good performance. Especially using it in a while {true} loop. Your best bet is to create and maintain an array of all the objects and iterate through that, adding and removing objects as they are created or killed/destroyed. nearestObjects [player, [], 50] gave me frame stuttering even in VR with 4 objects on the map, so I would avoid it at all costs if you're worried about performance Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 20, 2016 . nearestObjects [player, [], 50] gave me frame stuttering even in VR with 4 objects on the map, so I would avoid it at all costs if you're worried about performance If you use it without no filters then yes, it might cause some performance problems, but even on a low power laptop running on battery, I don't get ANY drop in FPS in the specific example you give. The problem with nearest* commands is that they sort their results so as the radius goes up, the workload goes up exponentially. The tricks with nearestobjects are to do it at a non critical time, do it on the server only, use filters and keep the distance as short as you can. Or, as you say, write it to an array and work with that, but that's not very dynamic. nearObjects and nearestObject are good alternatives, given the right situation. Choose carefully. Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted January 20, 2016 I use a small 5m nearEntities check to assist the 'reveal' command, which helps the action menu/cursortarget. There should be ways to structure your script/scenario design to avoid having to use the nearestX commands during playing runtime. Also, worrying about the performance impact of 'getVariable' is a waste of time. Share this post Link to post Share on other sites
dreadedentity 278 Posted January 20, 2016 If you use it without no filters then yes, it might cause some performance problems, but even on a low power laptop running on battery, I don't get ANY drop in FPS in the specific example you give. The problem with nearest* commands is that they sort their results so as the radius goes up, the workload goes up exponentially. The tricks with nearestobjects are to do it at a non critical time, do it on the server only, use filters and keep the distance as short as you can. Or, as you say, write it to an array and work with that, but that's not very dynamic. nearObjects and nearestObject are good alternatives, given the right situation. Choose carefully. I would even avoid using it on the server, as server simulated fps ties into ai control and movement and can also have an effect on client fps. Just avoid using the command at all. There are better ways to do things. The array is absolutely the best way to do it and it is completely dynamic, not sure where you got that from. In your scripts you already have control over when units spawn, literally all you need is _obj = createUnit/createVehicle [INFO]; myUnitArray pushBack _obj; _obj addEventHandler ["killed", {myUnitArray = myUnitArray - [(_this select 0)]}]; Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted January 22, 2016 Some precise question like: 1. while {true} do { { { if (_x in at) then { hint "t"; }; } foreach nearestObjects [_x, ["men"], 70]; } foreach atu; }; 2. while {true} do { { { _lv = at find _x; if (_lv != -1) then { hint "t"; }; } foreach nearestObjects [_x, ["men"], 70]; } foreach atu; }; 3. while {true} do { { { if (_x getvariable "pvt") then { hint "t"; }; } foreach nearestObjects [_x, ["men"], 70]; } foreach atu; }; What's better? Do you really write your code like that or do you obfuscate it before posting it in the forums? Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted January 22, 2016 Do you really write your code like that or do you obfuscate it before posting it in the forums? I think he actually writes his variable names like that Share this post Link to post Share on other sites