• News
  • OldBlog

Understanding Parents

All objects in Mana belong to a system reminiscent of a family tree, or if you prefer, a system of folders (directories) and files. The root object is always a module and can be used in combination with other modules in a variety of applications. Also, modules can be distributed on their own so that they may be shared and used in numerous projects.

Objects that are in directories or that are directly linked to other objects can be found using a path name.


The above statement refers to the Window prototype object in the Prototypes/Widget directory. The two slashes at the beginning indicate that it is found in the main tree. The colon represents the end of the directory path and the start of the object path, but the parser is forgiving and will accept a slash. The following is also valid.


Widgets are often made up of sub-widgets. Objects that are children of other objects can also be accessed using path names.

 MANA.Find( “//Prototypes/Widget:ScrollPanel/ScrollArea” )

The code above returns the scroll area of the prototype scroll panel. Mana uses a prototype/clone system for creating and extending objects. Prototypes are objects with which the end user does not directly interact, but are strictly used to define other objects. When a prototype is cloned, its properties (fields and methods) and all of its children are cloned and become part of the new object.

Here is that window definition from my last post, with some additions.

 MANA.Clone( “//Prototypes/Widget/Window”, “MyWindow”, -1, “//MyGui” )
 MANA.THIS:SetPosition( 50, 50 )
 MANA.THIS:SetSize( 300, 200 )
 MANA.Clone( “//Prototypes/Widget/Button”, “OkButton”, -1, “..MyWindow/WindowPanel” )
 MANA.THIS:SetAlignment( -1, 2, -2, -1, 1, -2 )
 MANA.THIS:SetSize( 80, 30 )

The second line (after Start) creates a clone of the window prototype, names it “MyWindow”, and attaches it to the end of the list of child objects for another object in the tree called “MyGui.” Any object created using Init, Clone, or ReadXml between the Start and Finish statements is available on an initialization stack. It can be accessed immediately using the THIS field of the MANA table or using Find with two dots in front of its name.

 MANA.THIS:SetPosition( 50, 50 )

The code above sets the position of the last created object (MyWindow) to 50, 50.

 MANA.Clone( “//Prototypes/Widget/Button”, “OkButton”, -1, “..MyWindow/WindowPanel” )

This line creates a clone of the button prototype, names it “OkButton”, and attaches it to “MyWindow.” The two dots refer to an object previously created on the stack.

NOTE: The WindowPanel sub-object is referenced because windows are made of other components and attaching directly to the window would overdraw them. Your button may draw on top of the frame or title bar and that simply won’t do!

Here is an alternative.

 MANA.Clone( “//Prototypes/Widget/Button”,
 “OkButton”, -1, “>>MyWindow” )

In this variant, the two dots are replaced with two right angle brackets and WindowPanel is omitted. Some objects have an attachment facility, or a set of instructions that regulate how other objects get attached. In this case, the window is being instructed to process the button and attach it to the correct location automatically.

I Love Lua

Warning: Those technical posts I promised two years ago are finally happening!

Has it been five months already!? :)

It is time to announce that my project has an official name – Mana. The word originated in the Pacific islands and refers to an “impersonal force” that resides in all things. Gamers, especially RPG gamers, should recognize it instantly. It is often used in games to quantify magic or life force in the form of points.

It is also time to express my love for the Lua scripting language. My first stab at getting Mana and Lua working together was actually quite some time ago. It went so well that I ended up abandoning my own scripting language and embracing Lua for its popularity, speed, and ease of use. The integration is about ninety percent – almost anything can be done externally in script!

Using Lua, there are essentially three ways to create objects. There is a low-level interface, common to all objects and designed to provide consistency for all classes. On top of that, there is the MANA stack, which uses the same low-level methodology, but keeps track of a few things to make the process simpler. Then, there are the more convenient “mk” functions that are single line object initialization functions.

Most of the time, the “mk” functions will probably be the most commonly used.

tex = mkTexture( “MyTexture”, 256, 256 )−−Returns 256 x 256 blank tex.
v3 = mkVec3( 0, 1, 0 )−−Returns an ‘up’ vector.
win = mkWindow( “MyWindow”, 50, 50, 300, 200 )−−Returns a window widget.

They initialize objects based on whatever the currently active template calls for. But more on those later. For now, I’ll write a bit about the MANA stack. This is a low-level interface that provides a typical “start new object, modify object attributes, then finish object” methodology.

There are three standard functions for creating an object – ANY object. This applies to widgets, models, textures, materials, and their components – EVERY object that is in Mana. Those three functions are Init, Clone, and ReadXml (ReadBin may be added later).

    Init – creates a new superclass object from scratch.
    Clone – creates one from an existing object.
    ReadXml – reads the data for an object from an xml file and the return value may be a new object or a clone, depending on the file.

Each of the creation functions takes four parameters of a similar nature.

    Init( superclass, class, index, parent )

Superclass and class are strings describing the new object. Superclass refers to all of the base type objects available in Mana (Widget, for example). Class is used to define a new class or, for objects that can’t be reclassified, a name.

    Clone( path, name, index, parent )

Path is the string path to the object to be cloned, and name is the new object name.

    ReadXml( filename, path, index, parent )

Filename is, of course, the file to be read, and path is the path to the node that contains the data.

All three functions use index and parent. Parent is the string path to the object that the new object will be associated. Index is used when a new object is being created to replace another. However, the default is -1, meaning “append new object to the end.”

The following code does the same thing as the mkTexture and mkWindow statements above, only much more verbose!

 MANA.Init( “Texture”, “MyTexture”, -1, “++Textures” )
 MANA.THIS:SetSize( 256, 256 )
 MANA.Clone( “//Prototypes/Widget/Window”, “MyWindow”, -1, “//MyGui” )
 MANA.THIS:SetPosition( 50, 50 )
 MANA.THIS:SetSize( 300, 200 )

But why would anyone want to write all that code to do something so basic?

Why, indeed!! It is really just a common way of creating all objects of all types. Start creating an object with its default values, then change the parameters, then finish with an object that is available to be cloned and used for all sorts of things. If I had omitted the SetSize line from the texture code, for example, it would still return a 256 x 256 because those happen to be the default values.

But wait! What does that parent value mean, exactly?

All objects in Mana are linked together in a hierarchical structure in a way that resembles files and folders on your hard drive. In my next post, I’ll cover that in more detail.

New Demos!

It’s been a while, but I have two new demos with a lot of previously unseen features.  They’re not quite as polished as I’d like because I had some issues recording using Fraps and I’m using a microphone I found in a cereal box.  But they will suffice until I can put together my actual pitch demo.

NOTE: Videos are no longer available.

Here is a quick summary of the features shown:

  • Real-Time Lighting
  • Real-Time Shadows
  • Custom Gizmos
  • Particle Effects
  • Character Animation
  • Animation Blending
  • Tile-Based Widgets
  • Drag-n-Drop Object Building
  • Document Object
  • Text Wrapping
  • Text Change Tags
  • Vector-Based Widgets
  • Video Clips

It’s A Marathon

The three year mark on this project is fast approaching. My patience is wearing a bit, since my original plan was to find financing after a year and a half. Nonetheless, I am happy with the results so far, even though I haven’t shown much publicly.

The good news is that I am finally working on something that I believe will be useful to a lot of people. It is a virtual object design and visualization tool. That description could probably use a marketing overhaul, but I promise it is cooler than it sounds!

Essentially, it is an application for collecting, storing, and modifying data that have visual representations, either two or three dimensional. I sometimes hesitantly call upon my inspiration, the Star Trek holodeck, when explaining it to friends and family because it gives an immediate impression. It is also slightly misleading. I do hesitate to liken my work for the past couple of years to advanced twenty-fourth century technology!

Of course, I’m not inventing holographic projectors or force-field generators (but if anyone out there is, by all means contact me!). I refer only to the software part. My project has plenty in common with many other existing 3d engines and tools and I’m not sure that any part of it is patentable. That’s okay – I detest software patents.

Over the next few months, I intend to shift focus and take on the additional role of cheerleader. Despite what I’ve just said, my project does have unique features that could make it a pretty hot commodity. I am excited to start showing what this baby can do!

Cleaning Out The Cobwebs

Time for a quick update! Work continues on the engine, as always. I spent a few months creating a couple of environments to show off. One of them ended up in the demo videos that I posted in October. The other is a rather large scene that I have put on hold, for now. I decided that I need to refocus on improving the pipeline. However, the process of building gave me the chance to iron out a lot of things that will make the engine more useful. I added a more sophisticated level-of-detail system and a method for generating light maps. It is not quite finished, but it opens up exciting possibilities in terms of creating large-scale worlds.

Since then, I have been crossing off a lot of small items that have been on my list for a long time. I am now using XML almost exclusively for storing all world data. Models, animations, materials, documents, and interface widgets are all using an XML format that is easy to parse and understand. There is still work to do to get them completely consistent, but I am getting close. I think that word, consistency, should be my word of the month. My goal is to clean up all of my (code) objects and make their methods consistent across the board.

First Feature Demo

This is my second engine demo and involves me walking around in the environment and showing off some of the features. More to come! The video is best viewed at 720p. Once you’ve started it, you can switch to 720p using the button in the lower right corner (under the “You” in “YouTube”).

NOTE: Video is no longer available.

Here is a quick summary of the features shown:

  • High-Detail Textures
  • Bump/Spec/Emissive Shaders
  • Post Effect Transitions
  • Dynamic Planar Reflections
  • Dynamic Spherical Reflections
  • Static Lights With Shadow Maps
  • Video Textures
  • Level Of Detail Models
  • Depth Of Field

World Debut!

Here it is – my first public unveiling of the project I’ve been working on for two years. This first video is a quick fly-around in a small, but fairly detailed, home environment that I built to show off my engine’s basic rendering features. A bit of drama is supplied by an old film trailer I downloaded from archive.org. The video is best viewed at 720p. Once you’ve started it, you can switch to 720p using the button in the lower right corner (under the “You” in “YouTube”).

NOTE: Video is no longer available.

The rendering engine is written in OpenGL and works only in a Windows environment, but it should be pretty easily recompiled for Linux and OS X. Support for shaders is almost complete, but needs an additional control layer to make setting them up simpler. There is a system in place for fall backs on hardware that doesn’t support shaders and it’s about half done. I can render to multiple windows and to textures and there is a pretty nice lighting system with real-time shadows.

I am missing two important engine components. One is interior space culling and I intend to write a portal system to fill that gap. Having written one before in Blitz Basic, I am confident that I can pull that off in less than six weeks. The other is a physics system. I do have collisions working and that is enough to pull off some basic simulations. That will do for now, but I have also found a freebie Newton physics module that, with a bit of tinkering, will provide more robust functionality. Eventually, I’d like to do a complete port of the Bullet physics library.

The Status Quotient

Now seems a good time to sum up what I currently have and what else needs to be done before I will consider approaching investors. Just a warning – the next few entries in the blog will be fairly technical and assume some knowledge of 3d game engines. They will briefly describe my progress in the following categories:

  • Rendering
  • Animation
  • User Interface
  • Script Language

With each entry, I intend to attach videos and/or images that demonstrate specific features. I cannot emphasize enough the importance of showing practical content, rather than running down the features using cubes, spheres, and tori (as fond as I am of donuts!). It is absolutely critical that I have high quality artwork to show and that will be my focus for the next couple of months.

The Whys And Wherefores

Here are a few common questions. Perhaps once I’ve posted examples and started getting feedback, I’ll roll these into an official FAQ.

“Why create an engine from scratch when there are so many out there to choose from?”

Indeed, 3d engines are very common now and some are even free to use. However, I spent some time researching and found few that are inexpensive, cross-platform, and offer a wide enough range of features. The remaining ones required use of C++ and had a fairly steep learning curve. Because I’m doing all of this on my own at the moment, it is essential that I’m able to develop at a rapid pace. I can’t afford to spend days at a time spinning my wheels.

It is also fair to say that I simply wanted to do it. It really has been fun delving into the many aspects of 3d engine design and I’ve learned so much along the way. I am comforted by the thought that I will be able to add in whatever features are needed to complete future projects and that I won’t have to rely on workarounds. Down the road, I think I’ll be glad for the time I spent on this even in the unlikely event that I switch to something else.  I’m developing a multimedia platform – the engine is secondary.

“What programming language are you using and why?”

My programming language of choice is BlitzMax because I found it to be the fastest out of the gate, but I will probably end up porting to another language. I will eventually need to pass the baton to other programmers while I manage other aspects of the project and I’ll have a lot more hiring options if I switch to a more common language. Also, porting to another language gives me the benefit of compiling to platforms such as mobile phones and pads.

“Why not just use Adobe AIR and Flash?”

For those unaware, there is a pretty powerful multimedia development environment already available called Adobe AIR. It makes use of the popular Flash platform, which has had great market penetration and is therefore almost universally available (except on Apple hardware). AIR appears to be a solid product, but not aimed squarely at the market I have in mind. Its support for 3d is still pretty rudimentary and although I think that will change, I’d prefer to start with a clean slate and see what my many years of game development experience brings to the table. In time, it is quite possible that I will add a Flash export feature to my tool set.

Martian Mission

I’ve been fascinated by the progression of computer technology over the past fifteen years. The internet’s swift impact on our culture surprised even a geek like me. Social networks and games are incredibly popular and seem to be growing endlessly. The technology is constantly being pushed to deliver more and more complex content across a variety of platforms.

For some time, I have thought that this emerging technology could be used very effectively to teach. It is a powerful means to present interactive media that engages students and, if part of a curriculum, tracks their progress and even customizes itself according to their individual needs. If the content was compelling and easy to use, it would encourage participation and make learning fun!

Of course, I realize this is not exactly a new concept. I’m old enough to remember the whole “edutainment” craze of the early nineties. Nowadays, the market is pretty small but I believe this will change if the medium is exploited to its full potential. My mission is to make the assembly of sophisticated multimedia software as easy as surfing the internet.

I am currently in the process of creating a 3d graphics engine and tool set suitable for use in the making of educational programs, games, architectural walk-throughs, and any other type of interactive software in which a virtual space is useful. In the event that the educational market cannot sustain the business, the tool set will be flexible enough to be turned to other purposes and sources of revenue.

The educational software business is saturated with products aimed at children under the age of ten. There are few available for young adults and college students and those tend to be in typical textbook-style formats. In this age of instant gratification and short attention spans, I believe that there is a need for software that targets that mentality. Having more options in terms of presentation and interactivity will help diversify the available titles and open up great potential for more innovative and effective teaching techniques.

One last thing I’d like to communicate is that my mission is not to replace teachers with computer technology. My hope is that I can bring people of various disciplines together. Teachers, designers, artists, programmers, etc. will all need to be involved in creating the next generation of software for learning.