Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / id Numbers in DGDK - Burning Question....

Author
Message
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 2nd Apr 2011 07:17
I've been dying to ask but never had the courage in fear that it's in some documentation somewhere and I'll get flamed for being noob...

In DGDK everything is labeled with id numbers, even vectors! So, if id number 1 is a mesh, then I can't have a different object with id 1. But camera I can have as a 1. But what about particle systems, sprites, textures, everything? Is there a guide somewhere I'm missing?

Sorry, a bit frustrated 'cause I finally got it out there, lol...
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 2nd Apr 2011 08:23
Everything has a different ID, they are all diferent sets of ID's because they are all different types of entities. Particle systems have their own sets of ID's, starting at one, same with meshes, 3d objects, images, sounds ETC. They won't interfere with each other at all.
You can have image(1), object(1), mesh(1), and sound(1) all in the same program with no problems, you just can't have two objects with the same ID, or two meshes with the same ID.
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 2nd Apr 2011 09:17
Refer to techlord's resource manager. I have personally found it very usefull!

Regards,
JTK
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 2nd Apr 2011 15:56
Thank you so much for clearing that up! And thanks for the thread link, JTK.

Funny, I'd actually written an id manager myself using a queue for "not used index." I figure that's probably the best way to keep track of ids in a dynamic environment (enemies and bullets created and destroyed on-the-fly, for instance).

So I guess an add-on question:

If I have several objects using the same mesh file (like multiple bullets/enemies that look the same), should I do a dbLoadObject( getid(), "meshfile.x") for each one? Or should I pre-load all the meshes I'll be using, turn off the visibility, and use those to dbClone() or something to save load times? Or will DGDK take care of cloning as long as I'm directing to the same file?
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 2nd Apr 2011 15:58
Wait... I just realized...

If I created a 3d box... is that in the same id space as a 3d mesh? At least I thought so... I mean, if I'm using Fulcrum, every physics object can collide and are treated as unique, so...
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 2nd Apr 2011 16:07
Yeah, all 3D objects share ID numbers.

You should never load the same thing twice, this is not just to save loading times, its memory also, clone or instance everything.

_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 3rd Apr 2011 02:48
Be careful with DarkGDK 3D math IDs: matrices and vectors share the same set of IDs!

iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 3rd Apr 2011 22:36
Good to know, thanks!

For vectors I'm going to use D3DXVector2/3 as suggested. I think the resource manager will be extremely useful.

So, what's the consensus for id tracking? Is it more efficient / easier to iterate through dbObjectExists() or push not-in-use id numbers into a list/queue?

Thanks,

Flamesilver
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 3rd Apr 2011 22:44
One more thing about the same topic. Are Particle Systems considered a 3D Object (and share id with mesh, boxes, etc)? I'm pretty sure Cameras aren't. What about textures & fx? Do they share? Is there a chart somewhere?
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 8th Apr 2011 11:41
Quote: "So, what's the consensus for id tracking?"

No real consensus I guess. You can treat them manually or let some kind of automatic function to find a free id and have it assigned for you.
If done manually you may have more control with z-rendering priority, but it requieres more work and planning.
In any case it is always better to keep id numbers as low as possible. Try to avoid high id values.

Quote: "Are Particle Systems considered a 3D Object"

No, in-built particles have their own id set.

Quote: "What about textures & fx? Do they share?"

No

Login to post a reply

Server time is: 2024-06-16 01:31:33
Your offset time is: 2024-06-16 01:31:33