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 / [DarkGDK 2.0] ids auto selection , is it a bug?

Author
Message
haliop
User Banned
Posted: 13th Jul 2012 04:11 Edited at: 13th Jul 2012 04:12
The new GDK comes with new feature where you dont have to assign Ids for objects or images etc..
it will find it for you if you assign -1 to the object id var or just leave it blank.

however , when i used such a system i used one of the following

finding empty id slot


this will cycle trough all objects from slot 1 to whatever slot is empty.

or the other way

this a simplier way to achive the same goal will just increase the counter each time it is called and return a new and open id slot.

however
since DarkGDK 2.0 i started using the built in feature as mentioned at the top of this post, but something very strange is happening
it gives random numbers instead of increasing or open slots
one id can be 1 and the other can be 2304 and the third can be 5
i dont know why it is working like that i dont have the open source for it but should it do that or is that a bug?
cause if i want to use dbPickObject(MouseX,MouseY,startId,endId) it gets kinda messed up where the command cycle trough alot of ids that arent neccesery for it.

any suggestion how this system works?
maybe its a bug of somekind and mybe that is causing my games to crush sometimes..

mistrel? ..
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2012 04:32
Yes. I found it too. My count starts at 22 for some reason for camera,image,and fx, and 601 for objects.... Weird.

The fastest code is the code never written.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Jul 2012 13:59
I believe it might be using something like:


The idea is that, until you start having a large amount of ID's allocated (for bitmaps, cameras or lights it might not make a huge difference, but assuming objects and images which may (or may not) allow ID's up to 2^32 - 1 / 2) you are likely to pick a free ID at random in just a few tries.


"Why do programmers get Halloween and Christmas mixed up?"
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2012 14:26
This can't be done with cameras. Cameras have to be sequential.

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 13th Jul 2012 14:32 Edited at: 13th Jul 2012 14:34
DarkGDK 2.0 handles ID allocation using a hashmap cache for speed (the IDs are cached, not the actual allocation). Because of this implementation, the order in which IDs are returned is undefined.

Currently there is special handling for dynamic cube maps (IDs 1-10) and memblocks (IDs 1-255); neither sequential. I can provide special functionality for cameras if you can demonstrate the problem in an example.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2012 14:45
It's simple. If the cameras are not sequential, they don't appear correctly. This issue is a DBP issue, but it's not something to worry about. The only thing that needs to be addressed is the auto-assignment for cameras.

This works every time.

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 13th Jul 2012 14:57
What doesn't appear correctly? The cameras seem to exist just fine:



Also, is there an upper-limit for cameras where things stop working such as 31, 32, 255..?

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2012 15:38
Yes, the camera exists, but the render is wrong. If you have camera0 (which is always there) and skip camera1 and create camera2, camera2 will render but won't render to texture--it will render to the screen over whatever camera0 is rendering. It seems that it renders to camera0's back buffer. If you have cam0 and cam1, cam1 will render to image (if you set it up). As I said, it's not non-sequential cameras that's the problem, it's that DGDK2.0 auto-assigns them non-sequentially. This is an easy fix (I think); at least we can work around it by assigning them manually.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-04-19 19:15:01
Your offset time is: 2024-04-19 19:15:01