About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Object IDs
Author Message
mystara Offline
Member

Post: #1
Object IDs
Hi,

I have seen a few threads that get close to this question, but would just like to confirm my answer.

Is it reasonable to assume that if the same world is loaded on two different computers then constant objects will be instantiated/created in the same order?

What I want is for each constant object to have a unique id, so that I can pass a message from the server to the client and the client will know what object is being referred to.

I don't want to manually assign ids to objects.

Is there a better way to do what I want that using a static counter in my object's class and assigning the current counter value to each object as it is instantiated? I get the impression that ear them has no built in unique I'd number system
10-18-2011 08:39 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Object IDs
I'll add this to the roadmap
10-18-2011 12:00 PM
Find all posts by this user Quote this message in a reply
mystara Offline
Member

Post: #3
RE: Object IDs
So at the moment, can I assume that objects in the world file will be instantiated in the same order on different machines?
10-18-2011 02:06 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Object IDs
only if you will use WORLD_FULL
for WORLD_STREAM only some areas are loaded at start.

at the moment for some critical objects you can manually assign a custom "id" parameter in the world editor.
10-18-2011 02:39 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #5
RE: Object IDs
For me currently, I manually assign uid on objects I want to be able to consistently track from server to client. Besides the manual process, it really isn't so bad, especially you can filter showing all objects of certain type and view each object quickly. However, as the number of manually assigned objects rise, the more unmanageable it becomes.

What I'd like to see (and still maintain flexibility with all the different projects out there) is for the editor to automatically assign an auto-incrementing long integer value on objects but based on obj type. So for obj type xxx, uids 0-999999.. and obj type yyy, the same uids 0-999999... can be assigned automatically. I think a global, auto-incrementing uid assigned to any obj regardless of obj type is inflexible.

www.thinkplaystudios.com
(This post was last modified: 10-19-2011 03:45 AM by aceio76.)
10-19-2011 03:37 AM
Visit this user's website Find all posts by this user Quote this message in a reply
impi Offline
Member

Post: #6
RE: Object IDs
Definitely necessary. Unique ID's are very important ... but I don't see the benefit of grouping by type. I think its more applicable to a wider range of projects to have global unique ID for any object regardless of type. I'd like to see these tied to object ID's in the database.
10-30-2011 03:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #7
RE: Object IDs
Tying the obj id to entries in the db will have to be done by you in your own project.

www.thinkplaystudios.com
10-30-2011 03:53 AM
Visit this user's website Find all posts by this user Quote this message in a reply
mystara Offline
Member

Post: #8
RE: Object IDs
WORLD_FULL is fine for me to use. Each world is very small anyway smile
10-30-2011 12:14 PM
Find all posts by this user Quote this message in a reply
impi Offline
Member

Post: #9
RE: Object IDs
(10-30-2011 03:53 AM)aceio76 Wrote:  Tying the obj id to entries in the db will have to be done by you in your own project.
Well yes ... but it would be ideal if the ID's can be totally unique then its easier to tie them to a db than if an ID is reused a few times. For efficiency you just want to use one number.

Also it opens many opportunities re easily accessing info on an object as the ID can be used to lookup in the db, for eg we have a webservice to return object info so its easiest to search the asset table on this unique ID.

Of course one needs to think about uniqueness across worlds and areas etc, so ideally each (different) world + area combination should create some offset in the unique ID.

Also if one generates (loads) an object from the db one would like to set that ID.
11-02-2011 05:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Object IDs
Each object will have totally unique id
UID.randomize
11-02-2011 11:23 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #11
RE: Object IDs
The issue I have with this approach is that the UID.randomize has no idea what's already present and used in the database. While it may work with other objects in the current gameworld, it won't integrate well with things created dynamically and stored in the DB that is then materialized in the gameworld by the server to the client.

www.thinkplaystudios.com
11-05-2011 07:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: Object IDs
I have already thought about it
in next SDK there will be additional parameter:
"C UID *obj_id=NULL" for Game.World.objCreate,objCreateNear methods

'obj_id'=optional parameter specifying forcing custom object id for the object (the parameter can be useful if you've created an object on the server, and need to create it on client using the same id from the server, if the parameter is not specified then object id will be randomized)
11-06-2011 06:07 PM
Find all posts by this user Quote this message in a reply
impi Offline
Member

Post: #13
RE: Object IDs
Sounds like a good solution.
11-29-2011 04:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply