Friday, September 21, 2007

Dolls

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.

1 comment:

rogerdv said...

Excellent! Keep the good work. I wish the server side had progress so fast like this client.