Jump to content
GEORGE FLOROS GR

GF Dynamic Simulation script [solved]

Recommended Posts

Hello there to Everyone ,

 

 

i'm trying to create a dynamic Simulation scrpt , but to be honest , i don't know really  if the current is working or not !

I 'm not also sure about dynamicSimulationSystem generally , because i haven't seen this working on another script either !

 

 

My try below for everyone :

- deleted

any help will be much appreciated !

 

Thank you very much !!!

_______________________________________________________________________________________________________________

 

the solution :

 

On 2/24/2019 at 11:37 PM, GEORGE FLOROS GR said:

first add:

 

enableDynamicSimulationSystem true;

 

then add a line for the spawned groups ,


_Group enableDynamicSimulation true;

 

and also Demellion has add this :

https://community.bistudio.com/wiki/setDynamicSimulationDistance

 


[] spawn {
	while {true} do {
		
		if (cameraView isEqualTo "GUNNER") then {
			"Group" setDynamicSimulationDistance (viewDistance - (viewDistance * fog));	// Scoped 	
			
			
		} else {
		
			"Group" setDynamicSimulationDistance ((viewDistance * 0.8) - (viewDistance * fog));	// Not scoped 
		};
			
		uiSleep 0.25; 
	};
};

 

10 hours ago, GEORGE FLOROS GR said:

Bellow a simple full example :

 


_Pos = [] call BIS_fnc_randomPos;
_Group = createGroup east;

for "_x" from 0 to (2 + random 10) do {

_Unit = _Group createunit [selectrandom "O_G_Soldier_F",_Pos,[],0,"None"];
[_Unit] JoinSilent _Group;
(leader _Group) setSkill 0.75 + random 0.25;
_Unit setSkill 0.50 + random 0.50;
};

[_Group,_Pos,250 + random 150] call BIS_fnc_taskPatrol;
_Group enableDynamicSimulation true;

 

  • Like 2

Share this post


Link to post
Share on other sites

I 'm starting thinking as reading , that i may have messed , what it is about the :

 

https://community.bistudio.com/wiki/enableSimulation

and the

https://community.bistudio.com/wiki/enableDynamicSimulationSystem

 

What i would like to do :

 

is to create a freeze script , in a certain distance for units and once freezed then to hide them as well and the same about the objects .

 

Thanks !

 

- I will add this in a quote up.

  • Like 1

Share this post


Link to post
Share on other sites

I havent looked to much at enablesimulation or enabledynamicsimulation.  I think you may want some way to filter things. Maybe filter it by side. If you are playing bluefor and finish a task(s).  Then call for an evac helo  and it is over 2000 meters away. Will the helo be able to "wake up" or will it stay dormant and hidden. Same with any type of support on the map.  If the support is greater than the distance. Maybe a variable to exclude certain units. I maybe wrong in my assumption , I am just not that familiar with those BIS commands 

 

Edit:

Thought of one other thing. If a unit is mission specific and has commands in its init or is used in a .sqf. Will enabling  or disabling it mess up the scripting for said unit.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks nomadd !

 

Generally , it's all about performance , when spawning large numbers of units and items.

 

I have thought so far some alternatives for this code , so i need to test some stuff !

By the way any similar script available out there ?!

Share this post


Link to post
Share on other sites

Thank you very much gaverio !

 

I have already see this , played and check as well , from the old time that came out , but generally i'm trying for something easier and different , plus the ai are not freezing actually in this script ( as i have understand so far , only hide )

 

Thanks again though!!  :thumb:

Share this post


Link to post
Share on other sites
14 minutes ago, baton1990 said:

Looking forward to try it, thanks. I think it help a lot with fps boost 🙂

 

Thanks batton but , this is not a complete script and also it is what i tried so far and just wanted to share my thoughts with everyone.

 

I don't know and haven't understand either if the code posted above is working !

 

I have read more know and i have think a little bit on how to , so once i 'll have time i check about this !

Share this post


Link to post
Share on other sites

Hola george, I can send you my solution. It allows you to add dynamic simulation to structures and groups, and calculates the distance setting based on your view distance setting - fog level + scoped weapon view. 

Maybe you find bits and pieces that are helpful for you too:) 

Ps: i use it for vandeanson's apocalypse mod, to save fps, makes quite a difference! 

Edited by Vandeanson
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
24 minutes ago, Vandeanson said:

Hola george, I can send you my solution.

Sure Vandeanson !

 

Thanks a lot !  :thumb:

  • Like 1

Share this post


Link to post
Share on other sites
On 2/20/2019 at 8:44 AM, baton1990 said:

Looking forward to try it, thanks. I think it help a lot with fps boost 🙂

 

Basically , i didn't know , because i never actually use the editor

 

Dynamic Simulation 2593 Units 2018-09-12 ArmA 3

 

