I am now a 50 year old manager of a small piece of a very large company that purchased us about 1 year ago. Been into computers since grade school in the late 70's, having spent years working in the field, building, fixing, installing, selling, teaching, gaming, programming and now consulting on all the aforementioned topics. Computing life is good.

Sunday, November 19, 2006

New Display Toys

One of my tasks at my company is to develop new techniques and leverage new technologies in the development, design and use of our products. Though most of my companies development efforts are now handled by other company employees, almost everything my company now does, started as a project within my own computer. To that end I am always looking at new stuff and for one reason or another I tend to gravitate to techniques and technologies that can enhance the user interface experience. One of our most successful products ClaimsExplorer heavily leverages a flat time line style of UI element that shows Claim activity in data lined up with corresponding authorization, clinical notations, eligibility, and insurance premium payment information at the day level for our clients. I have always felt that the time line approach was a good one but has its limitations. There is only so much information you can cram into a little icon about the occurrences of the period. Diversity and pattern in a dataset as varied as a typical health care claims database become as blurred as the screens full of textual data in spreadsheet form that most claims browsing system present to the user. Its just a little more colorful perhaps in the time line.

The availability of development libraries that leverage the fantastic 3D rendering power of todays modern desktop/laptop pc's have existed for some time, and I have always felt that 3D was the direction to go to bring our visualization elements to the next level. The problem with these libraries has always been that they are squarely aimed at Gamers and Game development. Not that their is anything wrong with games, for I believe we would all be working on timeshared, green screen terminals if it were not for games continuously pushing the envelope for the rest of us more mundane developers out there. The problem has been that the display power does not play well with our boilerplate windows applications where grids of textual data mix with arrays of labels and buttons and text boxes, and check boxes, and other business like attire. (How boring but for me its what pays the bills) Another problem with these development libraries has always been that they represent themselves as a game engine. And they don't integrate well into a business application that has a familiar UI feel. They also typically required programming to them in C++ and as I said before I am a mundane developer not a C++ propeller head, having graduated from VB to VB.NET and C#.

Along comes Dark Basic....

