Jump to content
LSValmont

Turning all map objects into super simple objects in EDEN.

Recommended Posts

convertedObjects = [];

{
	if (isNil {_x getVariable "preventSimple"}) then {
		private _interiorPositions = [];
		_interiorPositions = [_x] call BIS_fnc_buildingPositions;
		if (count _interiorPositions isEqualTo 0) then {
			if (lightIsOn _x != "ON" && lightIsOn _x != "AUTO") then {
				private _position = getPosWorld _x;
				private _vectorDirUp = [vectorDir _x, vectorUp _x];
				private _model = getModelInfo _x select 1;
				deleteVehicle _x;
				private _simpleObj = createSimpleObject [_model, _position];
				_simpleObj setVectorDirAndUp _vectorDirUp;
				convertedObjects = convertedObjects + [_x];
			};
		};
	};
} forEach (( allMissionObjects "building" - allMissionObjects "StreetLamp" ) select {
	!isClass( configFile >> "CfgVehicles" >> typeOf _x >> "UserActions" ) &&
	( getArray( configFile >> "CfgVehicles" >> typeOf _x >> "ladders" ) isEqualTo [] ) 
});

// add this command to the object's init to prevent it from going simple:
// this setVariable ["preventSimple", true];
// use this command to count how many objects were turned into simple objects by the script:
// count convertedObjects;
// for obvious reasons the script will not turn into simple objects the following objects:
// 1) Objects that have interiors 2) Objects that emmit light 3) Objects that have user acctions such as ladders, gates, street barriers etc.

