The Multi-Threaded Game Engine (MT Game)

July 16, 2009

I’ve been meaning to write this entry for quite a while now.  Ever since we released the first runnable version of 0.5, this MT Game thing has been hanging around and I’ve kept putting off writing about what it actually is, and how it fits into the Wonderland system.  Well wait no longer, let’s explore MT Game.


I joined the Wonderland team in the spring of 2008 with the task of replacing Java 3D as the rendering sub-system for the 3D client for Wonderland.  My background consists of working on just about every 3D technology at Sun over the past 20 years – including being implementation architect of Java 3D, so it was a good fit.  The decision, which I had consulted on, had already been made to use the Java Monkey Engine (jME) technology to replace Java 3D.  

I started asking around about what design work had been done up to that point on the new 3D client.  The answer was none – I had a blank slate.  Boy, were they in trouble.  :^)

I began by meeting with the company that we had worked with for a long time, and were already slated to build a state of the art avatar system for 0.5 – Immediate Mode Interactive.  We had some high level discussions about where game engines and 3D technologies were heading.  This led to some design goals for the underlying rendering and processing system.  They included:

  • Take advantage of the multi-core revolution that was happening on all client machines.
  • Support state of the art rendering techniques like dynamic shadows, portals, shaders, etc…
  • Support Collada as the model import format.
  • Make the system extensible and dynamic.
  • Support a high level object model for 3D objects.

Evaluating jME

With these design goals in mind, I started serious evaluation of the jME technology.  I quickly found there were a number of features that jME did not support.   First, was a lack of any processing model at all.  And, as the past year has evolved, we have now realized that jME not only does not have a processing model, it breaks very badly if any type of threading model is imposed on jME.  More on that later.  It also had no object model.  There was no way to assign higher level characteristics to 3D objects in the world.

After this initial evaluation of jME, it was clear that jME would not be the center of the 3D client, but instead be used as a collection of rendering and picking/collision utilities that would encapsulate data and be enveloped by a different technology.  That technology become MT Game.

MT Game Features

Every few weeks, I want to start publishing technical blogs about all the features of MT Game.  I will likely be doing that over here at my personal blog.   For this entry, I want to list its major features.  They are:

  • Component Based Architecture
  • Uniform Render Buffer System
  • Collada Model Import
  • Virtual Processing System
  • Input Processing
  • Collision System
  • Physics System
  • Shader Configuration/Loading/Level of Detail System
  • Geometry and Processor Level of Detail System
  • Pluggable RenderTechniques

Most of these systems were briefly explored in the technical session that I presented at JavaOne.  We just found out that this talk was one of the highest rated talks, and we won a JavaOne Rock Star award – pretty cool.  If you are interested, check out the slides from that talk.  

One of the other design goals that we had for MT Game was that it could be used independently from Wonderland.  We wanted it to be a standalone rendering and processing system.  The Wonderland 3D client sits on top of MT Game.  It adds a number of other features to the system – most notably networking.  Most of the time, Wonderland does a great job of hiding MT Game from the Wonderland developer, but once in a while it peeks through.

What about jME?

One question that many developers are likely asking is "How to I get my Java3D/jME content into this system?"  While every scenario is slightly different, I can give some general guidelines as to what content will move over cleanly, and what will likely be more work.

First is the 3D representation issue.  Content that is represented in a Java 3D scene graph or a jME scene graph moves over with very little effort.  Java 3D behaviors need to be rewritten to become MT Game processor components.  jME does have a form of user code callback’s in their Controllers, and as it turns out, will work with MT Game, but they don’t have nice threading properties.  Processor components are much more thread friendly.

Threading is by far the most troublesome aspect of moving jME content into MT Game.  jME assumes that all of it’s api calls will be made from a single thread – the thread that has the opengl context.  To support this, all jME calls must be made from a couple of key places in the MT Game system.  But that is a subject for another blog.

Finally, we don’t use any of the jME game frameworks.  We have our own set of threads – including the renderer thread.  All of the data is passed into the system via components.

Plans and Resources

To wrap up a very long post, I’ll simply say that we are almost done with MT Game features for 0.5, and that the big thing for 0.6 is to figure out how to fix the jME multi-threaded limitations.  If you would like to look more directly at MT Game, check out  There is even a programming guide over there – although I need to update it.

Thanks for reading,


Asia Adventure: Singapore and Beijing

July 9, 2009

Two weeks ago I returned from more than a week in Singapore, and Jonathan has just returned home from three weeks in Asia. He was with me in Singapore and then continued on to Beijing for work and vacation. There is a lot of Wonderland activity going on in those parts of the world!


Singapore is a clean, attractive, modern city with a beautiful riverfront.

Singapore cityscape Singapore River Festival

