The Game Creators
The Game Creators Home Online Shop Click to Login
  Hot: Christmas CompetitionNovember NewsletterModel Pack 36DB Pro Pack 2009DGS BonanzaCharacter PackFPS Creator Bonanza;
The Game Creators
Dark GDK / Object Oriented GDK - WIP

Go to the first page of this board Return to the Forum Menu Post Message
24 Messages - Page   of 1   
Bookmark and Share Search the Forum

Author Message
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 20th Nov 2007 13:49     Edited: 22nd Nov 2007 09:51     | link | toggle

If you are anything like me, you probably hate the way you create objects, camera, images, and other entities in DBP and GDK. The way you have to number things gets so frustrating. Well, I got the free version of GDK, and since it takes no advantage of C++'s OO features, I am working on something that does.

Doesn't do alot so far, but you can make objects and manipulate them using OO.

Here are some examples:

GDK:
+ Code Snippet
dbMakeObjectCube( obj, size );
dbPositionObject( obj, x, y, z );


OO GDK:
+ Code Snippet
OOGDK::Object::Cube MyCube( size_optional );
MyCube.Position( x, y, z );



GDK:
+ Code Snippet
dbMakeObjectSphere( obj, size );
dbScaleObject( obj, x, y, z );
dbText( 0, 0, dbStr( dbObjectPositionX( obj ) ) );


OOGDK:
+ Code Snippet
OOGDK::Object::Sphere A_Sphere( size_optional );
A_Sphere.Scale( x, y, z );
dbText( 0, 0, dbStr( A_Sphere.Pos.X() ) );



You may not want to use it, since you are likely used to the DBP way of making things, and since this has no documentation yet, but if I get anywhere with it, I will write up some help stuff and release it.

C&C please


[edit]

Version 1 Uploaded. I will create a simple demo to go with it later, in the meantime, fool about with it a bit yourself, the intellisense should help.

If you want to see all available commands, press Ctrl+Atl+J to get to the Object Browser, find your project, open it up and look through all the classes.

Simply include "OOGDK.h" to your project to get it working.


[edit]

Here's a demo to try. By the way, the crappy 3rd person camera is just GDK's way of doing it. Personally, I would do it different (so it would properly work), but hey, such is life.

+ Code Snippet
// Required headers
#include "DarkGDK.h"

// Object Oriented GDK
#include "OOGDK.h"

// Entry point
void DarkGDK( void )
{

	// Setup
	dbSyncOn();
	dbSyncRate( 60 );
	dbSetDisplayMode( 1440, 900, 32 );
	dbMaximizeWindow();

	// Main Camera
	Camera MainCam;							// Creates a camera
	MainCam.SetCurrent();					// Sets as main camera
	MainCam.SetRange( 1,0x7fffffff );		// Sets near and far range

	// Player object
	Cube Player;							// Creates a cube and automatically scales to 100. You can add a parameter for the size if you like
	Player.Scale( 50.0f, 100.0f, 50.0f );	// Scale the cube so it's quite tall

	// Create a matrix (not OO yet)
	dbMakeMatrix( 1, 10000.0f, 10000.0f, 50, 50 );

	// Main Loop
	while ( LoopGDK() )
	{

		// Control the player
		Player.Move( (float)( dbUpKey() - dbDownKey() ) * 10.0f );		// Move object using up and down arrowkeys
		Player.Turn( - (float)( dbLeftKey() - dbRightKey() ) * 3.0f );	// Turns the object (automatically left)

		// 3rd person camera
		MainCam.Follow( Player.GetPos(), dbWrapValue( Player.GetAng().Y() ), 600.0f, 300.0f, 20.0f, 0 );	// Follow player. Notice that only 1 param is needed for coords.

		// Refresh
		dbSync();

	}

	// Return to windows
	return;

}


"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Download: OO GDK.rar Size: 8929 bytesReport this message as abusive
kBessa

User


Joined: Wed Nov 8th 2006
Location: Manaus, Amazonas, Brazil
Posted: 20th Nov 2007 18:02           | link | toggle

I think I've seen something like this somewhere...

I just hoped all "Wanna make my own DarkGDK OO Wrapper" would join efforts and make a unified one. At least there's only one for DGDK.NET.

Anyways, good work out there, but remember: coding will be fun! The problems it to write the Docs :-P

Best regards,
Thiago
Back to top
kBessa.net
Report this message as abusive
CattleRustler

Moderator


Joined: Fri Aug 8th 2003
Location: case modding at overclock.net
Posted: 20th Nov 2007 18:05           | link | toggle

Quote: "I think I've seen something like this somewhere"
lol, yeah

werent there also 2 version for c++, one by IanM and one by someone else I cant remember atm...?

My DBP plugins page is now hosted here
Back to top
Report this message as abusive
kBessa

User


Joined: Wed Nov 8th 2006
Location: Manaus, Amazonas, Brazil
Posted: 20th Nov 2007 18:11           | link | toggle

