Jump to content

[Release] - A Plot for life v2.5. Keep your buildables on death. Take plot ownership


Recommended Posts

Ok,

 

The way it works is that the object in the game world is not deleted but just updated.  The object in the DB needs to be deleted and recreated as the hiveext.dll does not have a call to update the fields we need to update.

 

For this reason, the process goes like this.

 

Find all objects in range of the plot pole.

for each one

 - Check if in list of objects where ownership can be changed

 - If true, delete DB copy of object. 

 - Update game object details.

 - Publish new DB object with game object details.

 

The big issue (one of them) with the hiveext.dll calls is that a lot of them are one way.  Object calls are one way apart from the call to load all objects fromt he DB (occurs on server startup).  This means that the server starts and loads the objects fromt he DB.  The game world objects then act as 'master' copies and updates are pushed to the DB (but not read).  The unique identifier of objects is the ObjectID but this is created at the DB level (incremental field - new row added then that field just goes up X numbers).  The problem is that this autogenerated ObjectID cannot get back in to the game world so in the game a second ID is created called the ObjectUID.  This is generated based on the objects location in the game world and so should be pretty unique as well. 

 

For the scripts that handle deleting or saving records from the DB, they will reference them via the ObjectID first if > 0 or the ObjectUID if no ObjectID is specified.  The previous duplication was due to the objectID not being zeroed after the DB object was deleted.

 

i.e. the game world object still had the objects objectID.  When someone came to take ownership again the deletion was attempted on the old objectID which no longer existed and so the object being taken over was not deleted and a new object was added to the DB.  On server restart, both objects were loaded from the DB hence the duplication.  This was corrected by the additional line detailed a few posts back.

 

So that explains why there is only one wall in game until reboot.

 

The concern is why there are two records in the DB even after zeroing the ObjectID in the ingame object after DB deletion.

 

Would really need to see the pre-state DB objects, the state after 1x take ownership and after 2nd take ownership.

 

I am sort of leaning towards the DB not being able to keep up at this stage so may need to put in a small delay between objects to see if that helps.  Not seeing any logical reason for it not to work at the moment.

Link to comment
Share on other sites

Hi RimBlock, while I am in damage limitations mode, I have turned off take ownership for now. You being an SQL master and me definitely not, is there a select and delete statement you could send me to get rid of duplicates for the time being so I can get the live server back on an even keel? I'm guessing something that says delete where objectUID, characterID and worldspace is identical.... or, do you think this could be dangerous and delete other stuff?

 

Thanks

Link to comment
Share on other sites

SQL to remove duplicate objects.

 

Backup your DB first (My Windows batch file db backup script can behttp://epochmod.com/forum/index.php?/topic/14161-release-mysql-db-backup-v11/?hl=backup#entry120478).  Load the db on to a test server and test before applying to a live server if possible.

 

 

Create a list of objectIDs where there is more than one ObjectUID (list only the oldest objectIDs where there are multiples).

CREATE TEMPORARY TABLE temp_object_delete 
select min(objectID) as objectID
from object_data 
where characterID <> 0
group by ObjectUID
having count(ObjectUID) > 1; 

 Select objects from the object_data table where the objectIDs match those in the new temp table (so you can review them).

select * from object_data
where objectID in (select objectID from temp_object_delete);

Delete objects from the object_data table where the objectIDs match those in the new temp table.

delete from object_data
where objectID in (select objectID from temp_object_delete);

Drop the temp table once no longer needed (it can be used to reference against your backup if incorrect items were removed).

drop table temp_object_delete;
Link to comment
Share on other sites

Hi RimBlock,

 

hope this is enough Information that can be helpfull.

I skipped the last bit of restarting the server as you can already see 2 Items in the Database.

Best Regards

Huppabubba

You have precise building installed. This means the objectuid is different for the new item compared to the legacy item which was built without it. Remember the objectuid is based on the workspace coordinates. They are different in the legacy and the first new item. This means the new item cannot be deleted as the objectuid recalculated by the object publish script and applied to.the object won't match the db record.

Without precise building this should work fine. I will take a quick look tomorrow to see if there is an easy solution.

Link to comment
Share on other sites

You have precise building installed. This means the objectuid is different for the new item compared to the legacy item which was built without it. Remember the objectuid is based on the workspace coordinates. They are different in the legacy and the first new item. This means the new item cannot be deleted as the objectuid recalculated by the object publish script and applied to.the object won't match the db record.

Without precise building this should work fine. I will take a quick look tomorrow to see if there is an easy solution.

Sadly without precise build, everything is all over the place once the server reboots. And I am not talking about 4 or 5mm but holes the size ppl can walk through walls. No idea why.

But thank you and I hope you find something really easy :)