The main goal of the Singapore trip was to train a team of engineers working on a Co-Space project called “Frameworks for Virtual Worlds.” Co-Space is program funded by the Singapore Media Development Authority (MDA). The Co-Space Press Release explains the details. This particular Co-Space project involves building a sensor and telemetry framework for Wonderland so that educators, in particular, can easily integrate sensor data into the virtual environment. This data may come from Sun SPOTs, other physical sensors, or from web services that provide streams of data. As the project advances, the team will also consider how devices outside the world can be controlled from inside.

Jon did the bulk of the training, walking the team through cell creation, cell components, and other architectural details.

Jon conducting Co-Space Training Co-Space Team

As the team gets underway, we look forward to their active participation on the forum and also some up-coming guest blog posts.

FusionopolisFor one of the days of training, we met at the MDA offices in the futuristic Fusionopolis building. This was quite a high-tech facility with interesting architecture. They had a well-appointed demo room in which we saw a demo of a project called Virtual Singapore. MDA is funding a project to model the entire city of Singapore. They have a portion of the work done, and it looks very impressive. They even have the interior of several buildings modeled. Their hope is to use this data in a range of different projects. One we heard about involves integrating it into a system for emergency first responders.

In addition to the Co-Space training and several days of informal interaction with the team, we did two formal talks. One, hosted at a technical college called ITE East, was a half-day Wonderland Development Workshop for students. We had about 50 students attend the workshop which was held in a fancy auditorium with a teleprompter embedded in the floor.

Jon and Nicole preping for student workshop Nicole lecturing

The second, hosted by MDA, was a higher-level talk for 30 teachers and school administrators on the topic of integrating virtual world technology into the curriculum. The highlight of the presentation was when we asked two high school students from the Victoria School’s IT Club to come up and talk about their Wonderland IT Clubhouse project. The students expected to use just a single slide to describe their project, but behind the scenes Jon and a local staff person were able to import the students’ clubhouse model into Wonderland 0.5 on MDA’s Wonderland server. The students had never seen it in 0.5 before and were astounded to see a live demo of their work projected behind them.

Victoria School IT Clubhouse in Wonderland Victoria School IT Clubhouse in Wonderland

It’s a great space and we’re looking forward to seeing them add some interactivity to it. Their general concept is to allow IT Club members to work together from home in the evenings and use the space to showcase the results of their various programming projects.

While in the country, we also visited the National University of Singapore, Ngee Ann Polytechnic, and the Singapore Science Center (science museum). At each place, we heard about experiments with Wonderland and ideas for future Wonderland projects.

Unrelated to Wonderland, we also had the pleasure of serving as guest judges in the finals of the Singapore Open Jive programming competition.

Jon and Nicole judging Nicole handing out an award

The winning entry, Smart Shop from a team of students from Temasek Polytechnic, was quite impressive. They had used some open source augmented reality software to enhance an on-line shopping experience. The example they demo’d was a person shopping for a hat. The person would first print out a tag that had a code (like a UPC) printed on it. Then they would sit in front of their computer’s video camera and hold the tag up to their head. The screen then showed their image wearing the selected hat. They could see what the hat looked like on them in different colors, styles, and sizes.

After 10 days in Singapore, I headed home and Jon continued on to Beijing.


CHIPS The China portion of the trip was a bit more focused. In Beijing, Jon met up with a group of other Sun employees involved with China Innovation Program for Students (CHIPS) program. This article provides an overview of the program:

Sun Challenges China’s Top Students to Go Virtual

As part of CHIPS, teams of 3 students from 10 top universities in China submitted proposals to work on a project related to one of five Sun open source technologies: Project Wonderland, Project Darkstar, Sun SPOTs, Open Solaris, and NetBeans. These projects are designed to last for 6 months. A group with representatives from each open source project reviewed the proposals and selected the top proposals to pursue. The accepted proposals included six Wonderland projects. We have two each from Nanjing and Wuhan Universities
and another two from Tianjin and Zhejiang Universities. The proposals range from in-world weather simulations to acupuncture training to virtual home previews.

In order to support these projects, the faculty advisers for most of the student teams gathered in Beijing for training. Jon taught a half-day workshop intended to help the faculty get started with Wonderland development.

CHIPS classroom Jon teaching Wonderland workshop

The training was not without its challenges. We discovered that there are issues running Wonderland on the Chinese version of Windows. In addition, a number of the faculty came with NetBooks and other laptops that did not have graphics cards capable of running Wonderland. On the other hand, they assured Jon that the students would have access to either their own laptops or computer labs where these problems could be overcome. We are looking forward to this fall, when the students start working on their projects.

As with the Co-Space team and the various others working on Wonderland projects in Singapore, we hope that the students working on Wonderland CHIPS projects will become active members of the Wonderland open source community. And we especially look forward to experiencing the Wonderland worlds created by the six student project teams.


Get every new post delivered to your Inbox.

Join 54 other followers

%d bloggers like this: