Adam's Lair Forum

game development and casual madness
It is currently 2017/04/25, 12:31

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Guids?
PostPosted: 2017/04/12, 13:35 
Junior Member
Junior Member

Joined: 2017/02/05, 13:06
Posts: 27
Role: Hobbyist
I'm having an issue when re-loading a saved game where some objects are being loaded more than once. To try to check that this is happening I'm trying to give each object a unique ID that will be saved when the game is saved, and loaded when its loaded. I'm trying to use Guid.NewGuid() but the guids I'm getting back are all zeros. I would expect this if I had tried "new Guid()" but that's not what I'm doing.

I thought maybe this is a quirk of using a Portable Class Library but after doing some googling on this subject I'm unable to find any pages where anyone has reported this as an issue.

Is there something about PCL's, duality, or something I'm missing? I could come up with my own unique ID generating algorithm but I'd rather use what's tried and true before rolling my own.


Top
 Profile  
 
 Post subject: Re: Guids?
PostPosted: 2017/04/12, 17:20 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 1948
Location: Germany
Role: Professional
It sounds like you are re-inventing the wheel a bit here ^^ Duality serialization already takes care of object identity (reference A twice - serialize two references to A instead of A twice), so if you use the builtin Serializer API, that shouldn't be an issue.

(There are of course good reasons for re-inventing the wheel in some cases, so I'm just mentioning it in case you simply didn't know you could use them for your own purposes.)

Quote:
Is there something about PCL's, duality, or something I'm missing? I could come up with my own unique ID generating algorithm but I'd rather use what's tried and true before rolling my own.

As far as I know, there's nothing related to Duality or PCLs that would cause Guid not to work anymore - in fact, Duality uses that same API as well for providing version control stable GameObject IDs, so my guess would be that the error is somewhere else.

Maybe you could share some of the relevant code for us to take a look? Ideally in a minimal, self-contained sample that reproduces the issue.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
 Post subject: Re: Guids?
PostPosted: 2017/04/12, 17:41 
Junior Member
Junior Member

Joined: 2017/02/05, 13:06
Posts: 27
Role: Hobbyist
Thanks but after posting this I was unable to reproduce the issue so I'm wondering if it may be due to changes in the game code from when the game was saved to when it was loaded.

For now I'll just ignore it and worry about it again if it comes up again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group