Best Regards

Link to comment
Share on other sites

Rimblock, thanks again for the SQL above. I have now had a look at the results and have some more bad news. It looks like the duping is still happening since I turned off take ownership.

 

Could this be lag related? I only ask as its seems to have happened at the same time we have had a high player count....

 

EDIT: I still wonder about lag relation but, having looked further it seems to be happening at off peak times as well.

 

EDIT2: Also Rimblock in answer to your earlier question about a door management script, no we don't. We do however, have a modified player_unlockDoor.sqf for combo lock brute force penalty. I am going to switch that off and see whether there is any change to the locks zeroing problem. No errors in the hivelog

Link to comment
Share on other sites

I have done everything to the T in the instructions and im getting this error

 

2:18:54 Warning Message: Script custom\init\server_functions.sqf not found
2:18:54 Warning Message: Script custom\system\server_monitor.sqf not found

 

Someone please help, i have tried everything i know to change the path and the destination i don't know whatelse to do.. from what i understand.. correct me if im wrong please, the server root directory would be the server.pbo yes? If not i have tried putting it in the folder that the pbo is in and also the folder the addons, keys folders and the hiveext file is.... If someone knows what im doing wrong I'd greatly appreciate it!

Link to comment
Share on other sites

Sadly without precise build, everything is all over the place once the server reboots. And I am not talking about 4 or 5mm but holes the size ppl can walk through walls. No idea why.

But thank you and I hope you find something really easy :)

Best Regards

 

Post up a copy of your server_publishObject.sqf .  I am presuming that it has been amended from the original one for precise / vector building.  I will see if I can implement those changes in.

 

This is the problem with multiple mods from different people sealing with the positioning.  When saving objects I now need to take account of the fact that precise building and / or vector building may also be added.

 

If someone has vector and precise building added then you could have items with;

Vanilla Epoch worldspace

  • A Plot for Life worldspace
  • Vector worldspace
  • Precise worldspace
  • Vector worldspace and A Plot for Life worldspace
  • Precise worldspace and A Plot for Life worldspace
  • Vector and precise worldspace
  • Vector and precise worldspace and A Plot for Life worldspace

 

So your DB records could have 7 different worldspace format combinations depending on the mods installed and when they were installed. 

 

From the PDF you posted, it seems (after looking on a computer rather than my mobile at 12:30am :)  ).

Original wall = Precise building.

New plot pole = Precise building & vector building & A Plot for Life.

 

New wall = A Plot for Life.

2nd New plot pole = Precise building & vector building & A Plot for Life.

New wall deletion = missing.

2nd New wall =  A Plot for Life.

 

If the deletion is missing I would expect to see an error in the RPT files on the client (of the person taking ownership) or server.  Providing a copy of those would be very helpful (probably).

Link to comment
Share on other sites

I have done everything to the T in the instructions and im getting this error

 

2:18:54 Warning Message: Script custom\init\server_functions.sqf not found

2:18:54 Warning Message: Script custom\system\server_monitor.sqf not found

 

Someone please help, i have tried everything i know to change the path and the destination i don't know whatelse to do.. from what i understand.. correct me if im wrong please, the server root directory would be the server.pbo yes? If not i have tried putting it in the folder that the pbo is in and also the folder the addons, keys folders and the hiveext file is.... If someone knows what im doing wrong I'd greatly appreciate it!

 

Put the custom folder in the server root directory (the one with the ArmA2OA executable in).

Link to comment
Share on other sites

Rimblock, thanks again for the SQL above. I have now had a look at the results and have some more bad news. It looks like the duping is still happening since I turned off take ownership.

 

Could this be lag related? I only ask as its seems to have happened at the same time we have had a high player count....

 

EDIT: I still wonder about lag relation but, having looked further it seems to be happening at off peak times as well.

 

EDIT2: Also Rimblock in answer to your earlier question about a door management script, no we don't. We do however, have a modified player_unlockDoor.sqf for combo lock brute force penalty. I am going to switch that off and see whether there is any change to the locks zeroing problem. No errors in the hivelog

 

Ok, so if you can confirm that turning off the Take Ownership function removes the option from the plot pole then it would appear your duplication is not due to the Take Ownership function.

 

Have a check and see what type of worldspace format the duplication is happening on to see if there is a pattern as mentioned above.

 

The door lock code issue I believe is unrelated to taking ownership as taking ownership either sets the characterID field as what the game objects characterID field already is or sets it to the players characterID.  The only way it could set it to 0 is if the characterID for that player is 0 or the characterID of the object is also already 0.

 

Your RPT files would also be helpful.

