Jump to content
Sign in to follow this  
lappihuan

lower Bandwidth usage Script

Recommended Posts

Hello Guys

I'm working on a Script which should disable all the synchronisation between Server and the Client.

The script works with EventHandlers, so there will be only synchronised impacts on Objects ( and mabye even on Units and Vehicles, but this need some tests)

This should solve alot of Performance problems in Arma 3 MP.

If the Script works as expectet i could even alter it to work with Arma 2, because the methode I'm using would have the same effects.

What i need is a Server Admin that is willing to test my Script on his Server so i can see, there are no conflicts in sycronisation.. (Object changes or other things that would not be syncronised to every Client)

When there are no problems, i need a Server Admin with a populated Server (between 35 and 60 players should be fine to get a proper response if it does, what it should do)

I do not want to release the Script in it's current State, because i can not promise anything.

After some tests, bugfixing and so on this will be released on Armaholic and here.

I think it could help Arma MP alot.

And i hope, you guys understand what I'm trying to say :D (my english is not very good)

Best regards,

Lappihuan

Edited by Lappihuan

Share this post


Link to post
Share on other sites

Don't understand what you do but I could be interested, it's about running a mission with your script and see if all work ok? enemy in same position for all players, destroyed object in same position and state for all players, ecc ecc ?

Share this post


Link to post
Share on other sites
Don't understand what you do but I could be interested, it's about running a mission with your script and see if all work ok? enemy in same position for all players, destroyed object in same position and state for all players, ecc ecc ?

yes, exactly :)

Share this post


Link to post
Share on other sites

The only benefits are the lower bandwith usage, right? But only for player that play pvp in order to lower bandwith and also desync? Don't know if I could help you because we play coop vs AI ( 20~ vs 150-200) , not pvp / tvt

Share this post


Link to post
Share on other sites

I'm not 100% sure, but it seems like every Clinet (pvp or coop no matter) syncronise all the objects on the map and his local units to the server and the server share it to every other client.

That is extremly bandwidth heavy, even in coop with 20 players your server sync your network datas to all other 19 player and from the other 19 players to you.

These sync tasks are very performance heavy on your server and cause low FPS and desync (like we all experienced in any ArmA MP)

What my script does:

Objects and Houses will only have a short sync when they change their status. So there would be almost no bandwidth usage per client and the server can focus on other things then syncing constantly all objects to all clients.

What i do with AI other player and vehicles is depending on some tests.

So yes, this script could fix the performance problem in coop and pvp, as long it is played on a dedicated server.

I could set up a little test mission to check sync of units, objects etc. but i need some players (maybe 3 or 4 for the first tests) after the first tests i could help you implement my script (should be easy to use) in one of your coop missions, that you can test it with your clan and tell me if there is a performance boost on both (client and server). But i think i need to fix some bugs till the weekend, so if you have time this weekend i would be very glad.

Share this post


Link to post
Share on other sites

Don't know if this weekend I'm available, keep me updated ( PM ). I got one coop that is really light but heavy on server load only on altis ( others maps if fine ) with some hundres AI that really make my client ( server fps are always high ) and also others loose 30-45 fps! I'm very interested if this could help :) Good luck guy with your bugfixes!

Share this post


Link to post
Share on other sites

@PawelKPL

Thanks for the offer :)

With what can you help me?

Do you own just a little dedicatet server to test the behavior of my Script or a populated one to benchmark and stress test it?

@ramius86

Altis has shitload of objects to sync... so i hope my script can handle it to help Altis become a enjoyable experience in MP.

Edited by Lappihuan

Share this post


Link to post
Share on other sites

server is a dedi hetzner EX40SSD optimized as possible ( also ramdisk ), no others processes.

By now I use server only for internal clan coop but I can open another instance and put on some populated mission ( wasteland, arma life or whatever more played around )

Share this post


Link to post
Share on other sites
server is a dedi hetzner EX40SSD optimized as possible ( also ramdisk ), no others processes.

By now I use server only for internal clan coop but I can open another instance and put on some populated mission ( wasteland, arma life or whatever more played around )

