More Curvy Things

Have done a little more work with my 2D path routines, so if nothing else I can at least collide perfect circles with them remarkably accurately. I’ve been a bit sidetracked recently by other things, like JujuScript itself, which is helping me test these routines.

Joy of Physics

One of the most lamentably absent things in computer/video games of the last 30 years is realistic physics. Technical innovation has largely been directed toward improvements in graphics quality and rendering speed, but surprisingly little has been done in the area of mechanical simulation. Fortunately this is now changing, as more and more games implement rigid body dynamics [currently mostly flight sims and driving games, and soon first person shooters like Half-Life 2 and Doom 3]

Elastomania is a brilliant game which demonstrates that physics can be more important than graphics (although it would be good if the graphics were better too) Well maintained fan-site here.

George was to be a Newtonian extravaganza, and may still be one day, but a lot of the cool physics is only half implemented, and collision detection between arbitrary 3D objects is and probably always will be an unbelievable pain. Resting contact works great, except when objects inexplicably acquire infinite kinetic energy and fly off into to the nether regions of floating point precision.

Whilst collision detection is vastly different between 2D and 3D, it turns out that 3D rigid body dynamics are only slightly more complex than 2D. This means that a robust physical simulation system in 2D has the potential to be extended into 3D without too much fuss. So now I am thinking, hey, why not get a rock solid 2D system working first [it's also easier to debug] and then I can retrofit that into any 3D system I want to build. And then I’m thinking, hey, is this the most appropriate use of my time? And then I’m going, like, screw you buddy, I’ll do what I want…

Ctors

The big news on the JujuScript front is that it now supports constructors, making it a lot more object-oriented. Destructors will also be supported at some point, but since there is no memory allocation in JujuScript there’s less of a need [resources are tracked using reference counting and deleted when no longer required]. It’s very neat, because I also allow intrinsic types to have their constructors overridden! For example, if you want to specify that all double precision floats are initialized to -1, the following snippet is all you need:

function double::construct()
{
   this = -1;
}

I intend to avoid the hideous C++ practice of naming constructors and destructors after the types themselves… yuk! I am unaware of a good reason for doing it that way.

I will probably change the syntax a little before finalizing it… I really have to nail down some of these things… also I am still not sure how much late-binding to support [currently it is all incredibly late binding... so late that you can even add/override methods on the fly using the Eval() function, but this makes it extremely hard to optimize]