Link to comment
Share on other sites

rimblock,

 

heard of anyone having issues with cinder saving? wood all seems to save fine but seems cinder isnt saving to the db correctly?

 

this is what im getting in hideExt.ini

 

2014-12-17 12:16:36 HiveExt: [information] Method: 308 Params: 11:CinderWall_DZ:0:7:[139.599,[7723.07,4005.73,-1.95541],]:[]:[]:0:7723140057196140:
2014-12-17 12:16:36 HiveExt: [Error] Error executing |CHILD:308:11:CinderWall_DZ:0:7:[139.599,[7723.07,4005.73,-1.95541],]:[]:[]:0:7723140057196140:|
 
items are removed upon restart
Link to comment
Share on other sites

The format of the worldspace field looks very wrong.

 

:[139.599,[7723.07,4005.73,-1.95541],]:[]:[]:0:7723140057196140:

 

It should be (for only having A Plot for Life installed).

:[direction[X,Y,Z],SteamID]:

 

I don't suppose you have something like vector building or painting walls installed by any chance ;) .

Link to comment
Share on other sites

Post up a copy of your server_publishObject.sqf .  

I am presuming that it has been amended from the original one for precise / vector building.  I will see if I can implement those changes in.

 

This is the problem with multiple mods from different people sealing with the positioning.  When saving objects I now need to take account of the fact that precise building and / or vector building may also be added.

 

If someone has vector and precise building added then you could have items with;

Vanilla Epoch worldspace

  • A Plot for Life worldspace
  • Vector worldspace
  • Precise worldspace
  • Vector worldspace and A Plot for Life worldspace
  • Precise worldspace and A Plot for Life worldspace
  • Vector and precise worldspace
  • Vector and precise worldspace and A Plot for Life worldspace

 

So your DB records could have 7 different worldspace format combinations depending on the mods installed and when they were installed. 

 

From the PDF you posted, it seems (after looking on a computer rather than my mobile at 12:30am :)  ).

Original wall = Precise building.

New plot pole = Precise building & vector building & A Plot for Life.

 

New wall = A Plot for Life.

2nd New plot pole = Precise building & vector building & A Plot for Life.

New wall deletion = missing.

2nd New wall =  A Plot for Life.

 

If the deletion is missing I would expect to see an error in the RPT files on the client (of the person taking ownership) or server.  Providing a copy of those would be very helpful (probably).

 

 

Here the File you Requested!

private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID = _this select 0;
_object =  _this select 1;
_worldspace =  _this select 2;
_class =  _this select 3;
 
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { deleteVehicle _object; };
 
//diag_log ("PUBLISH: Attempt " + str(_object));
 
//get UID
_uid = _worldspace call dayz_objectUID2;
_worldspace set [0, (_worldspace select 0) call KK_fnc_floatToString];
_worldspace set [1, (_worldspace select 1) call KK_fnc_positionToString];
 
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
 
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
// _object setVariable ["CharacterID",_charID,true];
 
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
 
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
 
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

 
Here the FullPublish if needed

private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed"];
 
_charID = _this select 0;
_object =  _this select 1;
_worldspace =  _this select 2;
_class =  _this select 3;
_inventory = _this select 4;
_hitpoints = _this select 5;
_damage = _this select 6;
_fuel = _this select 7;
 
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { deleteVehicle _object; };
 
diag_log ("PUBLISH: Attempt " + str(_object));
 
//get UID
_uid = _worldspace call dayz_objectUID2;
 
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage, _charID, _worldspace, _inventory, _hitpoints, _fuel,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
 
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
// _object setVariable ["CharacterID",_charID,true];
 
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
 
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
 
diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

 
 
Thanks allot for your help regarding this issue.
If I can be of any Support towards projects please do let me know.
 
Best Regards,
Huppabubba
Link to comment
Share on other sites

Updated version to v2.35 which just has the last couple of bug fixes in it.  If you have been tracking the last 4-5 pages then you have probably got the bug fixes already.  This is because some people may be running on older versions of the v2.34 code and be unaware of the fixes put in without a version number change.

 

I have reorganised the Git to take out the version number from the path to also help with clarity of the version.  The text file has the version number and the Git now has three types of branch.

  • Master - Latest stable release.
  • A Plot for Life vXXXX Stable - Stable branch for each release.
  • A Plot for Life vXXXX Dev - Development branch for each release.

 

I may add a beta branch at some point.

Link to comment
Share on other sites

 

 

Here the File you Requested!

private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID = _this select 0;
_object =  _this select 1;
_worldspace =  _this select 2;
_class =  _this select 3;
 
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { deleteVehicle _object; };
 
