Sunday, January 2, 2011

Namespace for The Render Engine

I'm in the process of giving The Render Engine a namespace, and reorganizing the way that objects are included so that the Linker isn't a thorn in developers' sides.  The new namespace (for the time being) will be "R".  I know, not very inventive but it's short (and being a developer, I hate typing).  Additionally, files are getting renamed left and right.  For example, now the components are like the following:

Transform2DComponent => R.components.Transform2D

Also, when you want to use the component, it's gone from:

Engine.include("/components/component.transform2d.js")

to:

R.engine.Engine.requires("R.components.Transform2D");

And the filename is now:

"/engine/components/transform2d.js"

Originally, I had figured that a namespace wasn't necessary since a game should really be the only thing running in the browser (along with the engine).  If people wanted to have 5 to 10 libraries loaded, and the game, and the engine, and things conflicted... well, that wasn't my fault.  But, as one user pointed out, even if I accounted for naming conflicts with browser objects, there may be naming collisions with a game's objects and the engine's objects.  So, here I am doing a huge refactoring.  It's going to be as big of a change to me as it will to you. Eventually, this will help me to fix up some of the drawbacks of having the Linker do excessive checks.  This will all affect v2.0 of the engine, which I feel will be a major improvement over v1.x.

Now that I'm looking at it, I think I'll also move R.engine.Engine => R.Engine.  No reason to put it into the "engine" package...  That will simplify some things as well.

1 comment:

  1. Hi Brett, just wanted to say you are making some awesome progress on this engine, keep up the good work!

    ReplyDelete