Jump to content

Donnovan

Member
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Donnovan

  1. Toejan,

    I believe this can still happens, if speed is too high and the client have a very low fps.

    At low speeds that generate 4, 3 or 2 hours days, this has less to no chance to happens.

    I'm using in my server for some days until now, and no problem report. It's set to 2 hours days.

    The freeze happens when you skip 120 seconds or more in a single skipTime command.

    By the way, a possible fix if do that:

    This

    skipTime 200/3600;

    Turns into this

    skipTime 119/3600;

    skipTime 81/3600;

  2. If you like my work, please consider a donation:

    btn_donate_LG.gif $USD

    btn_donate_LG.gif $EURO

    *** UPDATED THE FILE TIME_CONTROL.SQF IN 2014-10-09 13:00 ***

    *** TIME_CONTROL.SQF WAS CHANGED, THE CHANGED PARTE HAVE ***

    *** THE COMMENT "//LAST CHANGE WAS IN THIS SPAWN" ***

    JOELMA'S TIME CONTROL SYSTEMA

    Default configuration: A day of 2 hours.

    - 60 minutes completely day time (08:00 - 16:00)

    - 36 minutes of sunrise and sunfall (04:00 - 08:00, 16:00 - 20:00)

    - 24 minutes of night (00:00 - 04:00, 20:00 - 24:00)

    CLIENT SIDE: TIME_CONTROL.SQF

    In your mission folder, create the folder custom if it does not exist.

    Create inside the custom folder a txt file called time_control.sqf.

    Put inside time_control.sqf the content bellow:

    donn_sleep = 0.2;
    donn_multi = 2;
    drn_fnc_DynamicWeather_SetWeatherLocal = {};
    0 setOvercast 0;
    0 setFog 0.05;
    
    if (!isDedicated) then {
    	"cad_pvar_server_date" addPublicVariableEventHandler {(_this select 1) call donn_setdate;};
    	donn_setdate = {
    		private ["_dateSer","_dateCli","_date_diff"];
    		donn_speed = _this select 1;
    		0 setOvercast 0;
    		_dateSer = dateToNumber (_this select 0);
    		_dateCli = dateToNumber date;
    		_date_diff = (_dateSer-_dateCli)*12*31*24;
    		if (abs _date_diff > 5/60) then {setDate (_this select 0);};
    	};
    };
    
    [] spawn {  //LAST CHANGE WAS IN THIS SPAWN
    	private ["_tm","_tmLen"];
    	_tm = diag_tickTime;
    	waitUntil {!isNil "donn_speed"};
    	while {true} do {
    		sleep donn_sleep; 
    		_tmLen = diag_TickTime - _tm;
    		_tm = _tm + _tmLen;
    		skipTime ((_tmLen*(donn_speed*donn_multi-1))/3600);
    	};
    };
    
    if (!isDedicated) then {
    	[] spawn {
    		for "_x" from 1 to 10 do {
    			"infiSTAR_SetDate" addPublicVariableEventHandler {};
    			"PVDZE_plr_SetDate" addPublicVariableEventHandler {};
    			cad_pvar_send_owner = player;
    			publicVariableServer "cad_pvar_send_owner";
    			sleep 0.5;
    		};
    	};
    };
    CLIENT SIDE: INIT.SQF

    Step 1

    On your mission folder, open the file init.sqf.

    Inside it change this:

    //Start Dynamic Weather
    execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";
    
    To this:

    //Start Dynamic Weather
    //execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";
    
    Step 2

    At the end of your init.sqf file, add this line:

    call compile preprocessFileLineNumbers "custom\time_control.sqf";
    SERVER SIDE: SERVER_FUNCTIONS.SQF

    Now we need to modify files inside dayz_server.pbo.

    At the end of the file init\server_functions.sqf add this code:

    initialSend = false;
    donn_server_timeSync = server_timeSync;
    server_timeSync = {if (!initialSend) then {[] call donn_server_timeSync;}; initialSend = true;};
    [] spawn {
    	waitUntil {initialSend};
    	while {true} do {
    		_dayTime = dayTime;
    		//========================TIME FUNCTION============================
    		if (_dayTime >= 8 && _dayTime <= 16) then {donn_speed =  4.000;};
    		if (_dayTime >  4 && _dayTime <   8) then {donn_speed =  6.666;};
    		if (_dayTime > 16 && _dayTime <  20) then {donn_speed =  6.666;};
    		if (_dayTime <= 4 || _dayTime >= 20) then {donn_speed = 10.000;};
    		//=================================================================
    		cad_pvar_server_date = [date, donn_speed];
    		publicVariable "cad_pvar_server_date";
    		sleep 30;
    	};
    };
    "cad_pvar_send_owner" addPublicVariableEventHandler {
    	cad_pvar_server_date = [date, donn_speed];
    	owner (_this select 1) publicVariableClient "cad_pvar_server_date";
    };
    BATTLEYE FILTER:

    On the BattlEye filter publicvariable.txt search for the line that start with 5 "" and add at the end of it an empty space and than !"cad_pvar_s".

     

    My line is like that after the adition:

    5 "" !"PVDZE_" !"norrn" !"usec" !="remExField" !="remExFP" !="drn_AskServerDynamicWeatherEventArgs" !="norrinRAlie" !="BIS_effects_gepv" !="dayzPlayerLogin" !="dayzPlayerLogin2" !"PVAHR_" !="PVAH_AdminReq" !="PVAH_WriteLogReq" !"cad_pvar_s"

    EXTRA:

    To have a 3 hours day, change the line "donn_multi = 2;" in time_control.sqf:

    donn_multi = 1;   -> 4 hours day
    donn_multi = 4/3; -> 3 hours day
    donn_multi = 2;   -> 2 hours day
    
  3. My Time Control Script have a very smooth cloud transition, because it adjust the skipTime to the minimum necessary to archieve the desired velocity. Different system will be adjusted to different skypTimes because it adapt to the computer speed.

    A computer that can do 30 skipTimes per second will have bigger skipTime than a computer that can do 120 skipTime per second. The two will have smooth clouds, even the first, because probably it have lower fps.

    This will ensure max smoothness and a lot of small skipTimes.

    I have even used 80X 160X faster time. One day in 2 minutes.

    - Clients are perfect in sync with the server.

    - You still can set the begin hours in hiveExt.ini.

    THE DRAW BACK

    Since skipTime is fps consuming, you will have a decrease in fps, this is the only draw back.

    I'm still working on the fps decrease fix.

    Possible fixs:

    - Change from maximum smoothness goal to minimum smoothness necessary goal. Allow less and bigger skipTimes.

    - Change clouds speed.

    - Remove clouds.

    Other than the decrease in fps, the script is 100% functional, simple, syncier and smooth.

    It have a client and a small server side.

  4. This is the client side of the script, just to give the topic something more. Don't use it, it's missing the server side here! Thankyou!

    //DONN Time Control
    if (isNil "drn_fnc_DynamicWeather_SetWeatherLocal") then {
            0 setOvercast 0;
            0 setFog 0;
            setWind [1, 1, true];
    };
    if (isServer) then {
    	donn_setSpeed = {
    		private ["_dayTime"];
    		_dayTime = _this select 0;
    		if (_dayTime >= 8 && _dayTime <= 16) then {donn_speed =  4.000;};
    		if (_dayTime >  4 && _dayTime <   8) then {donn_speed =  6.666;};
    		if (_dayTime > 16 && _dayTime <  20) then {donn_speed =  6.666;};
    		if (_dayTime <= 4 || _dayTime >= 20) then {donn_speed = 10.000;};
    	};
    };
    if (!isServer) then {
    	"cad_pvar_server_date" addPublicVariableEventHandler {_this call donn_setdate;};
    	donn_setdate = {
    		private ["_dateSer","_dateCli","_date_diff"];
    		_dateSer = ((_this select 1) select 0);
    		_dateCli = date;
    		_date_diff = (
    			((_dateSer select 0) - (_dateCli select 0))*12*31*24 +
    			((_dateSer select 1) - (_dateCli select 1))*31*24 +
    			((_dateSer select 2) - (_dateCli select 2))*24 +
    			((_dateSer select 3) - (_dateCli select 3)) +
    			((_dateSer select 4) - (_dateCli select 4))/60
    		);
    		donn_speed = ((_this select 1) select 1);
    		if (_date_diff > 30/60) then {skipTime _date_diff;};
    		donn_skipExit = true;
    		diag_log format [
    			"HOUR BEFORE: %1 / HOUR RECEIVED: %2 / DIFF MIN: %3 ",
    			date,
    			(_this select 1) select 0,
    			floor (_date_diff*60)
    		];
    	};
    };
    if (isServer) then {donn_skipExit = false;};
    [] spawn {
    	private ["_sleep","_speed","_timePixel","_tickTime","_skipTime","_tickTimeLen"];
    	waitUntil {!isNil "donn_speed" && !isNil "donn_skipExit"};
    	while {true} do {
    		_speed = donn_speed;
    		if (isNil "drn_fnc_DynamicWeather_SetWeatherLocal") then {
    			private ["_donn_speed"];
    			_donn_speed = (donn_speed min 20) max 4;
    			_sleep = 1-((_donn_speed-4)/16*0.9);
    		} else {
    			_sleep = 0.02;
    		};
    		_timePixel = 0;
    		_skipTime = 0;
    		_tickTimeLen = 0;
    		_tickTime = diag_tickTime;
    		while {!donn_skipExit} do {
    			sleep _sleep;
    			skipTime (_timePixel/3600);
    			_skipTime = _skipTime+_timePixel;
    			_tickTimeLen = diag_tickTime-_tickTime;
    			_timePixel = (_timePixel*31+((_speed-1)*_tickTimeLen-_skipTime))/32;
    		};
    		donn_skipExit = false;
    	};
    };
  5. I finished a simple time control code that allow you to accelerate time.

     

    Actually i'm using that:

     

    00:00 - 04:00 [12 minutes]
    04:00 - 08:00 [18 minutes]
    08:00 - 12:00 [30 minutes]
    12:00 - 16:00 [30 minutes]
    16:00 - 20:00 [18 minutes]
    20:00 - 24:00 [12 minutes]

     

    Total Day Time = 2 hours.

     

    It have smooth clouds movement, but since this demands many more and smaller skipTime commands and since skipTime command decrease fps, you have a hurt in fps of 15%.

     

    If i can control clouds speed, this would open new possibilities because i can use less and bigger skipTime commands.

     

    I tried to mess with setWind command, but this seens not to affect clouds speed.

     

    Anyone know how to set clouds speed?

  6. No custom loot.

    I use a dedicated host machine, not a specific DayZ host.

    Arma 1.63.125548.

    Rpt: I will check for that.

    Well, at least i now know this is not a generic problem, May be something specific to my server. It's already a help.

  7. Important update.

    The change is already on the main post.

    2) [MISSION FOLDER]\CUSTOM\SAFEZONE.SQF

    Changed from:

    			[] spawn {
    				while {!canbuild} do {
    					player addEventHandler ["handleDamage", {0}];
    					sleep 0.01;
    				};
    			};
    to:

    			[] spawn {
    				private ["_myHdEh"];
    				while {!canbuild} do {
    					_myHdEh = player addEventHandler ["handleDamage", {0}];
    					sleep 0.02;
    					player removeEventHandler ["handleDamage",_myHdEh];
    				};
    			};
    The original code was creating multiple event handlers that are only deleted when the player leave the safe or if the server have infiStar (infiStar delete the handle damage event handler each 0.5 seconds). With the change the code will create just one event handler in any situation.
  8. On my server i had decay turned off and indestructible bases. Anything build (cinder wall, wooden floor, etc...) was forever.

    We started to have severe fps problems with all players, idependent of the player machine (including my self, that have a very powerfull machine).

    I started a quest to find the cause of the fps problem...

    Excluding the possibilities one by one, the problem was the high number of build modules on the server. Yes, believe me. This was a two day work.

    My object_data table had more than 6600 lines of active objects.

    It's not the lines that cause the low fps, the Epoch database is nothing considering MySql limits. The problem is that each object need to be loaded in the server memory, and need to be considered in every server cycle.

    Fps difference from a server with no bases or just a few bases and a server with a great number of bases is drastic.

    May be this is the reason why by default decay cycle is of 6 days, bases are destructible and maintain bases are expensive. With those default values, i believe its possible to maintain module count lower than 3000.

  9. Thankyou Sukkaed,

    But the problem is to know if the event handler is alive. I don't know if it was removed, i need to check this.

    Something like that:

     

    while {state_on} do {
          waitUntil {Is the Event Handler Removed?}; //THIS!
          player addEventHandler ["handleDamage",{_this call run_stuff}];
    };
    The "waitUntil {Is the Event Handler Removed?};" code is what i'm in search.
  10. Hi!

    When i run a event handler like that:

     

    myEH_hd = player addEventHandler ["handleDamage",{_this call run_stuff}];
    The number of the event handler is stored in myEH_hd.

    In my context, there is the possibilitie that another process use the code:

     

    player removeAllEventHandlers "handleDamage";
    And remove my event handler.

    So... there is any way to know if my event handler is still alive?

    ---------//---------

    Also, this, about removeEventHandler, is true?

     

    When any handler is removed, all handler indices higher than the deleted one should be decremented.

    Sorry if i an asking too much. Thankyou!

×
×
  • Create New...