Wednesday, September 26, 2007

Missing files

I had some people try to build and run the Ember source by themselves. It turned out that apart from some missing media files (such as the whole gui texture file) some of the xml files for CEGUI wasn't conforming to the schema specification. The reason I haven't noticed this before is that CEGUI can use many different backends for parsing xml. It can use either expat, libxml, xerces or tinymxl. Very nice component design there and all. But I had always compiled it with tinyxml, which as the name implies is very tiny and don't have any validation support. All incorrect tags are just read as they are. However, if CEGUI was compiled with Xerces instead, which is quite large and has schema validation, the loading would fail since Xerces would throw an exception when encountering invalid xml. And this is precisely what happened when other people tried building Ember, since they had CEGUI compiled with Xerces support. I've now fixed the issue and committed. I have to do a 0.5.1rc2 release soon though, since the modeldef format has changed, disallowing the use of the 0.5.0 media with cvs ember.

On the icon front I've gotten even further with the drag-n-drop functionality. There are some small usability bugs still left, but overall I think it's quite usable. I've been starting to think of how to improve the entity context menu. Currently it's just a regular menu that pops up, but I'm thinking of having a radial menu with icons instead.

Friday, September 21, 2007


I've further expanded on the icon code, and in the process added more and better lua connections. I'm getting better and better at writing lua code. As with most new languages, it's not hard to learn, but it takes some while to start using the advantages of the language. Usually you tend to start out writing code in the same way that you would write C++ code, and then gradually replacing that with code written in the "Lua way".

Yesterday I added a first prototype for a user doll, where it should be possible to see what items currently are equipped. By dragging and dropping items on certain slots it should be possible to change equipment. It worked out fine. The icon system contains two elements: slots and icons. Both are handled by the EntityIconManager. The script asks the manager for some slots, puts the slots above the image of the avatar and attached some scripts to them. Then later on when an icon is dragged from the inventory and dropped on the slot a signal is emitted, which triggers a script. This script calls the necessary server side methods for wielding and changing the outfit, and voila! the item has been equipped. It's very elegant so far and should be easily expandable.

When dropping items, instead of pressing the "drop" button, the icon should be dragged and dropped on the world, at what point it should appear in the world as a 3d element. Similarly, when trading the user should only need to drag and drop items from the inventory into a "trade" box.

The EntityIconManager takes care of all bookkeeping, so it's really easy for the scripts to just request an icon or an icon slot. This should all make the player experience more smooth.

Here's a couple of screenshots demonstrating how to wield an axe.

Wednesday, September 05, 2007

Further icons

I've continued on the icon framework and started redesigning the inventory widget. I now have a working solution where the icon management framework provides automatically rendered icons to the widget. A work in progress screen shot can be seen to the left. This shows the icons in the inventory widget to the right, as well as the asset manager to the left, showing the icon texture.
Icons for entities will probably be used all over the interface. Apart from showing basic inventory I can see them being used in equipment dolls, quick bars, trading dialogues and so on.
Therefore I need to design a more robust generic system for dragging and dropping entity icons. Thankfully CEGUI already has excellent support for draggable windows. The icons in the inventory widget can already be dragged. What's left to do however is to allow for them to also be dropped. Preferably in a way that can easily be defined or extended in a lua script. The idea is to allow for entity icons to be dragged and dropped in a generic fashion, so that you should be able to drag and drop an icon from your quickbar to a trade dialogue in the very same way that you would be able to drag and drop it from your inventory.

In addition, I quickly realized that some entities are rendered nicely by default. For example, the coins are by default rendered lying down. Since they don't have any depth, this will result in an empty icon. We therefore need some way of defining how certain models should be rendered when shown as icons. This was easily fixed by extending the .modeldef format with a new "" tag. This tag allows you to define arbitrary "views" for the models. When rendering an icon Ember looks for a view by the name of "icon", and if found sets the camera distance and orientation from the values defined. I'll have to add support for setting this to the model editor though, since it's a bit hard to guess the correct orientation values by hand.

The inventory also needs some better looking graphics. Well, the whole of the gui needs better looking graphics. I've created a blueprint for that here.

Monday, September 03, 2007

Icons galore!

After adding the status widgets and updating the entity labels the only thing left that made Ember look ugly in the default mode was the inventory widget in the lower right. It's always been meant to be a placeholder widget only showing the most basic info (a list of entities with name and type). The grand idea was to instead use small icons for the different entities, much like each and every other game in existance. I could easily have used the EntityCEGUITexture class to render individual entities into separate textures, but this being Ember I opted to go for a more robust solution. Icons is something that we're gonna need here and there in the client, not only in the inventory. I therefore though it would be prudent to provide a more generic icon manager class which uses an icon cache, handles rendering and updates of icons and does house keeping of all icons. I've added a blueprint for it to the launchpad. So that's what I've been doing the last week. I've gotten so far as to have the basic classes done for letting other components check out icons for both entities and Eris base types. They are automatically rendered in a small size (64x64) and copied to a single larger texture. This will increase performance compared to using multiple small textures.
While I've worked on this feature I've also added some much needed asset browsing features to Ember. I found that while debugging I had a great need for a widget which listed all textures used in the system and allowed me to see real time changes to them. This is something that I've felt the need for before, but never had a pressing enough issue. The first iteration allows for texture browsing only, but the idea is to build on it to allow for browsing of all different resources used, such as materials, scripts, meshes, models and so on.
All in all, some nice features for a much better looking UI are on their way.