Saturday, November 10, 2007

Out drag and drop, In context menu

Removing any possibility of drag and drop is a big hit for my project. Drag and drop is such a natural way to interact with an interface that it was clear in my mind that pretty much everything would be handle this way. Unfortunately, javascript,s drag and drop use way too much CPU and freeze everything else...

I tried different ways of integrating drag and drop without much success. The drag just takes too much resources and freeze every other loops required to animate characters and NPCs.

One way to deal with it could be to completely hide the "world zone" while dealing with interfaces such as inventory and to resynchronize everything when the inventory is closed. I'm still not sure if I really want this since it will give a very bad feeling of extreme lag.

The way I'm handling all this for now is with context menu. So in the inventory, each item have a menu appearing on right click with options such as "Equip", "Drop", "Unequip", ... It's less intuitive but doesn't look that bad either.

Note that I'm using Prototype and and that the performance problems I experienced with drag and drop aren't related to those libraries. It's just too expensive to constantly check for mouse movement and refresh the position of an object.

I knew that working with Javascript would bring some issues but so far I'm mostly amazed at what I've been able to do with it. Now I can't wait to test this on the Internet. I'll probably looking for a VPS in december (or maybe wait after the holidays) to test the Alpha version.