Moving on…

March 8th, 2010

I’ve just handed in my notice at work this morning.  It’s left me feeling relieved and sad that it’s come to this point and that I’ve taken the decision to leave, but it’s for the best.  I like and respect all of the people that I work with, even if I don’t quite agree with all that happens on the business side of things.

I’ll be here for a couple of months though.  I want to finish the physics on the current game that I’m working on and make sure everything is left in a state that, when I leave, it won’t be a big deal.  Who ever replaces me can just pick up from where I left off with the minimum of hassle.

Oh god…we have to organise a move to Germany now.

A “relaxing” Christmas

December 26th, 2009

Before I get started, Merry Christmas and all that!

We’ve been staying at Silvi’s parents place since Monday, and I have to say, it’s been a pretty relaxing time.  Flora has enjoyed having lots of people to play with and has in short; been spoiled rotten.  But it’s Christmas…kids are supposed to be spoiled rotten!

I’ve hijacked the in-laws PC while we’ve been here, and spent my free time working on Muse.  I’ve gotten quite a bit done on the demo, as you can see from the screen shot below.

Toon shading in Muse

Tasks completed over the last few days are;

  • Basic static mesh export from Milshape
  • Bullet physics added to the demo
  • Simple vehicle dynamics
  • Basic follow and orbit cameras
  • Shaders written for Toon-shading
  • Basic keyboard input support
  • Test world for rendering and collision

So I’m making progress, bit by by bit.  The next steps are related to rendering and scene management, which are;

  • Batch rendering – meshes are to be sorted by material and shader profiles
  • A simple quad-tree scene type

I might not get all or any of this completed by the time we leave, but that’s ok.  I’m happy with that I’ve done so far.

December 15th, 2009

Bah.  I can’t help but feel worried about work, and if I’ll have a job come January.  I can’t go into details, only that I don’t have a clue about the viability of what my team does. And to make matters worse, the boss can’t seem to give any concrete answers to the questions fielded yesterday about how we fit into on-going developments.

Not really what I need during the run up to Christmas, but no matter.  It could be worse, and no matter what happens, I’ll deal with it and make the best of the situation.

I’d just like to be able top relax over the festive period.

’tis the season…apparently…

December 2nd, 2009

With it being December, the Christmas Markets have all suddenly appeared.  Well…not really…I walk past the market on Mariahilferstraße every day on the way to work, and witnessed it slowly being put together over a period of days.

It does feel like December has just “suddenly appeared” though.  Maybe it’s because October and November are such busy months, with Silvi’s birthday, followed by my own and finally Flora’s big day in the middle of November.  Come to think of it, the rest of the year has been the same.

Months and seasons have tended to come up from behind me unawares, only so slap me across the back of the head like an irritated school teacher shouting  ”You boy! No falling asleep in class!”.  Is this what it’s like when you hit your 30’s?  Or is it because being a husband and a father just means you’re always busy so you never notice times advance?

Regardless, we decided to visit the Christmas Market at Karlsplatz last night which to be honest, was pretty underwhelming.  It’s not that the market was bad…if anything it was rather nice.  But the lack of people, horrible weather and a very tired little girl who wasn’t too happy at being stuck in her push-chair, put an early end to the evening.

So homeward bound we were after a brief 30 minutes at the market…I felt rather bad that Flora wasn’t enjoying herself, as the whole idea was to let her see the market and for her to experience something new.

Perhaps we’ll go to another market on an evening where Flora is not so tired , so she can enjoy herself a bit more.

Living without #include

December 1st, 2009

One of the things I’ve had to deal with recently when using the Game Monkey scripting language, is how to ensure that scripts are executed in a certain order.  This is important, as some scripts may rely on one or more objects that are created by other scripts.  So these scripts must be executed first.

My scripts were just loaded in what ever order they were found while scanning a folder and its sub-folders. So there was no “nice” way I could enforce them to load in a given order, other than some stupid naming convention.  I needed a solution to this problem.

How could I guarantee that certain scripts were executed before a certain point?

Solutions…

