Wednesday, October 21, 2009

Ember 0.5.7 released!

I've just pushed the 0.5.7 release of Ember. More information here.

This release includes a lot of new nifty authoring features, such as snap-to movement. We've also put some effort into getting it to run correctly (with all nice shader effects) on ATI cards. And there are lots of speedups, especially in the terrain handling code.

The multi-threading work done during this year's Google Summer of Code isn't included in this release because of a couple of regressions; it will hopefully be merged in soon though.

Saturday, October 03, 2009

Easier authoring

The latest addition to Ember is a new authoring mode in which all entities in the world are easily selectable through graphical representation. While most entities in the world normally are represented by a graphical mesh, not all are, and not all meshes are easily selectable. This is most obvious when trying to alter terrain areas and mods, since these in most cases don't have any graphical representation at all. Previously one then had to either know the id of the entity and access the editor for it through the console, or use the entity browser to find it.
With the new visualizations this becomes much more natural, since it's now only a matter of selecting the entity in the game.

Another new addition is a feature for easier selecting entities obscured by other entities. The need for this arose from changes on the server for how the ocean is handled. Previously it were solely a client effect, putting a transparent plane in the world to represent the ocean. Now it's however a entity just like any other. This however presents a problem when picking things that are in the ocean, since the normal operation then would be for Ember to always report that the ocean was picked. The solution for this is a new feature in Ember which allows multiple "mouse pick results" to be presented. If any of the entities picked is transparent (such as the water) Ember will also look for any entity beyond the transparent entity. Through a simple paging mechanism in the mouse picker widget the user can then flip through the picked entities and select the one she wants to interact with.
I think it works pretty well, but I'm a bit biased so I would love to get some feedback from other users about this feature.

Wednesday, August 05, 2009

Major refactoring

I've just pushed a major refactoring I've been working on the last couple of weeks to the master repo. In the end it turned out really well.
The main part of the refactoring was to totally revamp the whole entity hierarchy in Ember, and how the entities are tied to graphical Ogre representations (meshes, lights, particle systems etc.). As with most refactorization, I had made some assumptions about how things worked a couple of years back which didn't hold anymore, and the code was beginning to creak from workarounds and special cases.
One of the assumptions made was that all entities in the entity hierarchy tree would be represented as an Ogre scene node. Another was that all graphical entities would be shown using the Model class. As one of our GSoC students, Amey, began to implement his task and needed some client extension for this it became apparent that these assumptions do not always hold. It's not always certain that an entity will be arranged in the Ogre scene graph through the use of a scene node. The most common instance is when something is attached to a skeleton (like a person wielding something). In addition, there are many kinds of entities which need graphical representation, but not through the use of a Model. In Amey's case it was the ocean.
Furthermore, when I first made the entity class system I used inheritance, so that each different entity would be of either just a normal EmberEntity class, or a PhysicalEmberEntity class, depending on whether it had a graphical representation in the world. However, as I work more and more with software I've come to realize some of the issues with depending too much on inheritance. Instead I now more often find myself component based design. In such a system the behaviour of instances are mainly determined by the interactions between the components that make up them. This of course leads to more complex systems, where it's a bit harder for a newcomer to get the full picture of how any given part should work. But it also leads to much more powerful systems, without many of the incorrect inheritances one tend to end up with when over using inheritance.

All this lead to me totally redesigning the entity class system. There's now only one entity class (well, except for the world entity, but that is a truly unique instance). The way something is shown is now handled completely separate in a graphical component, owned by the entity. And the way it's arranged in the Ogre scene graph is also handled by another distinct component. The end result is that there's now a much more robust system in place which more correctly maps how things really are arranged. This means that we now have a much more cleaner design, which is also extensible enough to handle more advanced cases than the previous system could. I've already pushed code which will connect an ocean entity to a water representation, something which in the old system would have required all kinds of hacks.