I know RPDan is trying to make a 1:1 version of LightEngine for C++ (using Managed C++)
Back to top
kBessa.net
Report this message as abusive
n008

User


Joined: Wed Apr 18th 2007
Location: Gazala 1943
Posted: 20th Nov 2007 18:27           | link | toggle

Quote: "got the free version of GDK, and since it takes no advantage of C++'s OO features"
What in the hell?! Whew, i'm glad i decided to wait for GDK.NET! It was my only reason for switching in the first place!

Back to top
Send AIM user a message
Report this message as abusive
Niels Henriksen

User


Joined: Mon Sep 27th 2004
Location: Behind you breathing heavely
Posted: 21st Nov 2007 06:58           | link | toggle

Quote: "I know RPDan is trying to make a 1:1 version of LightEngine for C++ (using Managed C++) "
So a project in LightEngine.NET will actually could be moved to LightEngine++ ?

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine
http://noggs.netopcom.dk/forum/default.asp - Forum for the game
Back to top
Netopcom Webhosting Find user on ICQ
Report this message as abusive
kBessa

User


Joined: Wed Nov 8th 2006
Location: Manaus, Amazonas, Brazil
Posted: 21st Nov 2007 07:29           | link | toggle

I cannot confirm this for sure, as RPDan is doing it on its own. I actually am planning on translating LightEngine to C++ myself, but that would not happen (or even be started) in the next couple of months.
Back to top
kBessa.net
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 21st Nov 2007 13:21           | link | toggle

Hi all. So far I have made OO implementations for Objects (Cubes, Spheres, Cylinders, Cones, Planes [not plains], and Loaded objecs), Cameras, and Images. All work in practically the exact same way as the examples I gave.

I have also added alot of extra features to the two vectors classes that are needed throughout. Both vectors allow you to set and retrieve components, get vector angles, dot products, lengths, addition, subtraction, multiplication, division, etc. 3D Vectors have extra features, such as setting the vector to the normals of an angle, which is useful for things such as 3rd person cameras, etc.

I will soon start working on sounds, music, etc

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
RPDan

User


Joined: Sun Apr 29th 2007
Location: Cyberspace
Posted: 21st Nov 2007 13:47           | link | toggle

Are you using managed or unmanaged c++?
Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 21st Nov 2007 13:58           | link | toggle

Unmanaged

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
Miguel Melo

User


Joined: Mon Aug 8th 2005
Location: Lisbon, Portugal
Posted: 21st Nov 2007 16:12           | link | toggle

Quote: "Unmanaged"

I'll keep an eye on your project Zotoaster, then. So far I only ever used unmanaged gdk.

I have vague plans for World Domination
Back to top
Silicon Notation
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 21st Nov 2007 16:24           | link | toggle

Good stuff. Just finished adding sound and music capabilities.

Now to sprites, matrices, terrains, all that misc stuff.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
Google Ad
Back to top
 
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 22nd Nov 2007 08:09           | link | toggle

Ok, got all the possible object commands in OOP form, expect for animation commands, which I can do later. There's nothing for limbs or meshes or anything, because most of them have nothing to do with the actual object. The beauty of it all is that if there's something missing in this wrapper you can always use the actual dgdk functions There are currently 96 object methods you can use, that should be good for now.

Okay, now, to work on cameras, images, etc. Oh god

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 22nd Nov 2007 09:42     Edited: 22nd Nov 2007 09:51     | link | toggle

Sorry for the triple post. Just wanted to bump this and say that I've uploaded the first version in the top thread. Please read the information at the bottom for how to use it.

[edit]

Uploaded a demo to try on top thread.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
General Reed

User


Joined: Fri Feb 24th 2006
Location: Cyberspace
Posted: 22nd Nov 2007 11:56           | link | toggle

hmm interesting

I have AMD Athlon X2 5200+, Geforce 7600GS, 2GB Ram, 240GB HDD and one hell of a headache
Back to top
Scratchyrice Development
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 1st Dec 2007 08:32           | link | toggle

Well, I'm putting this to the test and trying it out to see how practical it is, and I'm using it for my project that I have to do in computing class, and I have to say, it works really well. I havent found many commands yet that I havent implemented, but then again, it's a 2D game.

I suggest some people please try it out and report back any bugs or errors, or any missing commands. It would help me out alot.

Cheers

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
Coding Fodder

User


Joined: Thu Sep 25th 2003
Location: Somewhere in my cerebralcortex
Posted: 5th Dec 2007 20:34           | link | toggle

I just installed GDK. Pretty annoying how all the DB AND directX commands get dumped on the global namespace.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Back to top
Report this message as abusive
Bishop

User


Joined: Wed Dec 18th 2002
Location: In my favorite chair...
Posted: 6th Dec 2007 03:02           | link | toggle

Quote: "What in the hell?! Whew, i'm glad i decided to wait for GDK.NET! It was my only reason for switching in the first place!"

You still get a significant performance boost by switching =P

Looking forward to this! Would be very nice to have this wrapper...I remember a while back someone was making an OO wrapper for DarkBASIC professional, that was kinda cool, but this will make the GDK complete!