The first thing that sprang to mind, was how the c-processor manages this with #include directive to paste in other files containing type and identifier declarations.  I needed something similar in Game Monkey, and I came up with two basic solutions to the problems.

  1. Grab an open-source c-preprocessor and add it to the the GM compiler so I could have the functionality of #include and all the other things that the c-preprocessor does.
  2. Add support to GM for something like #include as a keyword.

Both of these solutions had the same same draw back;  I would have to make a lot of modifications to the GM parser to properly determine the file and line where an error occurs.   It would be nice to be able to have conditional compilation in my scripts, so maybe the c-preprocessor support could be added later, but it was overkill for this problem.

It occurred to me that I was going about this the wrong way.  I was thinking like I was trying to solve a C/C++ programming problem, and not a script problem.  I started to think how I had exposed a native function to create an object in Muse.

For example, the script code below creates a material via the native function, “muCreateObject”.

Using a native function in script to create an object

Using a native function in script to create an object

Given that muCreateObject can be called from within a script function or outside of a function when the script is imported in a library to the VM, maybe I could do the same thing for “including” a script file.

After all, I just want to make sure that the script is executed before a certain point.  A function to do this was exactly what I needed.  So this is where we come to the implementing of the “import” function.

Implementing the import function

The import function is not all that special.  The bulk of the work, which was not very much at all, was in my own code for managing the loading and execution of scripts.  As an example of what import does, consider the following script code below;

Using the 'import' function

Using the 'import' function

The table used in the call to muCreateObject references objects that were created in the NS_materials.gm, NS_skins.gm and NS_parts.gm script files.  These script files were executed before the call to muCreateObject using the import function, which takes a path to a relative to the script file being currently executed for the script to “import”.

The import method performs the following steps

  1. The imported script path, is constructed relative to the path of the currently executing script
  2. Information about the script being imported is pushed onto a stack
  3. The imported script is loaded, and compiled
  4. Any errors in the imported script are output and the application exits.
  5. The imported script code is executed.  Any calls to “import” in the script code cause the script manager to recurse back to step 1
  6. After the imported script has finished executing, the script information is popped from the stack and control is handed back to the Game Monkey VM.

All these steps were nothing more than an addition to the existing code that loads, compiles and executes script code on demand.  A few additional checks were added that I hadn’t mentioned such as ensuring a script file is only executed once, and checking for something that might lead to an infinite loop due to a file trying to import itself.

Conclusion

In conclusion, the import function works very well.

It has the added benefit of being able to get rid of the file scanning code, in favour of loading a single main script file that imports other script files to be executed.  This also means that there is now a known point where the engine enters the script code,  making it easier in the future to add more flexible behavior via scripted functions.

A long, dark Monday

November 30th, 2009

Ugh….Monday’s.  Today is Monday.  And because today is Monday, I have absolutely no motivation.  But I need to get stuff done.  Dig deep, James, you can get through today!

Get those physics prop objects working, you slacker!

Making progress with Muse – Data Driven Objects And Scripting

November 24th, 2009

The story so far…

Despite the lack of posts, I have believe it or not, been rather busy.  Along with Flora’s first birthday, getting some things ready for Christmas in my spare time, I’ve also been doing a lot work on Muse.  I last wrote that I was hoping to get the Muse mesh format working in the run-time, and I did.  But this was all working  a few weeks ago, and I’ve been a bust beaver since then.

Basic mesh rendering in Muse

Basic mesh rendering in Muse

Since adding the Muse mesh format support, I’ve been pretty busy adding the following features (See above image for the end result)

  • Custom RTTI and Property systems
  • Creation of the Muse game engine library
  • Resource loading/management system ported from the demo into the Muse game engine library
  • Integration of Game Monkey to handle scripting
  • Data driven object creation using Game Monkey together with the RTTI and Property Systems
  • The start of a flexible scene component for spacial sorting
  • A game object manager that is part of the engine library

Delving into data driven objects…

The bit that’s taken a fair bit of code, is the data driven object creation.  It’s not been especially difficult to implement, partly because I’m using GameMonkey. But there were so many little sub-systems that I had to write and ensure they had all the prerequisite features in place to make it all work.