Great! thats what i need ;)

The more server (diferent rigs and missions) test my Script the more i can provide a stable Script.

Share this post


Link to post
Share on other sites
@PawelKPL

Thanks for the offer :)

With what can you help me?

Do you own just a little dedicatet server to test the behavior of my Script or a populated one to benchmark and stress test it?

@ramius86

Altis has shitload of objects to sync... so i hope my script can handle it to help Altis become a enjoyable experience in MP.

I do have dedicated server, I run domination mostly. If needed I can host mission for testing.

Share this post


Link to post
Share on other sites
I'm not 100% sure, but it seems like every Clinet (pvp or coop no matter) syncronise all the objects on the map and his local units to the server and the server share it to every other client.

That is extremly bandwidth heavy, even in coop with 20 players your server sync your network datas to all other 19 player and from the other 19 players to you.

These sync tasks are very performance heavy on your server and cause low FPS and desync (like we all experienced in any ArmA MP)

What my script does:

Objects and Houses will only have a short sync when they change their status. So there would be almost no bandwidth usage per client and the server can focus on other things then syncing constantly all objects to all clients.

What i do with AI other player and vehicles is depending on some tests.

We used similar kind of solution in Arma 2 version of Daylight RP, and it decreased the bandwidth usage of both clients and server for about 75%, so I believe your script works as well. Another very important topic is to cut drastically the sync interval of the units that are too far away to have any effect to your gameplay, and even disable the sync totally for units that are very far away (eg. +5000 m), but these limits depend on the mission, of course. We tested that too and it cut the bandwidth usage to really small numbers as well, so it's totally worth testing in A3 too.

Edit:

Here's the A3 version of the house/object sync optimization script. It actually has a little different approach (disables the simulation and damage of nearby object completely instead of syncing only "when needed", but could be used for critical areas, like base areas in COOP and in heavy areas (like large towns). It has to be customized for your needs, but gives you the idea:

/*	
Description: 	Disables damage and simulation of near buildings and objects. This will help in MP performance as broken buildings / objects wont need to be synced on client connect.
Author:			qbt
*/

while {true} do {
_arrNearestObjects = nearestObjects [vehicle(player), ["Static"], 250];
{
	_x allowDamage false;

	if (!(_x isKindOf "ReammoBox") && (daylight_cfg_arrSimluationEnabled find _x == -1)) then {
		_x enableSimulation false;
	};

	sleep 0.05;
} forEach _arrNearestObjects;

sleep 5;
};

if (true) exitWith {};

And here's the unit sync limiter of the Arma 2 version, also gives you the idea but has to be customized to your needs.

/*	
Description: 	"Updatelimiter" for Daylight, handle packet sending interval with enableSimulation
Author:			qbt
*/

daylight_fnc_updateLimiter_server = {
while {true} do {
	daylight_arrUnits = playableUnits;
	publicVariable "daylight_arrUnits";

	sleep 30;
};
};

daylight_fnc_updateLimiter_client = {
waitUntil {!(isNil "daylight_arrUnits")};

while {true} do {
	{
		if (_x != player) then {
			if (alive _x) then {
				_iSimulatedRadius = daylight_updateLimiter_iSimulatedRadius;

				if ((vehicle (_x)) isKindOf "Air") then {
					_iSimulatedRadius = daylight_updateLimiter_iSimulatedRadiusAir;
				};

				if (([((getPosASL player) select 0), ((getPosASL player) select 1), 0] distance [((getPosASL _x) select 0), ((getPosASL _x) select 1), 0]) > _iSimulatedRadius) then {
					if ((vehicle(_x) == _x) && (alive _x)) then {
						_x switchMove "";
					};
					_x enableSimulation false;
					vehicle(_x) enableSimulation false;
				} else {
					_x enableSimulation true;
					vehicle(_x) enableSimulation true;
				};
			} else {
				_x enableSimulation true;
				vehicle(_x) enableSimulation true;
			};
		};

		sleep 0.01;
	} forEach daylight_arrUnits;

	vehicle(player) enableSimulation true;

	sleep 3.33;
};
};