Cheers!


Tux is my guildmaster.
Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 6th Dec 2007 08:02           | link | toggle

Quote: "Pretty annoying how all the DB AND directX commands get dumped on the global namespace."

That's one of the main advantages of this. What I love about VS is it's IntelliSense, it's very useful, but GDK doesn't take any advantage of this, so you have to know all the commands anyway.

Instead of sticking "db" before every function, it would be alot better if there was a db namespace, and then you can browse all the commands, but, that doesn't seem to be the case. With this wrapper, you just have to remember the names of a few classes (and even if you dont, there are namespaces that you can browse with IntelliSense), then you can browse all the methods of those classes. The names pretty much correspond with the actual DGDK ones, except for some (i.e. SetGhost( bool ); ), but on the whole, it's pretty easy to understand what they all mean. Also, all the commands you browse are made for that current class. If there was a db namespace, you would have to browse every command that DGDK offers.

On another, slightly theoretical note, if you have run out of ideas of how to make your objects look good, you dont have to remember all the appearance commands. Just loop through all the commands using IntelliSense, and say to yourself, "Hey, I forgot that command, let's plug it in", heheh.

Bishop:

Yeah, but it didn't get finished. There's another one on it's way I believe, but they were both just precompilers. You would have to compile twice for it to work (not that there's any better way of doing it). C++ has classes nativelly, so it's a huge advantage.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Back to top
Report this message as abusive
Benny53

User


Joined: Sun Dec 25th 2005
Location: Ohio
Posted: 6th Dec 2007 16:05           | link | toggle

This looks pretty good. I'm making an oop thing, but its not going to be released unless its part of my fps engine . I'm just developing it for my own needs. Seems extremely similar. haha, oh yeah, good job for making the stuff like ghost on and ghost off in one command like setGhost. I was thinking I was the only one to think of that .

WC Physics - PhysX wrapper for Dark GDK.
Back to top
Send AIM user a message
Report this message as abusive
Deagle

User


Joined: Sun Aug 28th 2005
Location: Finland
Posted: 7th Dec 2007 01:42     Edited: 7th Dec 2007 05:57     | link | toggle

Oh man, i love this! Thank you

edit: the dbObjectScreenX and dbObjectScreenY haven't been converted yet?

Deagle aka D-Eagle
Back to top
Report this message as abusive
jason p sage

User


Joined: Sun Jun 10th 2007
Location: Ellington, CT USA
Posted: 7th Dec 2007 12:08           | link | toggle

Yeah - I think many of us have our reasons for ooping GDK ourselves - while others find the already made stuff ideal - or leading efforts to get coders to unite.

I personally think unmanaged is better - plus its truly compiled - not at runtime - which I just think is stupid - and sadly that's the architecture .net is built on. More speed period using C++. More work too - like having to clean up everything yourself - where in .net - most objects get "disposed" when they go out of scope - or at least are flagged as "ready to be freed/deleted from ram" - so the garbage collector can get to it whenever it wants or you force it.

My reasons for doing my own wrapper are:
1: I know every nook and cranny - helps me when its time to optimize, track errors, etc.

2: Tailored for my own purposes - I have my own coding style - thats a mixture of commerical business style code, assembly lean mean fighting fast tricks, and because I wrote it myself - all the things I look for ARE considered - and if not - I write them.

Note - like Benny - I too make some functions one call - in place of using two or more variaties of DarkGDK call.

Another thing I do is to make my classes such that I can use the classes and the raw GDK commands at will - with minor "rules" or considerations to keep things purring - this way I can have both OOP "organization" and "Ojects" etc while still having the ability to utilize the MUCH FASTER "non-oop" calls directly.

Remember - the more fluff you add to make programming easier - USUALLY translates into more code the CPU needs to crunch. Easier to code CAN have consequences in speed etc.

Back to top
Jason P Sage
Report this message as abusive
Deagle

User


Joined: Sun Aug 28th 2005
Location: Finland
Posted: 12th Dec 2007 09:03           | link | toggle

Found a bug; dbPickObject does not work if you use OO cameras.

Deagle aka D-Eagle
Back to top
Report this message as abusive
Slow Target

User


Joined: Thu Jan 10th 2008
Location: Cyberspace
Posted: 27th Jan 2008 14:55           | link | toggle

Zotoaster,

This is cool. In another post I compained that some of the commands were not consisant. For example, you can position a camera with a vector or x,y,&z, but not an object. You've fixed it!
Back to top
Report this message as abusive

Go to the first page of this board Return to the Forum Menu Post Message
24 Messages - Page   of 1   
Search the Forum

Sorry, but it has been so long since anyone replied to this Thread that it has been automatically locked.
You may read it but not reply.

Forum Search

Enter a word or phrase to search our Forum for:

Thread Subject Search
Search Phrase:
Search Scope: Entire forum
Just this board
 
Google Forum Search
Search Phrase:
 
Apollo v2.02


Dark Game Studio
Privacy Policy AUP Top of Page