From 8c3fe83a87bc2f8b1efeffa2b0769f25c408dbc0 Mon Sep 17 00:00:00 2001 From: icomrade Date: Mon, 26 Sep 2016 16:34:26 -0400 Subject: [PATCH] Better UID Calculation + Longer ObjectUID Column Don't even bother using vector in the key calculation, the sqf ObjectUID isn't as critical anymore. This method will be much faster. Changed ObjectUID column to Varchar since with this key generation method we can approach the BigINT ceiling much quicker than we used to. --- SQF/dayz_server/init/server_functions.sqf | 46 ++--------------------- Server Files/SQL/1.0.6_Updates.sql | 1 + 2 files changed, 4 insertions(+), 43 deletions(-) diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index 0527e3b21..b474ae4d5 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -177,50 +177,10 @@ dayz_objectUID2 = { _position = _this select 1; if((count _this) == 2) then { //_key = str(round(diag_tickTime max 1)) + (str(round(abs(_position select 0))) + str(round(abs(_position select 1))) + str(round _dir)); - _key = format["%1%2%3%4",(round(diag_tickTime max 1)), (round(abs(_position select 0))), (round(abs(_position select 1))), (round _dir)]; + _key = format["%1%2%3%4%5",(round(diag_tickTime max 1)), (round(abs(_position select 0))), (round(abs(_position select 1))), (round _dir), (round (random(diag_tickTime max 1)))]; } else { - _vector = []; - _usedVec = false; - { - _element = _x; - if(typeName _element == "ARRAY") then{ - _vector = _element; - if((count _vector) == 2)then{ - if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{ - { - _x = _x * 10; - if ( _x < 0 ) then { _x = _x * -10 }; - _key = _key + str(round(_x)); - } count _position; - - _vecCnt = 0; - { - _set = _x; - { - _vecCnt = _vecCnt + (round (_x * 100)); - - } foreach _set; - - } foreach _vector; - if(_vecCnt < 0)then{ - _vecCnt = ((_vecCnt * -1) * 3); - }; - _key = _key + str(_vecCnt); - _usedVec = true; - }; - }; - }; - } count _this; - - if!(_usedVec) then{ - { - _x = _x * 10; - if ( _x < 0 ) then { _x = _x * -10 }; - _key = _key + str(round(_x)); - } count _position; - _key = _key + str(round(_dir)); - }; - }; + _key = format["%1%2%3%4%5%6",(round(diag_tickTime max 1)), (round(abs(_position select 0))), (round(abs(_position select 1))), (round(abs(_position select 2))), (round _dir), (round (random(diag_tickTime max 1)))]; + }; _key }; diff --git a/Server Files/SQL/1.0.6_Updates.sql b/Server Files/SQL/1.0.6_Updates.sql index 75cff846d..44866c4bc 100644 --- a/Server Files/SQL/1.0.6_Updates.sql +++ b/Server Files/SQL/1.0.6_Updates.sql @@ -15,6 +15,7 @@ ALTER TABLE `Object_DATA` CHANGE `Hitpoints` `Hitpoints` VARCHAR(1024) CHARACTER -- Update Object_DATA to support longer CharacterID and hitpoints -- ---------------------------- ALTER TABLE Object_DATA MODIFY COLUMN CharacterID bigint(20); +ALTER TABLE Object_DATA MODIFY COLUMN ObjectUID varchar(64); ALTER TABLE Object_DATA MODIFY COLUMN Hitpoints varchar(1024); -- ----------------------------