About Store Forum Documentation Contact



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
impi Offline
Member

Post: #5
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
mystara Offline
Member

Post: #6
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: #7
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: #8
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
Esenthel Offline
Administrator

Post: #9
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: #10
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