[] spawn daylight_fnc_updateLimiter_server;
publicVariable "daylight_fnc_updateLimiter_client";

if (true) exitWith {};

Note that these are not my scripts, they're qbt's and licensed under the terms of CC BY-NC-SA 3.0.

Edited by Ezcoo

Share this post


Link to post
Share on other sites

Ezcoo,

I read through the enableSimulation description on the wiki and it inferred from the following comments that static objects are handled in this fashion anyway by Arma's netcode:

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

HomerJohnston: Contrary to Krause's suggestions above, using "this enableSimulation False" on static objects has no effect on a dedicated server's bandwidth usage or FPS (as per current 1.59 Release version).
Krause: re: Homer.

Yep. That's because this functionality is now part of the basic arma netcode. Pretty nice :)

So is it even worth running on buildings and static objects (like ammocrates)? Or am I not understanding this correctly?

Share this post


Link to post
Share on other sites

I'll ask it from qbt when he gets online, I'm not a scripter really so I don't have very good knowledge about that. Will update his answer here later!

Share this post


Link to post
Share on other sites
I do have dedicated server, I run domination mostly. If needed I can host mission for testing.

Thank you! I will write you a PM when im ready.

We used similar kind of solution in Arma 2 version of Daylight RP, and it decreased the bandwidth usage of both clients and server for about 75%, so I believe your script works as well. Another very important topic is to cut drastically the sync interval of the units that are too far away to have any effect to your gameplay, and even disable the sync totally for units that are very far away (eg. +5000 m), but these limits depend on the mission, of course. We tested that too and it cut the bandwidth usage to really small numbers as well, so it's totally worth testing in A3 too.

Edit:

Here's the A3 version of the house/object sync optimization script. It has to be customized for your needs, but gives you the idea:

Code...

And here's the unit sync limiter of the Arma 2 version, also gives you the idea but has to be customized to your needs.

Code...

Note that these are not my scripts, they're qbt's and licensed under the terms of CC BY-NC-SA 3.0.

Nice one :D

I hope i can achieve the same or even less Bandwidth usage.

But daammn! 75% is incredibly good.

To your script examples:

With that house/object disable script, you wouldn't be able to destroy a single object.

I work with EH to shortly enable and disable simulation but nothing else. For the rest of the time are all objects are disabled and not synced. (I hope :cool:)

I'm not sure yet, what i do with vehicles and units, i will decide after i testet the behavior of my script on a server.

Edit:

@Das Attorney

Hmm, it seems they are talking about Arma 2 and maybe BIS forgot to include that to Arma 3.

Because from what I've seen, the MP performance problems are caused by the incredible amount of object that need to be synced on altis

Edited by Lappihuan

Share this post


Link to post
Share on other sites

The implementation for ArmA 2 is severly outdated, and was specific for Daylight RP for ArmA 2. Contrary to what is said on BI-wiki it seems that it is still beneficial to disable the simulation and damage handling of static objects in missions that have a long runtime, as disabling simulation and damage handling will prevent the damage values of static objects from being broadcasted in multiplayer (at least in ArmA 2).

You can test this out by running the following code on all clients:

{_x enableSimulation false} forEach ([color=#333333]nearestObjects [vehicle(player), ["Static"], 250])[/color]

And running setDamage which should be global locally on the same buildings. The value you set with setDamage won't be broadcasted over the network. You can also try reconnecting as JIP and observe that the buildings you destroyed with setDamage are undamaged which means a lot of saved bandwidth and processing power.

{_x setDamage 1} forEach ([color=#333333]nearestObjects [vehicle(player), ["Static"], 250])[/color]

I will be releasing a easy-to-use optimization & cleanup system to use in ArmA 3 in the following few days. In the meanwhile, I discourage you use scripts from Daylight RP as they are intended to be used only in Daylight RP. :dance1:

Edited by qbt

Share this post


Link to post
Share on other sites

And running setDamage which should be global locally on the same buildings. The value you set with setDamage won't be broadcasted over the network. You can also try reconnecting as JIP and observe that the buildings you destroyed with setDamage are undamaged which means a lot of saved bandwidth and processing power.

Note that this will lead to desynchronization of the ingame world between clients, so it has to be used carefully. But it's really worth considering because of the massive performance boost, especially if destroyed buildings don't play a big role in your missions and/or mods.

Share this post


Link to post
Share on other sites
Note that this will lead to desynchronization of the ingame world between clients, so it has to be used carefully. But it's really worth considering because of the massive performance boost, especially if destroyed buildings don't play a big role in your missions and/or mods.

Hi guys,

Thought i might jump in here, I've been working on something similar to help with the above fps issues, you might be able to apply an object eventhandler using the hit event as the trigger to enablesimulation and/or setdamage. problem I'm finding is getting all of these buildings/objects, it takes like 10 minutes to retrieve all objects on altis using nearobjects. last time I tried I'm pretty sure my graphics glitched out because I ran out of memory!

Share this post


Link to post
Share on other sites

Short answer for today. Will reply tomorrow more detailed.

Testing went good so far with collecting objects and appling EventHandlers.

Short near unnoticable lag on init of a mission but after that the script is almost sleeping.

Tests on DS to find out if sync is correct and there are no desyncs on the clients are next.

Share this post


Link to post
Share on other sites

So is it even worth running on buildings and static objects (like ammocrates)? Or am I not understanding this correctly?

Discovered last night disabling simulation on all objects that are "House" (60k of them from memory) seems to make no difference to frame rates whereas doing this for all mission objects (usually just vehicles, units etc.) usually improves wasteland type missions by 10+ fps client side. Just stating this so people can stop wasting their time disabling houses. Thats not to say that it might not make an effect with a high player count dedicated server. :yay:

Share this post


Link to post
Share on other sites
Discovered last night disabling simulation on all objects that are "House" (60k of them from memory) seems to make no difference to frame rates whereas doing this for all mission objects (usually just vehicles, units etc.) usually improves wasteland type missions by 10+ fps client side. Just stating this so people can stop wasting their time disabling houses. Thats not to say that it might not make an effect with a high player count dedicated server. :yay:

Are you testing this on a Server or just localy?

Because if you test localy, it should not have any effect on FPS. This is all about lower the bandwidth usage...

Share this post


Link to post
Share on other sites
Discovered last night disabling simulation on all objects that are "House" (60k of them from memory) seems to make no difference to frame rates whereas doing this for all mission objects (usually just vehicles, units etc.) usually improves wasteland type missions by 10+ fps client side. Just stating this so people can stop wasting their time disabling houses. Thats not to say that it might not make an effect with a high player count dedicated server. :yay:

There is a module in the editor that disables the simulation for all vehicles out of range of any player. Although, it's not very customizable. For further server optimisations, I recommend taking a look at BIS_fnc_GC, you can pass an array to it, and then it will delete everything in that array if no one is within 1Km of the object being deleted.

Edited by chaoticgood

Share this post


Link to post
Share on other sites
There is a module in the editor that disables the simulation for all vehicles out of range of any player. Although, it's not very customizable. For further server optimisations, I recommend taking a look at BIS_fnc_GC, you can pass an array to it, and then it will delete everything in that array if no one is within 1Km of the object being deleted.

interesting :) I will look into it.

Saldy there are some bugs in the new stable branch with nearestObjects and enableSimulation. Can't do much right now.

Will change to dev branch tomorrow, maybe there are no problems with these comands

Share this post


Link to post
Share on other sites
Are you testing this on a Server or just localy?

Because if you test localy, it should not have any effect on FPS. This is all about lower the bandwidth usage...

Well it has a big effect locally (client side) with vehicles and other mission objects with something such as wasteland Leading to client side lag, but yes houses I can imagine that would be the case hence why i said that doesn't mean it doesn't affect a server.

There is a module in the editor that disables the simulation for all vehicles out of range of any player. Although, it's not very customizable. For further server optimisations, I recommend taking a look at BIS_fnc_GC, you can pass an array to it, and then it will delete everything in that array if no one is within 1Km of the object being deleted.

Thanks for the heads up! I will look at that

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
Sign in to follow this  

×