Archive for October, 2009

Handy Conversion Functions

Here is a small set of handy utilities from David Shute.

// ******************************************************************* 

function vecToStr(vect, dp)
{
    //returns the given vector as a string in the form "(x, y, z)"
    //Also accepts an optional parameter representing the number of
    //decimal places to display the results to (int) 

    if (dp != null)
        return "(" + vect.x.toFixed(dp) + ", " + vect.y.toFixed(dp) + ", "
                                                               + vect.z.toFixed(dp) + ")";
    else
        return "(" + vect.x + ", " + vect.y + ", " + vect.z + ")";
} 

// ******************************************* 

function rotToStr(rot, dp)
{
    //returns the given rotation as a string in the quaternion form "(x, y, z, w)"
    //Also accepts an optional parameter representing the number of
    //decimal places to display the results to (int).
    //To create a string using the Euler values, please use rotToStrEuler() 

    if (isNaN(dp))
        return "(" + rot.x + ", " + rot.y + ", " + rot.z + ", " + rot.w + ")";
    else
        return "(" + rot.x.toFixed(dp) + ", " + rot.y.toFixed(dp) + ", "
                          + rot.z.toFixed(dp)  + ", " + rot.w.toFixed(dp)+ ")";
}     

// ******************************************* 

function rotToStrEuler(rot, dp)
{
    //returns the given rotation as a string in the Euler form "(x, y, z)"
    //Also accepts an optional parameter representing the number of
    //decimal places to display the results to (int).
    //To create a string using the quaternion values, please use rotToStr() 

    if (dp != null)
        return "(" + rot.eulerX.toFixed(dp) + ", " + rot.eulerY.toFixed(dp)
                                                   + ", " + rot.eulerZ.toFixed(dp) + ")";
    else
        return "(" + rot.eulerX + ", " + rot.eulerY + ", " + rot.eulerZ + ")";
}     

// *******************************************

function clamp(value, min, max)
{
    //returns a number representing the given value clamped
    //between the specified high and low bounds. 

    return Math.min(Math.max(value, min), max);
} 

// *******************************************


Special thanks to David for sharing these useful tidbits.

Leave a Comment

3ds Max to DXStudio Perfect scale export

There has been a lot of discussion and experimentation surrounding the conversion factor from 3DS Max to DXStudio.
Here is a visual tutorial that solves the problem.

3DS Max 1:1 Export

3DS Max 1:1 Export


In our case we using the .DXMesh exporter with a ratio of 1 Max unit to 10 centimeters.
Exporting under these conditions provides a 1:1 import into DXStudio.

Leave a Comment

3D Computer Game of Life

The standard by which most computer languages are measured by the simplest of functions, “Hello World”.

In the 1960’s a mathematician name John Horton Conway devised a computer simulation to mimic the essence of Life.  Three simple rules control the health or demise of each ‘cell’.

As the power and capabilities of modern computers grew, this became another staple of software comparison.

DXStudio provides incredible tools to create any 3D world.  This version of Life takes the simple rules and extends them  into the 3rd dimension.

Life takes place on a grid.  Each cell is evaluated to live or die by these three simple rules:

  • If a cell has one or no living neighbours, it will die of loneliness
  • If it has too many neighbours – four or more – it will die from overcrowding
  • New cells are “born” whenever an empty square has exactly three living neighbors

Play 3D Life now


Designer Notes

Leave a Comment

Aman ‘Rah – Mystery of Egypt

The people of Ancient Egypt have a reputation for devising very complex puzzles to keep would-be robbers out of their elaborate tombs.  Afterall, the Pharoh must be kept safe until his meeting with the gods!

I created Aman ‘Rah  in that vein.  You are faced with a complex array of heiroglyphs.  The key to unlocking the secret (a high score) lies in how cleverly you combine matching glyphs.

Aman Rah - Tile Matching Game

Aman ‘Rah is a game of matching. You must match two tiles that share either a Glyph or Color (or both) by clicking on one and then the other with the mouse. The amount of score you receive is related to what type of match you make:

  • Match Color and Glyph – Maximum
  • Match only Glyph or only Color

The four tiles across the bottom are called the tray.  Using a tile from the tray for a match incurs a penalty to your score.

The other tiles are the board. Notice they are arranged in a pyramid. You cannot access a tile unless it is completely uncovered. It requires skill and careful planning to successfully match all the tiles on the board. There is a bonus awarded for clearing the board.

Can you achieve a high score and protect the King?

Play Aman ‘Rah now.


Designer Notes

I have been developing software for more than 30 years. DXStudio provides wonderful GUI tools for creating 3D (and 2D) environments. But, as a software developer, I created Aman ‘Rah entirely from code.

Leave a Comment

The best 3D Game Engine

Yes.  I am prejudiced.  And perhaps you don’t really care about my opinion.  That’s fine.  Stop reading.

Good.  You are (at least a little) interested.  Or maybe just curious.

I spent many months doing what I believe was diligent research, in search of the best 3D game development system.  There are many choices.  And the list grows everyday.  When considering all features, and the price, there is no match for DXStudio.

Some other systems, with comparable features, lack decent support.  The DXStudio community is outstanding.

The feature list grows almost every week.  The support group is unrivalled.

(to be continued)

Leave a Comment