Thanks anyway everyone !

Share this post


Link to post
Share on other sites

So by reading it ,

https://community.bistudio.com/wiki/enableDynamicSimulationSystem

 

all there was is to add a line for the spawned groups ,

_Group enableDynamicSimulation true;

 

and also Demellion has add this :

https://community.bistudio.com/wiki/setDynamicSimulationDistance

 

[] spawn {
	while {true} do {
		
		if (cameraView isEqualTo "GUNNER") then {
			"Group" setDynamicSimulationDistance (viewDistance - (viewDistance * fog));	// Scoped 	
			
			
		} else {
		
			"Group" setDynamicSimulationDistance ((viewDistance * 0.8) - (viewDistance * fog));	// Not scoped 
		};
			
		uiSleep 0.25; 
	};
};

so Thats all !

  • Like 1

Share this post


Link to post
Share on other sites
21 hours ago, GEORGE FLOROS GR said:

all there was is to add a line for the spawned groups , 


_Group enableDynamicSimulation true;

 

Bellow a simple full example :

 

_Pos = [] call BIS_fnc_randomPos;
_Group = createGroup east;

for "_x" from 0 to (2 + random 10) do {

_Unit = _Group createunit [selectrandom "O_G_Soldier_F",_Pos,[],0,"None"];
[_Unit] JoinSilent _Group;
(leader _Group) setSkill 0.75 + random 0.25;
_Unit setSkill 0.50 + random 0.50;
};

[_Group,_Pos,250 + random 150] call BIS_fnc_taskPatrol;
_Group enableDynamicSimulation true;

 

 

Share this post


Link to post
Share on other sites

When would and should and how is this to be used?

Have you found any benefit in real time, better fps, etc?

 

Thanks

  • Like 1

Share this post


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

When would and should and how is this to be used?

Have you found any benefit in real time, better fps, etc?

 

Hello there Jnr4817 !

 

In the video you can see what Dynamic Simulation is about :

On 2/24/2019 at 12:03 PM, GEORGE FLOROS GR said:

Dynamic Simulation 2593 Units 2018-09-12 ArmA 3



 

 

and you can add it from the editor or else if you spawn your units with a script , to follow the examples above .

 

There is a great difference with the FPS.

Share this post


Link to post
Share on other sites
7 hours ago, Jnr4817 said:

When would and should and how is this to be used?

DynamicSimulation gives you all the details and how to profile performance with the built in diagnostic tools.

  • Like 2

Share this post


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

DynamicSimulation gives you all the details and how to profile performance with the built in diagnostic tools.

 

when i started the topic , I was hoping on set Dynamic Simulation dynamic , but as i noticed , it's not possible to do this with a "spawn while true code".

Share this post


Link to post
Share on other sites

So this is what i really wanted to achieve when i opened the thread :

 

1 hour ago, GEORGE FLOROS GR said:

this will hide everything far from player.

 

Can you test this and tell me , because my laptop is too slow in order to understand if is better or not.

#it might be too much objects to handle , but still if it's fine then you might filter something.


GF_distance 			= 1000;
GF_enablesimulation 	= true;
GF_hideobject			= true;


//	https://community.bistudio.com/wiki/nearestTerrainObjects
//	https://community.bistudio.com/wiki/nearestObjects
//	add here for certain , or leave the array empty for everything
GF_Filter				= [];	


[]spawn{
	while {true} do{
	if (isMultiplayer)then{	
		
		waituntil{uisleep 3;

		_centerPosition = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
		_array = nearestObjects [_centerPosition, GF_Filter,worldsize];
		_allPlayers = [];
		{if (isPlayer _x) then{_allPlayers pushBack _x;};}forEach playableUnits;

			{
			_object = _x;
				if({_x distance _object > GF_distance}count _allPlayers > 0)then{
					
					if(GF_enablesimulation)then{_x enableSimulationGlobal false};
					if(GF_hideobject)then{_x hideobjectGlobal true};
					hint "Far";
				}else{
				
					if(GF_enablesimulation)then{_x enableSimulationGlobal true};
					if(GF_hideobject)then{_x hideobjectGlobal false};
					hint "Close";
				};
			}forEach _array;
		};
		
		}else{

		waituntil{uisleep 3;

		_centerPosition = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
		_array = nearestObjects [_centerPosition, GF_Filter,worldsize];
		
			{
			_object = _x;
				if((_object distance player) > GF_distance)then{
					
					if(GF_enablesimulation)then{_x enablesimulation false};
					if(GF_hideobject)then{_x hideobject true};
					hint "Far";
				}else{
				
					if(GF_enablesimulation)then{_x enablesimulation true};
					if(GF_hideobject)then{_x hideobject false};
					hint "Close";
				};
			}forEach _array;
			};
		};
	};
};

 

  • Like 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

×