Tuesday, October 20, 2015

End Of (Summer) Days

Progress has been delayed, but I'm still working on getting all of the pieces back together. The widget system rework was already taking longer than I expected and in the process, I decided to bear down on the part that I consider most important.

Mana's object system must be easy to use and as fast as possible.

Since Lua is the scripting language that drives Mana functionality, I was concerned about certain performance bottlenecks. I'd been using Lua's C-API for connecting Mana and Lua. In an attempt to keep as much as possible on the C (BlitzMax) side, I wrote all of Lua's metatable access functions* in BlitzMax and put all of the exposed functions in a hash table. Then it occurred to me that doing it that way would result in very (extremely) inefficient look ups. Sure enough, a few tests confirmed my worries.

This revelation led me to do some digging on the LuaJIT forums and eventually decide to rewrite a significant portion of the Lua interface code. LuaJIT has an FFI, or Foreign Function Interface, that allows Lua to directly call C functions and best of all, they are inlined - in other words, fast!

The decision has added almost two months to my plan, but the resulting speed gain on non-engine related logic should be a factor of three to thirty or more!

* Lua doesn't have objects, per se. Without getting too technical (...), it uses tables to store object data. The tables have special attached functions (methods) that control data access. These methods can be redefined in ways that change, to some extent, the way the language works. This feature makes Lua particularly suitable for customization and great for scripting.

Monday, June 8, 2015

One (baby) Step At A Time

The Mana engine rebuild took about six weeks and went well...so well that I decided to rebuild everything! .........yay.

Although Mana was getting powerful, it had also become somewhat cumbersome to use. Despite my best efforts, there were too many dependencies and that made results hard to predict in some cases. In my mind, the best games (usually) have simple rules that combine for great variety in gameplay. Thinking along those lines, my approach to Mana architecture was to create the simplest rule set possible. At least, that was the theory.

However, every idea spawns more ideas and more complexity. As Mana evolved, it finally dawned on me around the end of 2013 that Mana's defining feature was an application building block system that I had implemented on top of a bunch of other things...remnants of ideas that I was loathe to abandon.

So, it's time to move on.

I am currently breaking Mana into smaller, more manageable, and more flexible, pieces. By the end of the summer, I expect all of its functionality will be back.

Saturday, November 22, 2014

The Fun Continues

Currently, I am knee-deep in a complete Mana engine rebuild. In a few days, when my girl and I head east for Thanksgiving dinner with her family, I expect it will be waist-deep.

This step really is long overdue.

Mana render objects are conceptually related to OpenGL. There is a ManaFrameBuffer, for example, that is little more than a wrapper for a set of GL functions. If I wanted to use a different graphics library, like DirectX, I'd eventually have to separate them.

So I'm doing that now.

It is satisfying to rebuild the graphics engine from the ground up; using everything I've learned over the last five years. I've had plenty of time to try out various approaches and I already have a functional library that does everything I need. Now I get to optimize and separate it from the base Mana application.

Some of the benefits:
  • Breaking Mana into smaller pieces means faster compilation times.
  • As a separate module, the rendering engine can be connected to other languages and used separately.
  • It will be easier to test on various platforms. I'd like to get Mana working on all of the major ones and this change brings it a step closer.
  • Someone with more graphics knowledge can take over for me and expand its capabilities, without us stepping on each others' toes.
  • Since Mana will no longer rely on the rendering engine directly, it could be hooked up to a different one, such as Unreal or Unity.

Friday, May 23, 2014

Quick to learn, a lifetime bit longer to master...

Time for an update to my much neglected blog. I've been very busy improving Mana. I've spent some time going to Meetup events in an effort to meet more people in the local tech community.

Oh yeah, and I moved in with my girl. :)

In my last blog updates, I spoke of my intention to create a mini version of Mana that exports to WebGL. That is still part of the plan, but I'm very much interested in finishing what I started. I have therefore been putting more effort into the Mana interface. Ultimately, I want to use it to create other products, including the WebGL exporter. It is important to get Mana to a state where I can do so efficiently.

One of the ideas I'm toying with is to make a tutorial/game that explains the basics of how Mana works. That's part of why I'm spending time meeting local people. I'm probably going to need some help, either in design or art or who knows what else.

Funding is also on my mind, of course. As an alternative to KickStarter, I am considering the possibility of local business incubators. Either approach requires time spent preparing my pitch and putting together a business plan. I don't even have business cards. There is simply not enough time in the day, but at least I'm having fun again!

Have I mentioned that Mana seriously rocks?

Sunday, February 9, 2014

WebGL Animation Test

Here is the result of an animation test in WebGL with data exported from Mana Web.


The scene was rendered in Firefox and the frames exported to a Node.js server. The render also shows off variance shadow maps running in Three.js.

Friday, January 31, 2014

Cloudy Thoughts

In a recent post, I wrote about cloud services in a slightly negative light. To be clear, I have nothing against them. Storing projects online is convenient. It makes collaboration simpler. There's no need to install or update licenses! I just received a long-overdue workstation upgrade. When I think about how much time I'll be spending this month just getting it ready for use, part of me dreams of a future when all of my apps are available online.

Indeed, I may offer some kind of cloud service for Mana in the future, or rather partner up with someone that wants to organize that end of things. As a customer, however, I prefer to have an offline option. I don't want to have an internet connection required and unless the cloud is offering some advantage beyond storage, I'd rather not pay monthly for it, either.

I mentioned clara.io in a recent post as having something new to offer. It is basically a 3d modeling tool that functions entirely inside a web browser. My first trial with it was pretty unsuccessful, but there's a recent update that looks like a complete overhaul. I'll definitely have to find some time to give it another whirl.

Saturday, January 18, 2014

To Three Or Not To Three?

That is the question!

I've been spending time evaluating Three.js as a potential export target for Mana Web. As a framework, Three is nicely organized and a great starting point for experimentation. Its renderer, however, is lacking some key features that I'd like to include in an online model viewer.

For one thing, there are no variance shadow maps. It wasn't as easy as I'd hoped, but I've managed to add them to my local copy. The screen shots below show the results of that effort. The code is messy right now, but once I'm finished I will see if I can get it added to Three officially. I've never used GitHub before, but I think it is time I learned!
webgl_viewer01 webgl_viewer02 webgl_viewer03 webgl_viewer04
Another thing I'd like to see is animation blending. At present, there is no way to upload multiple animations for the same character and intermix them. An animator can blend morph targets with skeletal animation, but cannot transition from an idle pose to walking to running.

As much as I like Three, it is tempting to start a Mana.js project. The features I need already exist, I'm very familiar with my own code, and I've done a partial port before. It would be more of a known quantity.

But Three.js already has quite a following and it is actively updated. Perhaps the best course is to do both. I can port Mana to JavaScript and provide a plugin that uses the Three.js renderer, but activates additional features.