A few years ago I bought Dark Basic Professional. (www.thegamecreators.com) and I really liked the power the language offered but it suffered the same issues noted above, I left it alone for anything work related. Windows Presentation Foundation has promise but its cookies are not done yet and the support for my favorite development environment Visual Studio is spotty and downright buggy at the moment. Given that Vista has taken so long to see the light of day I am not holding my breath. Then the other day on a lark I popped over to the Game Creators site again to see what was new. My eyes could hardly believe what they were seeing. These wonderful folks had actually taken the DarkBasic code base and made a COM Library exposing nearly its entire functionality to the .Net development environment of your choice. This new offering is called DarkGDK.net (http://darkgamesdk.thegamecreators.com/?f=dgdk_net)

DarkGDK.net (DGDK) is a Com library that interop's well with .NET either 1.1 or 2.0. As such you have a choice as to what development language you want to use when interacting with the DGDK library. I have exercised both VB.Net and C# in my exploration with DGDK. Because DGDK is a com library it allows the functionality to be used in a host of development environments.
  • The Express Versions of VB.NET and C#
  • Visual Studio 2003
  • Visual Studio 2005
  • Sharp Develop
There are also 2 versions of the development library with licensing ramifications and cost structures
  • Freeware License
    allowing development of freeware games only 60$ us
  • Full Commercial License
    allowing unrestricted development royalty free 200$ us
  • Upgrade a Freeware License to Commercial
    for those of you who succumb to the dark side and want to
    start selling your offerings 140$ us
Now that was a price point I could live with. So I sprang for the Commercial license ( We do write commercial applications after all ). After entering the Credit Card information I had to wait 2 days to get a link to download the product. Apparently the company hand checks each purchase to avoid fraud. So I had waited this long whats a few more days...

About 1 hour later I popped over to the website again and checked on the status of my order (So much for whats a few more days). So I spent the next few days spending all spare time looking at the forums and reading what I could about the product.
  1. One thing that struck me was that the product is very new. I had not seen any specific release dates but it feels like maybe 1 or 2 months old tops.
  2. Another point is that the website and forums seem to breed confusion over what product does what. Apparently they already have a product called DarkSDK which is a C++ product exclusively and this is a derivative of that item. The distinction is subtle on their web site, in their forums, and even in the name itself. To the uninitiated this breeds the confusion.
The library ships via the net as a single with or without Direct X support files. (74 or 19.5 megs respectivly) which installed on my Vista RC2 setup without a hitch. I then looked at the help file that ships with the library and found not a hell of a lot of help. The help documentation does have a fairly complete walk through for generating a simple .Net application in Visual Studio and in the Express editions of the development environments as well as for Sharp Develop. So I started there and crafted a new Visual Studio 2005 c# application.

The library is signed using a Private/Public keying mechanism that introduced some small additional complexities on development efforts.
  1. Manually add the necessary references to your application
  2. Manually add an existing c# (in my case) class that ships with the development library
  3. Tweak the build properties of the application to turn off Visual Studio Hosting for debugging. I don't believe this is required in the other development environments like Sharp Develop or even the Express editions but Visual studio is what I have.
  4. Configure the projects assembly information like Company, Version Number, Description and what not.
  5. Build the Application ( don't run it yet )
  6. Run an application they ship with the library called the Authenticator and point it at the .EXE file you just built.
  7. It crafts a file called {App name}.dgdk Add this file to your project and set its compile properties to embedded resource
  8. The authenticator also showed you a very long string in the public key box. This string needs to be cut out of the Authenticator interface and pasted into a specific spot in the above included C# class. (speaking from experience, be careful to get the entire string copied and pasted correctly otherwise it won't work)
  9. Finally build the application again now it should run.
(As a side note. acrobatics like the above mentioned exercise are exactly the reasons I tend to just write things I need for myself and the company I work for. At least the use of those items becomes an order of magnitude easier for the developer.)

On completing the above steps you have what is basically simple application loop where you have manually created a simple cube and, within a loop, are slowly rotating that cube about its geometric center.

Now the fun begins

The samples included with the product have a slightly more complex project that extends the tutorial project by creating a windows form that has a picture box. Within this picture box object, the 3D surface will be rendered. This ability is the primary reason for my interest in the library as its integration into established applications and UI's is visually seamless using this technique. Visual seamlessness and interactivity are two different things however, while the picture box object happily will show whatever objects you build into it, getting the ability to interact viathe UI with those things takes programming. Thats where the rich API provided by DBGK comes into play.

The DBGK API is broken out into a number of Classes that expose a number of methods organized into functional groups.
  • 3D.
  • 2D.
  • Sprites.
  • Sound.
  • Text.
  • Math.
  • etc.
One of the included source files that you add into your projects creates a set of static versions of these classes that you can then use globally within your application. Inheriting from this base class then allows you the flexibility to expand and further refine the functionality as needed.

As mentioned above, the documentation is a bit sparse. Many of the API calls are documented in name only without the benefit of any form of explanation or example usage. Think of Microsoft's MSDN documentation devoid of any examples and in many cases missing any of the explanatory text. In other words its bad. I don't want to beat them up to badly on this point after all I am sure the same can be said about our own documentation for the things we have written at Tidgewell Associates. I am also sure that the documentation will improve as time moves along. Until then however the forums are your friend.

There are also cases where an API call has several versions of the call with differing argument signatures that have subtly different names for example...
  • PlayObject(iID)
  • PlayObjectB(iID, Start)
  • PlayObjectC(iID, Start, End)
Fortunately its a simple matter to simplify these cases in C# or VB.NET by wrapping the PlayObject call in a proper overload for your own use.

The Library also supports the reading in of external media in varying formats depending on type. Image types can be accessed via the LoadImage API call contained in the oDBImage class (one of the static classes instanced by the included source files ). Supported image file formats are
  • BMP
  • JPG
  • TGA
  • DDS
  • DIB
  • PNG

Supported Sounds and Music in the oDBSound and oDBMusic classes are
  • WAV
  • MIDI
  • MP3

Supported 3D shape/objects can be read in via the LoadObject method in the 0DB3D class. Formats include
  • X (Direct X format)
  • 3DS
  • MDL
  • MD2
  • MD3

I will admit that many of my attempts to get anything but X objects to load in failed in one way or another, I am not sure if my 3DS exporting from my now ancient Lightwave 7.5 is broken in some way so I have had to stick with X format for my experimentations. Another thing I have noticed is that it helps to have your object composed of triangles, a simple enough task in Lightwave I just triple the polygons.

Putting it all together

In the end, DGDK makes it fairly easy to instance and manipulate the 3D realm and integrate that realm into standard .Net applications. In our case I have some particular needs that the library fulfills nicely after some experimentation.
  • I need to be able to ask the library to tell me if some object is under the mouse
    This is accomplished using the PickObject call within the oDB3D class. One thing I had to do was to keep track of the size of the picture box object as it shrank and expanded in anchor with the containing form. Then each time I asked about a mouse coordinate I had to scale the coordinates asked about by the current scaling factor of the canvas in relation to how large that canvas was at the time the 3d surface was initialized. (The canvas stretches and shrinks but the 3D context displayed within is a fixed size at startup)
  • I need to be able to clear the canvas of objects so I can reload with perhaps a different set of objects
    Use the DeleteObject or the DeleteObjects method in the oDB3d class
  • I need to have the objects placed anywhere within the 3D space
    Use PlaceObject in the oDB3d class
  • I need to have the objects animate in some way (Maybe rotate or scale down or up)
    Use the ScaleObject and RotateObject methods in the oDB3D class
  • I need to move the viewing position (camera) around within the 3D world
    Use the PositionCamera and PointCamera methods of the oDBCamera class

Below is a screenshot of my testing application that wraps up my experimentations to date and creates a simple scene with a number of objects loaded, instanced, and animating with mouse interactivity on the objects (The one under the mouse gets rendered as a wireframe, the others as solid objects).

5 Comments:

Anonymous Anonymous said...

Hey I'm Lonnie Watson from Redfield Arknsas....how the heck are you? Small world. I dogpile searched for myself and there you are. My blog is www.xanga.com/maxximumforce

4:18 PM

 
Blogger APEXnow said...

Hi there, this is Paul (Developer of DarkGDK.NET). I was fascinated to read your article regarding your experimentations with the toolkit, and I'm glad to see that things have worked out well so far. I have to agree that the documentation does need serious improvements, and this is in progress via a Wiki that myself and Mike will be working on for both DarkGDK and DarkGDK.NET. Anyway, I just wanted to say thanks for the good read, and hope to see more just like this.

If you need to conact me, feel free to pop over to the forum or email me at apex@apexnow.co.uk

Paul.

8:43 AM

 
Blogger ~Woody said...

Middle Age? Oy. That must mean that Cole C. is a teenager by now.

'sup Lon?

My A3000 in pieces.

~Woody

4:33 PM

 
Blogger harlock123 said...

Hey there

A voice from the past.
My own 3000 is also in pieces as is most of my old stuff. But my SX64 is still running strong.....

We set it up for new recruits as a lark informing them on their first day that this will be their terminal. Heh...

Cole Colistra... Whoa a name I had not heard in some time. I suspect he's all growed up by now. I hope hes further along in life them I have made of myself.

Pleasure talking to ya....

4:50 PM

 
Anonymous Anonymous said...

Actually... I recently gave parts of the A3000 to my brother Chris. He had found one doing some light duty at a company his acquired some where in Ohio. (I think.)

I mostly keep it around in case I want to ruffle through some of my old Sonic .score files.

12:18 PM

 

Post a Comment

<< Home