Jump to content
code34

OO PDW - oriented object Persistent Data World

Recommended Posts

no probs you are welcome ;) i just delete this very old link dont see it.

 

for delete objects is it an external piece of code ?

Share this post


Link to post
Share on other sites
On 3/20/2018 at 4:40 PM, code34 said:

no probs you are welcome ;) i just delete this very old link dont see it.

 

for delete objects is it an external piece of code ?

I was using the example mission code. I realized the delete portion was only checking for MAN so I adjusted it to check for logic as well and works fine now.  Thanks

Share this post


Link to post
Share on other sites

I have been working on persistence functions for my missions. I can save players info no problem but am having trouble creating save zones that record objects, vehicles and inventories within a marker. I can save everything in zones no issue, the problem is the next time I save them, I dupe the items. I've added a counter to the database key so it increments 1 every time, I've got it set so that it writes to a new section every time, and yet its somehow keeping track of all previous entries. The example below shows how every time it auto saves it creates one additional copy of the vehicle.

 

Quote


[Situational Awareness_3pdw_objects]
Situational Awareness_3pdw_objects="-1"

 

[Situational Awareness_4pdw_object_objects_0]
Situational Awareness_4pdw_object_objects_0="["rhsusf_m1025_w_mk19",[1305.27,18088.9,-0.0197868],0,0,[["rhs_weap_m4_carryhandle","rhs_weap_M136_hedp"],[2,2]],[["rhs_m136_hedp_mag","rhs_mag_30Rnd_556x45_M855A1_Stanag","rhsusf_100Rnd_556x45_soft_pouch","rhs_mag_M441_HE","rhs_mag_m714_White","rhs_mag_m662_red","rhs_mag_m67","rhs_mag_m18_green","rhs_mag_m18_red","rhs_mag_an_m8hc"],[2,20,8,16,4,2,4,2,2,4]],[["FirstAidKit"],[4]],[["rhsusf_falconii"],[2]]]"
[Situational Awareness_4pdw_objects]
Situational Awareness_4pdw_objects="0"

 

[Situational Awareness_5pdw_object_objects_0]
Situational Awareness_5pdw_object_objects_0="["rhsusf_m1025_w_mk19",[1305.27,18088.9,-0.0197868],0,0,[["rhs_weap_m4_carryhandle","rhs_weap_M136_hedp"],[2,2]],[["rhs_m136_hedp_mag","rhs_mag_30Rnd_556x45_M855A1_Stanag","rhsusf_100Rnd_556x45_soft_pouch","rhs_mag_M441_HE","rhs_mag_m714_White","rhs_mag_m662_red","rhs_mag_m67","rhs_mag_m18_green","rhs_mag_m18_red","rhs_mag_an_m8hc"],[2,20,8,16,4,2,4,2,2,4]],[["FirstAidKit"],[4]],[["rhsusf_falconii"],[2]]]"
[Situational Awareness_5pdw_object_objects_1]
Situational Awareness_5pdw_object_objects_1="["rhsusf_m1025_w_mk19",[1305.27,18088.9,-0.0197868],0,0,[["rhs_weap_m4_carryhandle","rhs_weap_M136_hedp"],[2,2]],[["rhs_m136_hedp_mag","rhs_mag_30Rnd_556x45_M855A1_Stanag","rhsusf_100Rnd_556x45_soft_pouch","rhs_mag_M441_HE","rhs_mag_m714_White","rhs_mag_m662_red","rhs_mag_m67","rhs_mag_m18_green","rhs_mag_m18_red","rhs_mag_an_m8hc"],[2,20,8,16,4,2,4,2,2,4]],[["FirstAidKit"],[4]],[["rhsusf_falconii"],[2]]]"
[Situational Awareness_5pdw_objects]
Situational Awareness_5pdw_objects="1"

 

Does anyone know any commands in PDW, or INIDBI itself that can clear the old data out before writing back to log? Or has anyone had this issue before and found a work around?

Share this post


Link to post
Share on other sites

hi TheVigil7

 

can you explain a bit more why do you add a counter, and a simple way to reproduce the problem?

Share this post


Link to post
Share on other sites

hi Code34,

 

Thanks for the reply. I added the counter because I am re-running the save command repeatedly, and was hoping by adding a counter I could pick an autosave out of the entire log. it was just an attempt to try and make this useful. However, even with the counter it is duping the same object over and over again. for troubleshooting my issue, ignore the counter its not important.

 