The above screenshot is of a car model  loaded entirely by script code, using materials that were created in script code.  An sample of the script code is shown below;

Some of the script code used to load the car in the previous image

Some of the script code used to load the car in the previous image

I think it’s fair to say that I’m making good progress with my demo.  At the moment, I’m currently working on a custom object for the car simulation and its associated data objects.

Making a class data driven: a bit more detail

To create new object types that are exposed to the scripting system, is pretty straight forward.  In fact…there’s not really any additional work needed beyond making sure that a class exposes the required properties.

Here’s an example of a class declaration that is exposed to the scripting system;

Exposing a class to the RTTI/Scripting system

Exposing a class to the RTTI/Scripting system

It really couldn’t be easier!  Any class that wants to expose itself as a scriptable object is derived from muRttiObject or a class derived from it, using the muRttiClass template.  This automatically ensure that the class type is registered with the RTTI system which in turn, registers it with the scripting system.

To expose properties to the scripting system, the static method ‘registerProps’ is overridden for that class, which in turn calls the addProp static method.  The only important thing to remember is that the base class implementation of ‘registerProps’ must be called as well, so that any properties in the Super class register themselves for this class description.

A small optimisation…

You might be asking yourself, since an RTTI class knows its Super class (as you can see from the muRttiClass template), why should we need to explicitly expose the Super class properties?  The truth is, we don’t need to.  This is a speed optimisation for when we have to find a property by name, at the cost of a little more memory.

By making a class type holds all of its properties, we only have to perform one binary search rather than three or four separate searches with all of the associated overhead of setup and subroutine calls.

This is actually a small optimisation, but a very important one.  Most of the scripting system makes use of class properties in some way, referencing them by name.  So we may actually be searching for properties a lot of the time and need to make sure that this searching is a fast as we can make it.

Muse

November 2nd, 2009

I’ve added a new tag and a new page to the blog about “Muse” which is my tech. demo framework.  As much as I do really enjoy doing simulation code for games, it’s also ALL that I do.  I also want to lots of other things to expand and improve my knowledge and skills, but there is no real chance to do this during working hours.

So I have been working on a framework that I have called “Muse” in my spare time, family allowing.  This is a few libraries that work together, along with associated tools to let me easily try out new things.

The basic rendering framework that supports geometry, textures and shaders has been running quite well for some time now.  I’ve been starting to concentrate a little on how I can get data into Muse from various sources, which has in turn, led me to focus on the Muse tools framework.

This is actually a couple of libraries used for building tool applications, with some very handy classes for dealing with meshes and other things.

I’m almost at the stage where I have the internal Muse mesh format ready to render.  I have a tool which builds meshes from an external source, the demo can load that data and the Muse Mesh class can construct itself from that data.

Assuming that I get some time to work on it this week, I should have the new mesh format rendering and can then m0ve on.  I just thought that I would give Muse a mention, as it’s going to be a large focus of my free time (hah! free time? did I just say that I have free time!?) in the coming months.

Haste ye back

October 16th, 2009

I have unfortunately, neglected this site for almost a year now. It’s been a pretty busy year though, so it’s no real surprise. It’s not as if anybody paid any attention to it though, so no big deal. Being a conscientious Husband and Dad means that there isn’t really a lot of time for anything else, especially sitting in front of the computer.

I’m going to try and change that though, at least, I’m going to update a wee bit more often and add some additional pages. This will sort of be like my own on-line CV where I can post stuff about my personal projects, family life etc.

Well, that’s the idea at any rate. First I need to upgrade WP, which I guess I’ll do tomorrow night while Silvi has a girls night out and after I put Flora to bed.

Happy Shiny Software Developers

December 2nd, 2008

There are companies who make their money by selling their own software on-line who, have really, really impressed me in the last couple of months. The reason that they have impressed me, is because their customer service is just top-rate. Both have been friendly in all of their dealings with me, very quick to respond to my queries and generaly just giving a real “Mom and Pop” feel to what they do.

Well done Xilisoft and CoffeeCup ! You guys just rock!