fn_Quiksilver 1636 Posted November 11, 2014 (edited) Clean Up by Quiksilver v1.0.0 Armaholic Download This code will maintain healthy levels of all the crap that can build up over the course of a scenario. There is an integrated config to set your desired healthy limits. Handles: Bodies Destroyed vehicles Craters Weapon Holders (ground garbage) Static weapons (may conflict with scripts) Land mines (may conflict with scripts) Ruins Orphaned triggers http://feedback.arma3.com/view.php?id=19231 Empty Groups Stuff is removed on an oldest-first basis, to mitigate the chance of stuff deleting in-front of players. BIS remains collector does effectively the same thing for bodies and vehicles, but it does not account for weapon holders, craters, or ruins. Would be handy if BIS would include support for these things too, which can build up to quite large quantities over the course of a scenario. Edited October 15, 2015 by mdcclxxvi Share this post Link to post Share on other sites
SkillerPenguin 6 Posted November 21, 2014 Thanks for the message, will try it out in a bit! :) Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted November 24, 2014 Updated to include support for a long-outstanding BIS bug. The script now removes local MP triggers which are created by the engine on the player, and then sometimes orphaned and returned to the server, to accumulate in perpetuity. http://feedback.arma3.com/view.php?id=19231 Share this post Link to post Share on other sites
SavageCDN 231 Posted November 24, 2014 Nice thanks for releasing Share this post Link to post Share on other sites
Sari 18 Posted November 29, 2014 (edited) Nice work! Would you mind if i were to use just part of this to graft onto another cleanup cycle (namely the weaponholder, crater and orphaned trigger parts)? Naturally credits where due :) edit: On second look I only really need the orphaned trigger bit if at all possible? Edited November 29, 2014 by Sari Share this post Link to post Share on other sites
avibird 1 155 Posted November 29, 2014 @MDCCLXXVI will check it out I have been using repetitive_cleanup.sqf VERSION: 1.7 AUTHOR: aeroson. I am also looking for new scripts to improve game performance. Some of the newer players sometimes have a hard time setting up example mission from the above codes you provided. If you could link a basic example mission in the thread I am sure it will help a few players out trying to setup your script for use (: Share this post Link to post Share on other sites
jshock 513 Posted November 29, 2014 @MDCCLXXVI will check it out I have been using repetitive_cleanup.sqf VERSION: 1.7 AUTHOR: aeroson. I am also looking for new scripts to improve game performance. Some of the newer players sometimes have a hard time setting up example mission from the above codes you provided. If you could link a basic example mission in the thread I am sure it will help a few players out trying to setup your script for use (: It's pretty simple to put code into an sqf file and then call it in the initServer or the init.sqf file and then change the well commented global variables to change stuff up as each developer needs to. Maybe the people you are referencing could bring the issues they are having to this thread? Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted December 10, 2014 (edited) Updated with a few newer scripting commands and submitted to Armaholic. From time of this post, give it a little while for the links and everything to be active. Another update coming in about a week with some more nifty config features. It's done but in MP testing for now until confident it's stable and the updated code does what it's supposed to. Scratch that. Decided to go ahead and release the next one. Should be available whenever the armaholic link gets activated. The updated version: - More config options New delete logic: - If players nearby, will only start deleting on oldest-first basis when max threshold reached. - If no players or AI (whichever you specify) nearby, will delete regardless of threshold (saves the threshold for more important locations where the players or AI are). - You can choose to disable this for each object type. Edited December 10, 2014 by MDCCLXXVI Share this post Link to post Share on other sites
dimon 32 Posted December 11, 2014 (edited) Apologize in advance for my English. :D 1.Did you know that there is debris which local? This debris should be removed and on the server and on the client. for example: "CraterLong","WeaponHolder","Ruins" - this is a local garbage. 2. It was just horrible while {} do { while {} do {}; while {} do {}; while {} do {}; while {} do {}; while {} do {}; }; what kind of performance optimization here can we talk? If you want to achieve performance optimization at least need to hang clean up at the event (events) for example: _unit AddEventHandler ["Killed",{ _this spawn clean;}]; 3. replace all internal while {} do {}; on for "_i" from 0 to _cnt- 1 step 1 do {}; 4. As for me and how I do everything created by me in the mission put in different arrays and then work with their disposal as I want, but all that is not founded by me in the mission, and is created in the process (i.e. the same debris) is removed 3-4 lines of code, for example: {if ((count units _x)<1) then {deleteGroup _x;};} forEach allGroups; { if (( !(_x in the name of my array) && {!(_x in the name of my array)}...) then { deleteVehicle _x;};} forEach vehicles; { if ( !(_x in the name of my array) && {!(_x in the name of my array)}...) then { deleteVehicle _x;};} forEach allUnits; { if ( !(_x in the name of my array) && {!(_x in the name of my array)}...) then { deleteVehicle _x;};} forEach (allMissionObjects "all"); and so on through the list here you and cleaning and a little anti cheat... because everything that is not created by the author in the mission removed. Edited December 11, 2014 by Dimon Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted December 12, 2014 Apologize in advance for my English.:D 1.Did you know that there is debris which local? This debris should be removed and on the server and on the client. for example: "CraterLong","WeaponHolder","Ruins" - this is a local garbage. 2. It was just horrible while {} do { while {} do {}; while {} do {}; while {} do {}; while {} do {}; while {} do {}; }; what kind of performance optimization here can we talk? If you want to achieve performance optimization at least need to hang clean up at the event (events) for example: _unit AddEventHandler ["Killed",{ _this spawn clean;}]; 3. replace all internal while {} do {}; on for "_i" from 0 to _cnt- 1 step 1 do {}; 4. As for me and how I do everything created by me in the mission put in different arrays and then work with their disposal as I want, but all that is not founded by me in the mission, and is created in the process (i.e. the same debris) is removed 3-4 lines of code, for example: {if ((count units _x)<1) then {deleteGroup _x;};} forEach allGroups; { if (( !(_x in the name of my array) && {!(_x in the name of my array)}...) then { deleteVehicle _x;};} forEach vehicles; { if ( !(_x in the name of my array) && {!(_x in the name of my array)}...) then { deleteVehicle _x;};} forEach allUnits; { if ( !(_x in the name of my array) && {!(_x in the name of my array)}...) then { deleteVehicle _x;};} forEach (allMissionObjects "all"); and so on through the list here you and cleaning and a little anti cheat... because everything that is not created by the author in the mission removed. Hi, glad you already have a script that is working for you :) To address a couple of your points: 1. I am sorry, this is simply wrong. "craterLong", "weaponHolder" and "Ruins" are not local garbage. They are created by the engine via createVehicle command, which has global effect. If you as a connected client, create a craterLong with the createVehicle command, I as another connected client, will see it. If you create it via createVehicleLocal, I will not see it. Vehicles like butterflies, dragonflies, rabbits, dust motes, pollen ... These are local. You will see them, I will not. I will see my own. :) 2. What is the matter with the below? while {} do { while {} do {}; while {} do {}; while {} do {}; while {} do {}; while {} do {}; }; Aside from appearance, can you inform me any negative performance effect? As for event handler-based cleaning. That is nice, but incomplete, and must be tailored to each scenario. Someone using the script, I cannot reach in and attach event handlers to all their units. That is best done on their end, not mine. 3. Why should I replace all while loops with for loops? Are you thinking they are more performance efficient or just look prettier? Share this post Link to post Share on other sites
dimon 32 Posted December 12, 2014 (edited) 3. Why should I replace all while loops with for loops? Are you thinking they are more performance efficient or just look prettier? Hi, the use of cycle for "_i"... gives twenty-fold performance improvement over the other versions cycles. LoopsThese first two loop types are identical in speed (+/- 10%), and are more than 3x as fast the proceeding two loop types. for "_y" from # to # step # do { ... }; { ... } foreach [ ... ]; Where as these two loops are much slower, and for maximum performance, avoided. while { expression } do { code }; for [{ ... },{ ... },{ ... }] do { ... } https://community.bistudio.com/wiki/Code_Optimisation Edited December 12, 2014 by Dimon Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted December 12, 2014 Hi, the use of cycle for "_i"... gives twenty-fold performance improvement over the other versions cycles.https://community.bistudio.com/wiki/Code_Optimisation Thanks, running some tests now. I'll transition the 'while do' over to 'for do' this weekend and drop in credit for you. :) There is some difficulty using the speed of a for do loop when interacting with some engine arrays. As such, without restructuring, I have to insert a 'sleep 0.001' into a for do loop, while no sleep is necessary in a while do loop. However, if I insert a same-value sleep in for both methods, then the for do receives a 20% speed increase (not twenty-fold) over the do while. With no sleep, the for do fails after one iteration. There could be some work done to finesse it into functioning properly, such as gathering all the stuff that is going to be deleted into a proxy array, and delete those. Interacting with some engine arrays (such as allDead, allDeadMen, allMissionObjects) seems to give the for do loop some trouble. This does not work: (fails after one iteration) _t1 = diag_tickTime; _count = ((count allDeadMen) - _deadMenLimit); for "_i" from 0 to _count do { detach (allDeadMen select 0); deleteVehicle (allDeadMen select 0); }; (diag_tickTime - _t1) call fncDiag; Yet this does: _t1 = diag_tickTime; _count = ((count allDeadMen) - _deadMenLimit); for "_i" from 0 to _count do { detach (allDeadMen select 0); deleteVehicle (allDeadMen select 0); [color="#008000"][b]sleep 0.001;[/b][/color] }; (diag_tickTime - _t1) call fncDiag; I won't discount my testing methods as a possible cause of error, but quite a number of iterations were tested. With that structure and syntax, for do requires a sleep, yet while do does not. Share this post Link to post Share on other sites
dimon 32 Posted December 12, 2014 I have not tested, but try it this way: _t1 = diag_tickTime; _count = ((count allDeadMen) - _deadMenLimit); for "_i" from 0 to _count -1 step 1 do { detach (allDeadMen select 0); deleteVehicle (allDeadMen select 0); }; (diag_tickTime - _t1) call fncDiag; or _t1 = diag_tickTime; _count = ((count allDeadMen) - _deadMenLimit); for "_i" from 1 to _count step 1 do { detach (allDeadMen select 0); deleteVehicle (allDeadMen select 0); }; (diag_tickTime - _t1) call fncDiag; Share this post Link to post Share on other sites
3lockad3 11 Posted January 7, 2015 Thank you! I tested it and it does exactly what I have wanted for sooo long Cheers! Hope you get the rest sorted :) Just noticed all the stains left from the deleted bodies XD Share this post Link to post Share on other sites
winterbornete 12 Posted January 29, 2015 Any chance you could add a "do not clean up if within X distance of [ marker array]" functionality? I am working on a larger persistent mission and it includes player bases. I find this script cleans up vehicles at the base if players are too far. Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted January 29, 2015 (edited) Hi, Are you finding it cleans up good vehicles or destroyed vehicles? Last I checked, in the release version there is no provision for abandoned/good vehicles, only destroyed vehicles. Are you wanting to exclude destroyed vehicles which are near player bases? That is certainly possible however it would be a tailored solution and not included in the generic release version. To go about this, you would have to create a proxy array and then add 'approved for delete' vehicles to it from the (allDead - allDeadMen) array. Fairly simple but would require some care and tweaking for your scenario, due to the custom markers. I can't actually do much with the code for a few more weeks, as away from home at the moment and no desire to touch SQF from here :) Edited January 29, 2015 by MDCCLXXVI Share this post Link to post Share on other sites
Persian MO 82 Posted January 30, 2015 Nice script.Can you add a parameter for removing Abandoned vehicles? Share this post Link to post Share on other sites