pedeathtrian
Member-
Content Count
284 -
Joined
-
Last visited
-
Medals
Everything posted by pedeathtrian
-
Exactly. You need another Pearl Harbor. The whole Pearl Harbor thing was about allowing Japanese to make enough damage to not just get USA involved in WWII, but also be well backed up by its society. Everything was under control long before 12/7. Coincidences? I don't think so. You don't put explosives on certain floor to bring down the building. You put it evenly (does NOT mean on every floor) along all the height of the building. Check those failed building explosion videos on Youtube to see what I mean. Of course you don't bring down the skyscraper by putting explosives somewhere near 2/3 of its height. What you get there is topmost 1/3 falling off and 2/3 continuing to stand as if nothing happened. Or, more likely, even if you damage bearing constructions enough, topmost 1/3 will just sit on top of lowest 2/3 just because of its own weight and because of lowest 2/3 designed to carry much more than just weight of topmost 1/3.
-
Having all other things being equal, it should not be better. At first, select creates (returns) an array which is not there in initial variant. Here we have some slight memory and execution overhead. At second, additional iteration loop is having place because of forEach; in case of apply there will also be overhead caused by calls and storing their results back into array. At third, there will be no gains in terms of reducing initial operations count: no new corners to be cut, etc. select is still O(N) where N is number of elements in input (playableUnits). Having O(N) both ways, what matters is amount of operations performed on every iteration, e.g. you can win a (very tiny) bit in some places: like not creating _forEachIndex in select; and lose using extra calls, and extra memory. Consider measuring for different orders of magnitude of input's size to have a full and clear picture (esp. if not sure algorithm complexity is linear).
-
If you're that performance-concerned, don't forget to use distanceSqr instead of distance. And yeah, measuring everything will definitely not hurt.
-
What if _this is not an array, or, say, empty array? In first case you will examine it twice, whereas in the second case you will loop on _i only if you have valid iteration on _this' item. In general, if you have some loop possibly breaking, you better have it earlier (more outer).
-
What you call an agressive minority is 30-40 million people. All of them are terrorists? What they deserve is their own state. With their own territory, laws, military, etc. Hell, they alone could beat the shit out of that IS thingy long ago if not interfered by Erdogan, Putin, Assad, Western coalition and almost every other so called anti-ISIS conflict participant.
-
C++ Extension in mpmission
pedeathtrian replied to Koderz's topic in ARMA 3 - MISSION EDITING & SCRIPTING
There's no such wall if you can get memory locations of native code interpreting SQF commands. Intercept extension dll is loaded directly into arma's process address space, it can call whatever function it has address of. No SQF interpreting in execution chain. Last time I checked this was called reverse engineering and it was illegal in some countries. However this is what geeks do from time to time in, for example, "educational purposes", but ffs, you never present this to wide community as a programming interface to anything. IMHO. I wouldn't rely on such interface in any serious project. Nevetheless, some mindblowing hours were spent figuring all this out. Amazing work. Kudos. I see no relation, really. All these classes and cpp/hpp file extensions only bring more confusion. -
KGB took it through the tiny hole in the wall. They will clean it and put it back soon. Stay tuned.
-
Help me invert this script
pedeathtrian replied to emton's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This function does not check if some (specific) player is within some radius from position (or object). It checks if any player is within radius. I would name this function DMS_fnc_IsAnyPlayerNearby. So, inverting result of function will mean that there are no players at all within radius. Anyway, I discourage you from using this function since it uses nearEntities, which is costly, especially on bigger radiuses such as 2400 m. A better solution would be getting allPlayers and comparing their distanceSqr to squared threshold. params ["_pos", "_dis2"]; // squared distance! // ... check params _isFar = true; { if (alive _x) then { if (_pos distanceSqr _x <= _dis2) exitWith {_isFar = false}; } } forEach (allPlayers); // filter out HeadlessClients here if using them: (allPlayers - entities "HeadlessClient_F") _isFar This returns true if all alive players are far enough from _pos. If there are many such areas on the map (many missions), most of the time players will be far from such areas. That is both functions will run through their worst cases: loop through entire arrays returned by nearEntities for 2400m radius or (in my case) allPlayers. Θ(n) to only loop through the array. Not saying allPlayers will return much much faster. -
We don't have a luxury of using those tools with legacy ports here (we're in ARMA 3 - PORTS forum section).
-
Seems like ArmA 3 never treats -mod parameter as an absolute path. I've straced modded start of ArmA to see what happens: Command: cd /home/pedeathtrian/.steam/steam/SteamApps/common/Arma 3 strace -ff -o /mnt/memdisk/arma3 ./arma3.i386 -mod="/home/pedeathtrian/.steam/steam/SteamApps/workshop/content/107410/669962280" Here's all the output mentioning "669962280" As you can see, mod is never searched at its absolute location; instead this path used as relative from some locations (game dir and game docs dir). So, create a symlink in your Arma 3 directoty pointing to required mod, e.g. cd /home/pedeathtrian/.steam/steam/SteamApps/common/Arma 3 ln -s ../../workshop/content/107410/669962280 @ADR-97 Start with relative path passed as -mod parameter: -mod="@ADR-97" UPD. This exact mod will probably need some decapitalization as i contains capitals in names of some files. You can recreate mods directory tree in arma's directory, then populate it with symlink to every file in mod, decapitalized. Or use tools such as ciopfs.
-
expansion directory is here and weighs (only) 5.2 GiB, and I couldn't find a way to use it (so no Apex yet). I guess we have the same ArmA 1.58 as you had on Windows on April 21st, 2016 (or, I hope, on April 28th, hotfix). Except there's no launcher to manage mods and other settings, so you will have to cope with launch parameters in Steam. Very few active servers to play on, very few players to play with.
-
1.58 is out, but is unfortunately still way behind main branch. Again. Recent BI Tools produce content incompatible with even the most recent legacy port 1.58 (e.g. p3d version 71 and such). This makes recent versions of mods (e.g. CUP mods) unusable in legacy ports. Recently released missions use modern scripting commands, etc. All this makes Steam Workshop infrastructure unusable. Getting older versions of content is problematic or even impossible. So players not only limited in their experience because of inability to play with mainstream players, but also because of lack of content provided by community. All this legacy port thingy needs a bit more of forward compatibility.
-
No. Yes. Will not work for now.
-
Mission filename with removed trailing ".pbo" does just fine for template. If you're ok with selecting missions by admin every time (or voting by players), and setting parameters every time (or using defaults if there's no admin), then, as austin_medic said, you can omit this class entirely. Check server.cfg biki page for more details.
-
Issues when drawing buildings bounding box on map
pedeathtrian replied to tryteyker's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Rectangular marker's position is it geometrical center, while object's position is not necessarily coincide with its bounding box geometrical center. Hence the shift (probably). Anyway it would not hurt to calculate bounding box center for marker position. Replace line 28 with this: private _pos = (getPos _object) vectorAdd (((_box select 0) vectorAdd (_box select 1)) vectorMultiply 0.5); This will add correction for it if needed. You don't really need those modelToWorldVisual conversions, so replace lines 39-42 with this: _marker setMarkerSize [ abs ((_box select 0 select 0) - (_box select 1 select 0)), abs ((_box select 0 select 1) - (_box select 1 select 1)) ]; -
I had that issue fixed by using -mod="" start parameter (or with list of mods I usually use).
-
Best place in World to have a Arma 3 Server
pedeathtrian replied to a topic in ARMA 3 - SERVERS & ADMINISTRATION
Best place is where most of your players are so that most of them will have minimum ping possible. If you don't have players yet and want to find them, then look at areas with highest concentration of players, I guess, Europe and US. -
So you know the bug was minor? Tell us more about it, please. I'm pretty sure they pulled back for a reason (or reasons) and that reason was not to have you being frustrated and complaining on forums and not being able to play. As often happens, blocking issues appear right after you release stuff, and that could be the case. Also, the game itself being playable is not actually the entire release. My usual way of playing ArmA 3 involves using both legacy port of client and legacy port of dedicated server (which by the way was not released: it could have problems too). Patience, my friend, you will have you game when it's ready enough.
-
Confirming this issue. All team loses their maps when someone JIPs. So when I see (if I'm lucky) someone is joining, my first reflex is now to stash map into uniform, vest or backpack (that's enough actually). Or just have it always not in its slot, until its required. Not quite handy. At the same time GPS/UAV terminals are saved.
-
[SOLVED] How to get pointers and copies of arrays
pedeathtrian replied to sarogahtyp's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'd a bit extend, if you don't mind: To get a deep copy: _arrayCopy = + _array1; To get a shallow copy: _arrayCopy = [] + _array1; Example: _a = ["foo", "bar"]; _b = ["baz", "qux"]; _c = [_a, _b]; _d = +_c; // _d is no longer related to _a or _b _e = []+_c; // does not copy _a and _b, but copies pointers to their data _d select 0 set [0, "nobody expects"]; // _a is still ["foo", "bar"]; _d is [["nobody expects", "bar"], ["baz", "qux"]] _e select 0 set [0, "spanish inquisition"]; // _a is ["spanish inquisition", "bar"]; _d is [["nobody expects", "bar"], ["baz", "qux"]]; _e is [["spanish inquisition", "bar"], ["baz", "qux"]] In general, every time (incl. passing args to and returning from functions) you deal with array you deal with pointer to it only, unless you have explicit deep copying. Therefore if function creates copy of array it should inform user of it. Otherwise is very bad taste. UPD. Exactly. Therefore array exists while at least one variable (i.e. name in script) points to its data. You return from function, local pointer (not array) expires, external continues to hold that data. -
[Release] Dazzle the darkness
pedeathtrian replied to davidoss's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Flares, yes, but chemlights can work for quite a time. -
That's 1.58 update. Though no official information yet. Good news anyway!
-
[Release] Dazzle the darkness
pedeathtrian replied to davidoss's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Looks great! One little thing to fix: [_light, _size, _brth, _power, _color] remoteExecCall ["fn_setLight", 0, false]; to this: [_light, _size, _brth, _power, _color] remoteExecCall ["fn_setLight", 0, _light]; to make it more JIP-compatible. -
Individual Units Changes Gear after Entering Vehicle
pedeathtrian replied to weaponsfree's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What you are trying to do is probably better done with GetIn and/or GetInMan event handler than with trigger. You will have less code and more precision in what unit causes changes. Keep an eye on locality: where handlers are added and where they hit. -
[FEEDBACK] Do you use BIS_fnc_xxxxx functions? If you do....
pedeathtrian replied to killzone_kid's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Even more humbly I suggest this (with a bit of algorithmical improvement): /* Author: Joris-Jan van 't Land, optimized by Karel Moricky, modified by Grumpy Old Man, a bit more optimized by pedeathtrian Description: Function to select a random item from an array, taking into account item weights. The weights should be Numbers between 0 and 1, with a maximum precision of hundreds. Parameter(s): _this select 0: source Array (Array of Any Value) _this select 1: weights (Array of Numbers) Returns: Any Value selected item Example: [["apples","bananas","tractor"],[0.5,0.25,0.25]] call BIS_fnc_selectRandomWeighted TODO: [*] Algorithm is inefficient? */ params [["_array",[]],["_weights",[]]]; if !((count _array) isEqualTo (count _weights)) exitWith {"There must be at least as many elements in Weights (1) as there are in Array (0)!" call BIS_fnc_error; nil}; _weightsTotal = 0; _wCheckFail = false; { _x = _x param [0,0,[0]]; if (_x < 0) exitWith {_wCheckFail = true}; _weightsTotal = _weightsTotal + _x; } count _weights; if (_wCheckFail) exitWith {"Non-negative weights expected!" call BIS_fnc_error; nil}; if (_weightsTotal isEqualTo 0) exitWith {"The sum of weights must be larger than 0" call BIS_fnc_error; nil}; _return = []; _wCheckFail = true; _rnd = random _weightsTotal; { if (_rnd < _x) exitWith {_wCheckFail = false; _return = _array select _forEachIndex}; _rnd = _rnd - _x; } forEach _weights; _return Or, alternatively, this (uses slightly different approach and binary search (could win on large arrays)) /* Author: Joris-Jan van 't Land, optimized by Karel Moricky, modified by Grumpy Old Man, a bit more optimized by pedeathtrian Description: Function to select a random item from an array, taking into account item weights. The weights should be Numbers between 0 and 1, with a maximum precision of hundreds. Parameter(s): _this select 0: source Array (Array of Any Value) _this select 1: weights (Array of Numbers) Returns: Any Value selected item Example: [["apples","bananas","tractor"],[0.5,0.25,0.25]] call BIS_fnc_selectRandomWeighted TODO: [*] Algorithm is inefficient? */ params [["_array",[]],["_weights",[]]]; _cnt = count _array; if !(_cnt isEqualTo (count _weights)) exitWith {"There must be at least as many elements in Weights (1) as there are in Array (0)!" call BIS_fnc_error; nil}; _weightsTotal = 0; _weightsCumulative = []; _wCheckFail = false; { _x = _x param [0,0,[0]]; if (_x < 0) exitWith {_wCheckFail = true}; _weightsTotal = _weightsTotal + _x; _weightsCumulative pushBack _weightsTotal; } count _weights; if (_wCheckFail) exitWith {"Non-negative weights expected!" call BIS_fnc_error; nil}; if (_weightsTotal isEqualTo 0) exitWith {"The sum of weights must be larger than 0" call BIS_fnc_error; nil}; _rnd = random _weightsTotal; _min = 0; while {(_cnt-_min) > 1} do { private _mid = floor ((_cnt+_min)/2); private _midW = _weightsCumulative select _mid; if (_rnd < _midW) then { _cnt = _mid; } else { _min = _mid }; }; _array select _cnt My stats of processing same input: 100000 calls (all ordered for ["apples","bananas","tractor"]): Original: [50079,24896,25025] // 34.3989 sec; avg 0.000343989 Grumpy Old Man's version: [50399,24966,24635] // 14.572 sec; avg 0.00014572" (as you can see my machine is slower, but ratio is kept the same). My version 1: [50021,25117,24862] // 3.66309 sec; avg 3.66309e-005 My version 2 (with bin. search; makes almost no difference to previous due to very short array): [50116,25032,24852] // 3.66199 sec; avg 3.66199e-005 I also decided if check input weights, then they should all be non-negative. UPD. Also, in my version you're freed from limitation "weights should be Numbers between 0 and 1, with a maximum precision of hundreds", they just should be non-negative (and preferably not causing sum overflow; and not sum to zero)