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 / Managing Object Numbers (i.e. sprites or vectors)

Author
Message
Spaceman 13
16
Years of Service
User Offline
Joined: 4th Feb 2008
Location:
Posted: 4th Feb 2008 22:16
I'm just starting on GDK, so pardon me if I am missing something obvious.

It seems like GDK works primarily on the basis of object numbers. For instance, each sprite is numbered, each vector is numbered. Is there an easy way to manage all of these objects?

Say I create three vectors in a function using dbMakeVector3(). I do some manipulation with two of them, and save the result into the third. I no longer care about the first two and delete them with dbDeleteVector3().

What's the best way to manage the object numbers? How do I know what the next available number is? Do I reuse numbers once I delete the original object?

I guess in a way I'm looking for an object-oriented wrapper to many of the functions. Is there such a thing?

Thanks!
Carlos
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 4th Feb 2008 22:32
Yes, there is. LightEngine is all about this, but... only for DGDK.NET.

I know some people began doing it for DGDK (C++) but I've never seen any as complete.

Thiago
Spaceman 13
16
Years of Service
User Offline
Joined: 4th Feb 2008
Location:
Posted: 4th Feb 2008 22:39
So, I guess the silly question becomes what is "LightEngine" and DGDK.NET? I can't find references on the site for either one. Although I see some references to DGDK.NET on the forums implying that it is beig released soon?
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 4th Feb 2008 23:36
DGDK.NET is the .NET version of DGDK. It for us who cant C (because we use glasses )

LightEngine is a object-oriented wrapper for the DGDK.NET so we dont need to think about object numbers (all that work has kBessa done for us...)

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine (thanks kBessa)
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 5th Feb 2008 04:47
@Niels: I use contact lenses, the doctor said I wasn't supposed to use glasses as soon as I got 5 degrees of myopia (now I'm at 10 degrees). At least I don't look like a nerd!

@Spaceman 13: Niels explained it correctly. DGDK.NET is a product from TGC. It was sold but will be free now, I think we might expect a release date up to the end of the month (maybe next week?) It is essentialy like DGDK for C++, but you can use it with any .NET language: C#, VB, Delphi and many others, even C++.NET (or Managed C++).

About LightEngine, yes, it is my work and you can take a look at some posts here, at the DarkGDK forum. It actually does what you're wanting: DarkGDK with Object-Oriented Programming, like:

LightObject car = new LightObject("myCar.x");
car.Position(10, 5, 20);
car.Rotate(50, 0, 0);
LightText.Text(0, 0, "Car at " + car.X);

And so on... But, only available for DGDK.NET
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 5th Feb 2008 11:34
Quote: "At least I don't look like a nerd!"


Hey... I look like a nerd AND IM PROUD OF IT

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine (thanks kBessa)
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 5th Feb 2008 14:22
As a work around for now, you could use the exist functions for that particular object/vector etc..

for instance:



A little word of warning when using this method, you must use the new object number immediately after finding it otherwise you will get errors.

e.g.


The above code will cause an error because obj and obj2 will have the same number because both are free at the time of finding a free number in the while loop.

So to make the above code work you would need to do this.



Or you could create your own load object function that finds a free index, loads the model and then returns the object index.

The Sun is trying to kill me!
Spaceman 13
16
Years of Service
User Offline
Joined: 4th Feb 2008
Location:
Posted: 5th Feb 2008 15:53
Thanks for all the feedback. If the response rate on this thread is indicative of DGDK in general, it is a good sign for my using the platform I've been debating between GDK, Allegro, DXUT, and another framework from a book I have. THe main thing keeping me from GDK is it's lack of OOP, but maybe with .NET and LightEngine I can fix that. Time to do more tests (and wait for the free GDK.NET)

BTW, Monotonic, thanks for the *Exist() tip. Turns out that it is hit and miss. Object and Sprite both have that function. VectorN does not.

Carlos
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Feb 2008 18:03
@Spaceman 13
I'm working on something that sounds exactly like what you want Unfortunately, it's not done yet, but it will be soon. Also, for vectors and things like that, you'd be better off using the D3DXVECTOR2/3/4 structures for those They are what DBP uses internally, and it will be faster using them directly rather than using the DBP commands.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 9th Feb 2008 16:01
Well - if you like C++ for the speed boost and don't mind doing your own house cleaning - as was said many people have started wrappers for the C++.... as for the comment about people not finishing them - I think he means no one has really released a "OOP Wrapper for all" and I think its ... speaking for myself... not so much about finishing it - as making my own for my own purposes....

Also - there have been discussions on the best way to do it - (manage object Numbers) and we all don't always agree - but the "Object Exists" is one method, another trick is to keep track of the last # you used for a particular object, and not use that again... this speeds up things a little versus looping and looking for a freebie.

I do a little combination of both but hey - to each his own.

I'm not a C++ master but I have my own wrapper lib for C++ - and a working copy can be found here: http://forum.thegamecreators.com/?m=forum_view&t=120482&b=22

Slow Target
16
Years of Service
User Offline
Joined: 10th Jan 2008
Location:
Posted: 16th Feb 2008 05:16
for simple programs, you can use enum

enum { zilch, Basketball, Football, Tennisball};

were zilch is the same as zero, Basketball the same as 1, Football the same as two...

dbMakeVector3(Basketball);
dbSetVector3(Basketball, 10,20,30);
dbMakeObjectSphere(Basketball,20);

is a lot easier to read than

dbMakeVector3(1);
dbSetVector3(1, 10,20,30);
dbMakeObjectSphere(1,20);



search for "OO GDK" for an object oriented wrapper for Dark GDK. this link might work...
http://forum.thegamecreators.com/?m=forum_view&t=114964&b=22
[href]null[/href]

it seems pretty complete, handles the object creation you mentioned, and also fixes some Dark GDK inconsistancies (like you can position a camera with a vector, but not an object).
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 16th Feb 2008 06:21
Yep, Dan was trying to make something similar to LightEngine for C++. It was going nicely, but I haven't seen him around. Are you around there, Dan?

I myself thought about getting a C++ version of LightEngine, but as you can read from this other thread, I'm not a C++ guru. For real, I'm more likely to be a total beginner in C++, so... That's something that probably won't happen (at least, not by me).

Login to post a reply

Server time is: 2024-11-20 01:10:45
Your offset time is: 2024-11-20 01:10:45