Arma 3
ZEUS WARGAME [RTS mod]
Redarmy 13 May, 2024 @ 7:29am
Livonia excess object deletion
// hide (delete) terrain objects for better map performance
// percentages for deletion
_rock_perc = 35;
_tree_perc = 30;
_bush_perc = 40;
_fence_perc = 15;
_wall_perc = 15;


_rock_fac = round (100 / _rock_perc);
_tree_fac = round (100 / _tree_perc);
_bush_fac = round (100 / _bush_perc);
_fence_fac = round (100 / _fence_perc);
_wall_fac = round (100 / _wall_perc);


// get all specific terrain objects
// 3,513
_rocks = nearestTerrainObjects [[worldSize/2, worldSize/2], ["ROCK"], (worldSize * 1.41) , true, true];

// 101,960
_trees = nearestTerrainObjects [[worldSize/2, worldSize/2], ["TREE"], (worldSize * 1.41) , true, true];

// 288,461
_bushes = nearestTerrainObjects [[worldSize/2, worldSize/2], ["BUSH"], (worldSize * 1.41) , true, true];

// 11,189
_fences = nearestTerrainObjects [[worldSize/2, worldSize/2], ["FENCE"], (worldSize * 1.41) , true, true];

// 14,190
_walls = nearestTerrainObjects [[worldSize/2, worldSize/2], ["WALL"], (worldSize * 1.41) , true, true];



//delete given percentage of terrain objects (not randomly cause it will be done on each machine locally and should be the same)
{
if((_forEachIndex + 1) % _rock_fac isEqualTo 0) then {_x hideObject true;};
} forEach _rocks;

{
if((_forEachIndex + 1) % _tree_fac isEqualTo 0) then {_x hideObject true;};
} forEach _trees;

{
if((_forEachIndex + 1) % _bush_fac isEqualTo 0) then {_x hideObject true;};
} forEach _bushes;

{
if((_forEachIndex + 1) % _fence_fac isEqualTo 0) then {_x hideObject true;};
} forEach _fences;

{
if((_forEachIndex + 1) % _wall_fac isEqualTo 0) then {_x hideObject true;};
} forEach _walls;
< >
Showing 1-1 of 1 comments
Jacktheviper  [developer] 14 May, 2024 @ 12:36am 
Thanks, that's a pretty neat script.
Last edited by Jacktheviper; 14 May, 2024 @ 12:36am
< >
Showing 1-1 of 1 comments
Per page: 1530 50