To reproduce this is simple. Just set up a zone on a map that you want to save the objects in it. place a single object, like a truck. Then just have a loop run the save command every few seconds. The first time it runs, it will create an entry for the truck. The second time, it will create two entries for the truck, third time it makes 3... etc. If you attempt to order it to load the objects saved to the log this way, it spawns the same truck, in the same location, X many times based on how many copies were saved in the database, resulting in some truly spectacular physics glitches. I just cannot understand why it always creates a copy of the object unless inidbi itself is holding onto this variable somewhere. I cannot get it to clear all data its holding before writing new entries back.

Share this post


Link to post
Share on other sites
On 11/09/2018 at 8:26 PM, TheVigil7 said:

hi Code34,

 

Thanks for the reply. I added the counter because I am re-running the save command repeatedly, and was hoping by adding a counter I could pick an autosave out of the entire log. it was just an attempt to try and make this useful. However, even with the counter it is duping the same object over and over again. for troubleshooting my issue, ignore the counter its not important.

 

To reproduce this is simple. Just set up a zone on a map that you want to save the objects in it. place a single object, like a truck. Then just have a loop run the save command every few seconds. The first time it runs, it will create an entry for the truck. The second time, it will create two entries for the truck, third time it makes 3... etc. If you attempt to order it to load the objects saved to the log this way, it spawns the same truck, in the same location, X many times based on how many copies were saved in the database, resulting in some truly spectacular physics glitches. I just cannot understand why it always creates a copy of the object unless inidbi itself is holding onto this variable somewhere. I cannot get it to clear all data its holding before writing new entries back.

 

oo_pdw saves the item in one place unless you ask him to do something else.

 

You should share your code for this simple test :)

  • Like 1

Share this post


Link to post
Share on other sites

Here is my code snippet, I am running it from initserver.sqf - ignore all the parts about the counter, that code is running correctly and was just an attempt by me to try and differentiate between each autosave happening in the loop. If you let this code run for a bit, with a single truck in the specified zone that is being autosaved... every consecutive save creates a copy of the truck as I demonstrated in my OG post. There is still only one truck in that zone, in the same spot with the same inventory. This tells me that every object gets stuck in 'memory' somewhere in this script, I want it to forget ALL previous objects before it re-runs the autosave, so I only record every object still in the zone once.

 

Everything about this code works except that it is duping all objects, first time it saves, it records the truck once, second save it records the same truck twice, third save the same truck 3 times... etc...

 

Spoiler

call compile preprocessFileLineNumbers "oo_pdw.sqf";


sleep 2;


private "_counter";
_counter = 1;
private _saveName = format ["Situational_Awareness_%1", _counter];
public newDB = _saveName;
private _pdw = ["new", "inidbi"] call OO_PDW;
["setSaveName", _saveName] call _pdw;
["setIncludingMarkers", ["owb_base","test"]] call _pdw;
["setExcludingTypes",  ["Land_HBarrierTower_F","Land_Campfire_F","Weapon_srifle_LRR_F","Vysilacka","Land_Laptop_device_F","Land_Laptop_02_unfolded_F","Laptop_EP1","Land_HBarrierWall4_F","Land_HBarrierWall6_F","Land_HBarrier_1_F","MetalBarrel_burning_F","Land_WoodenTable_large_F","Land_Razorwire_F"]] call _pdw;

_objects = "loadObjects" call _pdw;
sleep 30;

    while {true} do {
    sleep 15;
    ["setSaveName", _saveName] call _pdw;
    ["setIncludingMarkers", ["owb_base","test"]] call _pdw;
    ["setExcludingTypes",  ["Land_HBarrierTower_F","Land_Campfire_F","Weapon_srifle_LRR_F","Vysilacka","Land_Laptop_device_F","Land_Laptop_02_unfolded_F","Laptop_EP1","Land_HBarrierWall4_F","Land_HBarrierWall6_F","Land_HBarrier_1_F","MetalBarrel_burning_F","Land_WoodenTable_large_F","Land_Razorwire_F"]] call _pdw;
    "saveObjects" call _pdw;
    _counter = _counter + 1;
    _saveName = format ["Situational_Awareness_%1", _counter];
    newDB = _saveName;
    };

 

  • Like 1

Share this post


Link to post
Share on other sites

the way it s working is simplier than that

 

	call compile preprocessFileLineNumbers "oo_pdw.sqf";

	private _pdw = ["new", "inidbi"] call OO_PDW;

	["setSaveName", "thevigil7"] call _pdw;
	["setDbName", "thevigil7"] call _pdw;

	["setIncludingMarkers", ["owb_base","test"]] call _pdw;
	["setExcludingTypes",  ["Land_HBarrierTower_F","Land_Campfire_F","Weapon_srifle_LRR_F","Vysilacka","Land_Laptop_device_F","Land_Laptop_02_unfolded_F","Laptop_EP1","Land_HBarrierWall4_F","Land_HBarrierWall6_F","Land_HBarrier_1_F","MetalBarrel_burning_F","Land_WoodenTable_large_F","Land_Razorwire_F"]] call _pdw;

	_objects = "loadObjects" call _pdw;

	while {true} do {
		sleep 15;
		"saveObjects" call _pdw;
	};

 

  • Like 1