//diag_log ("PUBLISH: Attempt " + str(_object));
 
//get UID
_uid = _worldspace call dayz_objectUID2;
_worldspace set [0, (_worldspace select 0) call KK_fnc_floatToString];
_worldspace set [1, (_worldspace select 1) call KK_fnc_positionToString];
 
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
 
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
// _object setVariable ["CharacterID",_charID,true];
 
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
 
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
 
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

 
Here the FullPublish if needed

private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed"];
 
_charID = _this select 0;
_object =  _this select 1;
_worldspace =  _this select 2;
_class =  _this select 3;
_inventory = _this select 4;
_hitpoints = _this select 5;
_damage = _this select 6;
_fuel = _this select 7;
 
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { deleteVehicle _object; };
 
diag_log ("PUBLISH: Attempt " + str(_object));
 
//get UID
_uid = _worldspace call dayz_objectUID2;
 
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage, _charID, _worldspace, _inventory, _hitpoints, _fuel,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
 
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
// _object setVariable ["CharacterID",_charID,true];
 
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
}else{
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
 
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
 
diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

 
 
Thanks allot for your help regarding this issue.
If I can be of any Support towards projects please do let me know.
 
Best Regards,
Huppabubba

 

 

Firstly add the extra lines from precise base building in to the server_publishFullObject.sqf

 

Find 

_uid = _worldspace call dayz_objectUID2;

Change to 

_uid = _worldspace call dayz_objectUID2;
_worldspace set [0, (_worldspace select 0) call KK_fnc_floatToString];
_worldspace set [1, (_worldspace select 1) call KK_fnc_positionToString];

That should sort out the saving of precise base building part of the worldspace variable.

 

I will have a look at the other issues tomorrow.

Link to comment
Share on other sites

Hey all,

 

I honestly haven't read all 52 pages but i have searched around a good amount. I apologize if this has been handled else where but i thought i would ask to see if it's possible. 

 

Thanks for the work here RimBlock. I have tested this on my test server first to check a few things out. All works out great and i'm able to take owner ship of bases and steamID goes to worldspace with no issues. 

 

I have no maintenance on my server currently and would like to see if it's possible to have the characterID field of the object table get updated vs the worldspace when taking ownership. I have manually changed the DB value size of the characterid to accommodate the size the steamID, using the ALTER TABLE and MODIFY.

 

 

I found a good clean up provided from shan1784 but i haven't been able to get all the objects placed assigned the steamID/PLayeruid to the characterID field. When i place objects and manually add my playeruid to the characterID and run the below script, it works fine and deletes based on the time frame. 

 

So, i there is a way to use your ownership on the plot to assign the playeruid directly to the characterID field that would be awesome! 

 

 

 

http://epochmod.com/forum/index.php?/user/12986-shan1784/

Find Objects from people that haven’t logged in in 30 days
SELECT o.`Classname`, p.PlayerName, o.`CharacterID`, c.`LastLogin` FROM `Object_DATA` o, `Player_DATA` p, `Character_DATA` c WHERE p.`PlayerUID`=o.`CharacterID` and c.`PlayerUID`=p.`PlayerUID` and c.`Alive`=1 and o.`CharacterID` IN (SELECT `PlayerUID` FROM `Character_DATA` WHERE `Alive`='1' and DATE(`LastLogin`) < CURDATE() - INTERVAL 30 DAY)
 
 
Remove Objects from people that haven’t logged in in 30 days
DELETE FROM `Object_DATA` WHERE `CharacterID` IN (SELECT `PlayerUID` FROM `Character_DATA` WHERE `Alive`='1' and DATE(`LastLogin`) < CURDATE() - INTERVAL 30 DAY)

Thanks for any help and my apologizes if this was all ready asked but i couldn't find it in this context. 

 

-

Detour

[email protected]

Link to comment
Share on other sites

RimBlock, I think my problem was still to do with take ownership after all. What I noticed when I ran your SQL above, I needed to run it about 3 times and delete the data 3 times. I don't know why it didn't all come through in the first attempt. However, since deleting for the 3rd time a day ago and having take ownership turned off, I no longer have items duplicating and nothing being returned in the temp object table.

 

So, it has to have something to do with take ownership and I'm guessing that it may have something to with having a medium-high population....?

 

Coming back to your question about the doors and a character ID of 0, there is a problem in Epoch 1051 with character ID's sometimes zeroing after a skin change. On our server we ask players to observe their humanity when changing skin and relog if it's zero and the admins also keep an eye on players character id and advise them to relog if zero. So could this be it along with take ownership?

 

Any more ideas? I'll keep running the sql periodically to see if any new items appear with take ownership off.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...