flipCode - Tech File - Steven Hugg [an error occurred while processing this directive]
Steven Hugg
Click the name for some bio info

E-Mail: hugg@pobox.com



   06/12/2000, Good Vs Evil


Remember my last post about deciding whether to use Direct3D or OpenGL? I have spent a lot of time this week researching the APIs, reading analyses by game developers, and listening to the little voices inside my head. I have since reached several conclusions:
  • My target market should have accelerators that support OpenGL. If not, shame on them. As a last resort, there is a product called GLDirect by SciTech that is supposed to convert OpenGL calls to Direct3D. This will have to be an unsupported option, but it is an option.
  • It's more likely that I will port to Mac or Linux than the X-Box, so OpenGL would make sense here.
  • It amazes me that vendors are still not required to pass conformance tests for Direct3D. Instead, the burden is on game developers to test their code on every possible graphics card, as there will be subtle (and sometimes not-so-subtle) differences in every driver! Granted, there are differences among OpenGL implementations, but there are conformance tests for OpenGL that help to even out the differences. I'm a small developer and can't afford dozens of test platforms, nor the technical support involved in supporting shoddy drivers, so I would want to go with OpenGL here.
  • OpenGL is on version 1.2; Direct3D is on version 8 and still isn't right. There's something to be said for stability.
  • I already know OpenGL. Learning Direct3D will take weeks of unpleasantly-spent time, and I could really use those weeks to work on other parts of the game.
  • I like OpenGL. Others like OpenGL. A web search on Google returns 64 hits for "opengl-is-good", but only hits for "direct3d-is-good". There are even 2 hits for "opengl-is-GOD" but none of that sort for Direct3D. One is deitified, one is not .. the choice is pretty clear! ;-)
  • I get a tingly feeling when I think of the awesome demos I saw in the SGI "magic bus" in college, and realize that I am using the same API.
  • I believe Microsoft did the industry a disservice (again) by hacking out their own proprietary technology and they deserve to be picked on by poor game developing schmucks like ourselves.
  • I retract my previous statement which implied there was anything redeeming whatsoever about Direct3D. Retained mode is for wusses -- I wrote a partial Lightwave LWO renderer in two days and it wasn't hard at all. And software rendering??? Does that even work anymore? So please (sob) forgive my impudence. Viva la OpenGL!



    The Mighty Quaternion


    One thing that is certain when you're making a physics-heavy 3D game: lots of math. That third dimension really adds lots of evil to your code. Things like tensors, quaternions, skew-symmetric matrices plague your sleep. This week I have been struggling with an evil four-dimensional beast named The Mighty Quaternion.

    For those who aren't yet part of the 4-D jetset, quaternions are ways of representing the orientation (rotation) of an object in 3D space. They are robust (they don't suffer from singularities), versatile (they perform lots of different functions with computational ease) and are commonly used in spacecraft attitude control systems, so I figure they're good enough for a game.

    One bad thing about quaternions is that it's sometimes hard to find information that helps you apply them to games. So for your safety and convenience, I have put up a page of links related to quaternions and dynamics here. I'll also be adding more over the coming months. Share and enjoy.



    Other Developments


    The Java development is going well. I am quite comfy using FreeBSD and JDK 1.2 for editing and compiling (good old javac) and my Win98 box to run programs. My Win98 box crashes 3-4 times per day, and I would like to "sidegrade" to Win2000, but I hear it doesn't support OpenGL for the TNT2 yet. Sigh. I am considering getting a Linux box and using Mesa, but I'd really rather use a commercial OpenGL implementation to develop under.

    I'm surprised at how fast it goes! I'm doing neato-skeeto things with dynamic LOD tesselation and it usually maintains 10-30 FPS. And the code is disgustingly UN-optimized -- I'm using double precision floats everywhere. But using display lists helps even out Java's performance disadvantage a lot. Shoot, I could probably release the final game in Java, if it wasn't such a memory pig.

    I also found a public-domain version of the Java3D vecmath classes. Java3D sucks, but it has a very nice collection of vector, matrix, and quaternion routines. Reuse rocks! Having these classes, and Java's hashtables, lists, and sets make development a lot easier. I will probably write my own versions of these classes in C++ when I go to port, because I despise STL.

    Well, I'd better get back to coding. I hope to have a screenshot at some point, but I want to wait until I really get cooking on graphics and have something impressive. For now I'm trying to do just enough graphics to see what my physics is up to. You know, you really can't easily debug physics routines by println()'ing a bunch of vectors! ;-)





  • 05/14/2001 - Finally, The Project!
  • 10/03/2000 - Whereever I May ROAM
  • 07/08/2000 - Tech File Update
  • 06/12/2000 - Good Vs Evil
  • 05/24/2000 - Ego Surfing
  • 04/24/2000 - Nocturnal Coding
  • 04/12/2000 - Exploding Thought Giblets
  • 04/03/2000 - Event-Driven Games
  • 03/31/2000 - The Housemate Experiment
  • 03/28/2000 - Introduction

  • This document may not be reproduced in any way without explicit permission from the author and flipCode. All Rights Reserved. Best viewed at a high resolution. The views expressed in this document are the views of the author and NOT neccesarily of anyone else associated with flipCode.

    [an error occurred while processing this directive]