Share this post


Link to post
Share on other sites

Thats actually really close to what I had originally- I'll try that when I have the chance, but I think I still have the same root issue with that code, if there is one object in the 'including marker' zone, it gets recorded once, second iteration, it gets recorded twice, third iteration, recorded 3 times, etc.. all I want is to record everything in the zone, AT THAT SPECIFIC MOMENT, inidbi seems to write back whatever is CURRENTLY in the zone PLUS everything it had PREVIOUSLY recorded thus causing objects to be duplicated at every save.

Share this post


Link to post
Share on other sites

ok i better understand what is the problem, i will check this too from my part.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks! Every other part of it works amazingly, setting filtered zones, filtering out specific objects... love inidbi2 and oo_pdw api. I am saving player data without issue, and outside this duping bug almost have a framework for saving world data ready. If I can figure it out this gives me a useful framework for a lot of future missions and ideas, great work man!

Share this post


Link to post
Share on other sites

This seems to have resolved the duping, I'm still seeing weird output in the db, like a vehicle that was in the zone, and moved out of it is still listed in the db.. however on a server restart it wasn't loaded so the behavior seems correct. I also see it dupe one object, and only one object, sometimes. Not sure if its actually being duped or just more weird output I'm misreading. I'll just have to playtest and give you any bug further bug reports I may find.

 

Thanks for the quick patch! You revived a really cool project I was working on, excited to get back to it.

Share this post


Link to post
Share on other sites

Hey- just wanted to follow up and say I haven't noticed bugs in this since the fix. Thanks code34! Awesome project.

  • Like 1

Share this post


Link to post
Share on other sites

I'm having trouble with the included sample mission and also the same sample code in a new mission.  Data is being saved to my db.ini however the load function is not working.  

call compile preprocessFileLineNumbers "oo_pdw.sqf";

		sleep 2;
		 _pdw = ["new", "inidbi"] call OO_PDW;
	
		["setDbName", "FallenDB"] call _pdw;
		 
			 
		 //hint "Save all objects";
		//"saveObjects" call _pdw;	
		//_loopSave = execvm "saveObjects.sqf";	
		//db exists already so don't save map objects: add an exists check here before saving

		hint "Delete all objects";
		
		{
			if!(_x isKindOf "MAN") then {
			deletevehicle _x;
			};
		}foreach (allMissionObjects "All");
		sleep 2;
		
		
		_objects = "loadObjects" call _pdw;
		hint format ["Restore all objects %1", _objects];		
				
				
	sleep 60;

		while {true} do {
			hint "Save all objects";
			"saveObjects" call _pdw;	
			sleep 60;
				};
				

 

  • Like 1

Share this post


Link to post
Share on other sites

where do you download inidbi ?

 

Share this post


Link to post
Share on other sites
On 10/4/2019 at 4:33 PM, code34 said:

where do you download inidbi ?

 

 

I am using steam version currently. I tested inidbi2 is saving character data.

Share this post


Link to post
Share on other sites

you certainly made some modifications cause the 2 work well together.

Share this post


Link to post
Share on other sites
On 10/7/2019 at 1:58 PM, code34 said:

you certainly made some modifications cause the 2 work well together.

 

I resolved it as a conflict with one of the modules in a mod i am using.  I have noticed that damage state isn't preserved in vehicles.  Is that by design or a bug?

Share this post


Link to post
Share on other sites

what kind of damage ? how do you test it ?

Share this post


Link to post
Share on other sites

The only interesting damages are given by getAllHitPointsDamage and transferred by setHitDamage or setHitIndex .

If you pick damage to further apply setDamage , you'll never recover the former damage status, just applying an average of damage on each parts of the vehicle.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

 

6 hours ago, code34 said:

what kind of damage ? how do you test it ?

 

If you shoot the tire off  a vehicle, then save it. When loading it will spawn with all 4 tires.    

 

A few years ago I had written a function that queried a vehicle (I think via getAllHitPointsDamage) and saved it in inidbi.  I have since lost the code and haven't looked at it in a long time.  I wanted to use oo_pdw instead of trying to re-write my old functions for saving vehicles..(lazy/busy)

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

×