The code above replaces all the mission objects (That are not units/vehicles, have no interiors and/or have no lights) with simple ones. I gain +10 FPS immediately after running that code in GLOBAL turning +2100 objects into simple objects on my reference mission. (The FPS increase will depend on how many objects you've added to your mission via EDEN editor). The reduction in stuttering is notorious. Combine this script with other optimization scripts such as view distance and you will get more additional frames than overclocking your CPU without all the dangers! 😉

 

Special thanks to  @Larrow

 

Question for the Arma Gurus: How can I save those results to the mission file so it is those same simple objects right from the start? (Without using such MP resource heavy script).

 

Thanks

  • Thanks 2

Share this post


Link to post
Share on other sites

The reason it saves so many frames is cause you're essentially making all mission content that inherits from CfgVehicles >> All into simple objects. This would include ai, vehicles, props, the lot. Everything placed in editor and created during runtime is affected.

Share this post


Link to post
Share on other sites
20 minutes ago, mrcurry said:

The reason it saves so many frames is cause you're essentially making all mission content that inherits from CfgVehicles >> All into simple objects. This would include ai, vehicles, props, the lot. Everything placed in editor and created during runtime is affected.

 

Any way we could alter this code to not include AIs and player units?

Share this post


Link to post
Share on other sites

You can do this manually in the Editor...

Just mouse-drag over any and all Objects to select several at once.

(you can also use Ctrl to select/unselect objects as needed also)

 

Then Right-click on one of those Object (now highlighted) and select "Attributes" from the Menu/List to apply settings to all those at once.

 

Icon Colors will also change and reflect the current state (red, grey, etc).

Share this post


Link to post
Share on other sites
Just now, Von Quest said:

You can do this manually in the Editor...

Just mouse-drag over any and all Objects to select several at once.

(you can also use Ctrl to select/unselect objects as needed also)

 

Then Right-click on one of those Object (now highlighted) and select "Attributes" from the Menu/List to apply settings to all those at once.

 

Icon Colors will also change and reflect the current state (red, grey, etc).

 

Yes but I noticed that some stuff don't allow that.

Share this post


Link to post
Share on other sites
3 hours ago, MrCrazyDude115 said:

 

Any way we could alter this code to not include AIs and player units?

 

12 hours ago, LSValmont said:

{ 
    private _position = getPosWorld _x;
    private _vectorDirUp = [vectorDir _x, vectorUp _x];
    private _model = getModelInfo _x select 1;
    deleteVehicle _x;
    private _simpleObj = createSimpleObject [_model, _position];  
    _simpleObj setVectorDirAndUp _vectorDirUp;
} forEach allMissionObjects "Building";

 

That should do the trick

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 2/4/2020 at 9:14 AM, Von Quest said:

You can do this manually in the Editor...

Just mouse-drag over any and all Objects to select several at once.

(you can also use Ctrl to select/unselect objects as needed also)

 

Then Right-click on one of those Object (now highlighted) and select "Attributes" from the Menu/List to apply settings to all those at once.

 

Icon Colors will also change and reflect the current state (red, grey, etc).

 

I did that to all my objects.

 

Then I run the command to turn just the objects under allMissionObjects "Building" into simple objects and still 2200 objects were not converted into simple units by the EDEN method compared to the CODE method. So there is an incredible amount of objects that can be turned into simple objects but the option doesn't show on the item's EDEN Attributes.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

buildings are already... "simple" though, don't see how it can make that much of a difference.

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, Dedmen said:

buildings are already... "simple" though, don't see how it can make that much of a difference.

 

Yeah but "Building" also includes most other placed objects not just buildings.

 

I've modified the code to include only objects that do not have interiors and I gained 5 FPSs still, not as much as originally but 5 from a single script is quite good IMHO.

 

The problem is that "Building" still included the fences gates, lifting barriers and walls with operable doors that I need to exclude somehow so that players can still use those.

Share this post


Link to post
Share on other sites

Updated the first post with updated code to exclude light sources from becoming Simple Objects.

 

I still don't know how to exclude interactive objects such as liftable barriers, fences, doors, ladders etc. but I have set a variable on them to manually prevent objects from going simple: this setVariable ["preventSimple", true];

Share this post


Link to post
Share on other sites

Maybe detect if an object has certain (or any?) Class Animations entries in its config?

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, Harzach said:

Maybe detect if an object has certain (or any?) Class Animations entries in its config?

And class userAction's ?

  • Like 3

Share this post


Link to post
Share on other sites
10 hours ago, Larrow said:

And class userAction's ?

 

How would you add that to the code?

Share this post


Link to post
Share on other sites
5 hours ago, LSValmont said:

How would you add that to the code?

_hasActions = isClass( configFile >> "CfgVehicles" >> typeOf _object >> "UserActions" );
_hasLadders = isArray( configFile >> "CfgVehicles" >> typeOf _object >> "ladders" );

?

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites
7 minutes ago, Larrow said:

_hasActions = isClass( configFile >> "CfgVehicles" >> typeOf _object >> "UserActions" );
_hasLadders = isArray( configFile >> "CfgVehicles" >> typeOf _object >> "ladders" );

?

Would this work?

forEach allMissionObjects "building" - allMissionObjects "StreetLamp" - allMissionObjects "UserActions" - allMissionObjects "ladders";

Share this post


Link to post
Share on other sites
19 minutes ago, LSValmont said:

Would this work?

forEach allMissionObjects "building" - allMissionObjects "StreetLamp" - allMissionObjects "UserActions" - allMissionObjects "ladders";

No because they are not mission objects. They are object class members.

Something like...

{
	
}forEach (( allMissionObjects "building" - allMissionObjects "StreetLamp" ) select{
	!isClass( configFile >> "CfgVehicles" >> typeOf _x >> "UserActions" ) &&
	( getArray( configFile >> "CfgVehicles" >> typeOf _x >> "ladders" ) isEqualTo [] ) 
});

 

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites
18 hours ago, Larrow said:

No because they are not mission objects. They are object class members.

Something like...


{
	
}forEach (( allMissionObjects "building" - allMissionObjects "StreetLamp" ) select{
	!isClass( configFile >> "CfgVehicles" >> typeOf _x >> "UserActions" ) &&
	( getArray( configFile >> "CfgVehicles" >> typeOf _x >> "ladders" ) isEqualTo [] ) 
});

 

 

You are "THE" man  @Larrow (Besides you got your own Arma 3 campaign now! Congrats!)

 

Updated the first post!

  • Haha 1

Share this post


Link to post
Share on other sites
12 hours ago, LSValmont said:

 

You are "THE" man @Grumpy Old Man! (Besides you got your own Arma 3 campaign now! Congrats!)

 

Updated the first post!

The post you're quoting is from @Larrow though, I didn't even post in this thread, heh.

 

Cheers

  • Haha 3

Share this post


Link to post
Share on other sites
5 hours ago, Grumpy Old Man said:

The post you're quoting is from @Larrow though, I didn't even post in this thread, heh.

 

Cheers

 

Yeah sorry about that, fixed it! Thanks for the heads up!

 

PS: Perhaps internally my subconscious believes you both are the same guy under different aliases 😃 =p

  • Haha 2

Share this post


Link to post
Share on other sites
5 hours ago, LSValmont said:

Perhaps internally my subconscious believes you both are the same guy under different aliases

:shhh:😉 😛

  • Like 1
  • Haha 5

Share this post


Link to post
Share on other sites
On 2/6/2020 at 4:14 AM, LSValmont said:

PS: Perhaps internally my subconscious believes you both are the same guy under different aliases 😃 =p

They are easy to confuse because they are both total sqf ARMA badasses that are super helpful all the time!  😍:respekt:

The only way I can tell them apart is one of them favors the dancing banana...:yay:

  • Like 1
  • Haha 4

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×