Creating an NRaas project Regarding Exporting/Importing

Talk nerdy to us here.
Post Reply
icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Regarding Exporting/Importing

Post by icarus_allsorts » December 16th, 2015, 7:22 am

HI, I was hoping to get some help on the ExportContent and ImportContent methods that, if I'm not mistaken are run when travelling/exporting and importing sims/lots from the library etc (correct me if I'm wrong). I can see that in ExportContent the "propertyStreamWriter" is supposed to "write" each variables to a specified hashkey which is later "read" during ImportContent to retrieve the stored variable. My question is is there a specific way these hashkeys must be defined or would any random uint suffice so long as it hasn't been used before by the stream writer?

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » December 17th, 2015, 3:03 am

You are correct what they are used for but unfortunately I'm not sure how EA generated them. I tried a few things I thought might be it but didn't come out. According to this thread at MTS Arisl says they don't have to be unique. Interesting though as it looks like EA went through the trouble to make them unique. Wish I had more info for you.

icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Post by icarus_allsorts » December 17th, 2015, 6:17 am

AH thanks, must've missed that thread. I think I did notice that the same uints were used just in different classes so I just assumed any old value would do so long as it doesn't conflict with one already used in the same class. But experimenting with any old values so far has proved otherwise. But it could just be me bungling up the method code in the first place.

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » December 17th, 2015, 10:15 pm

So you've had conflicts with using the same values? Anything to do with persistence is still somewhat a mystery to me so all I can learn through other's trial and errors is welcome. I look at twallans persistence code and scratch my head. His backwards and forwards experience of C# shines there and I'm only 2 years deep in the language.

icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Post by icarus_allsorts » January 8th, 2016, 10:06 am

Just to update, it turns out that the "problem" was much more simpler and had mostly everything to do with me as suspected.

Was trying to export/import values in a custom object component under the "any old random uint value works" assumption, and kept thinking that the fact that the value weren't being imported meant the assumption was wrong. Have since learnt that objects post travel are basically recreated from scratch so the custom object component added before travel has to be manually readded post travel. No component post travel to begin with = nothing to run the import process in the first place.

So I scrapped the object component idea and just went with a custom object. Redid the export and import content methods using random uint values worked without a hitch (well, as "random" as incrementing the uint value last used in the base class's ExportContent method can be, which is to say not at all). Neither proves or disproves the "any old random uint value works" assumption but hey, it worked at least.

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7596
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » January 9th, 2016, 12:19 am

Yes everything is like that. It's why the Sims themselves loose so much data. They are fresh Sim instances with data merged on top of them. It's rather messy. I'm left wondering what was wrong with serialization but then I cringe how EA would have fuddled that up too.

Thanks for getting back and good to hear it works though. I guess we have no way of knowing if we are doing that right so we'll just go with whatever works until proven otherwise. :)

Post Reply