Wednesday, May 26, 2010

Flexible UI



I'm cooking the new UIs for v0.6, starting with 768x1024 (and 1024x768), since that's the iPad resolution, and I know a couple people with iPads (it also maps nicely to a sheet of paper). Everyone has opinions on what makes a good character sheet and pretty much everybody can draw, I'd appreciate some feedback on the new layout.

If you're feeling particularly contributory, send me a note and I'll add you to the drawing so you manipulate the bits yourself.


Sunday, May 16, 2010

Ideas for v0.6

If I ever get v0.5 to run on an iPhone, here are some ideas for v0.6:

Expandable UI
Depending on the size of browser viewport, the UI will reconfigure itself to better utilize the available space. Thinking the 2-column sections go 3 or 4, eliminate multiple edit screens (leaving just main and edit).

Also, the Google Drawing app is just about "good enough". Still needs connectors.

Multi-class support
See later post for details.

Fast character switching
Currently, switching between characters requires a full reload of the webapp, should be able to change change character data without loading all the application data.

Use Google CDN for JQuery resources
The images for the JQueryUI haven't displayed correctly since I moved to CouchDB. Hopefully will fix that.

Friday, May 14, 2010

Firebug to the rescue

Firebug has a more readable and perhaps more insightful profiler than Chrome:

My reckless use of TaffyDB is the biggest offender, with isNumeric() way out of proportion (I mean, is it a number, or isn't it?).

UPDATE:
It appears the horrendous performance suction was caused my ordering of all static data elements:
  spells.orderBy({name:"logical"});
feats.orderBy({name:"logical"});
races.orderBy({name:"logical"});
domains.orderBy({name:"logical"});
classs.orderBy({name:"logical"});
schools.orderBy({name:"logical"});
weapons.orderBy({name:"logical"});
armors.orderBy({name:"logical"});
skills.orderBy({name:"logical"});
languages.orderBy({name:"logical"});
deitys.orderBy({name:"logical"});
specials.orderBy({name:"logical"});
favored_enemys.orderBy({name:"logical"});

I found the offending block by starting and stopping the Firebug profiler between breakpoints. It posts the results in the console, in the context of the logging. Just phenomenal tool.
Down to 4 secs:This doesn't mean it will work on the iPhone, but it can't hurt.

Thursday, May 13, 2010

localStorage for offline use

I've put in some caching for the static data using the HTML5 feature "localStorage", localStorage is essentially a cookie, but without a cookie's size limit, and it will not get sent to the server (something I didn't even know about cookies). The Player's Companion should now be able to function offline, but unfortunately it does not appear to have any impact on load performance.

Sunday, May 2, 2010

v0.5 in Testing

v0.5 involved a complete rewrite of the data load scheme, and the way rules are handled. Basically, to add feat attack effects before, I had to add some JS to the calc_attack function (messy and does not scale). Now, I ask for all feats with an attack attribute (which is a function), and execute that block of code:

feat description:

attack: "if(weapon.category == 'exotic') { attacks.weapon_proficiency = 0; } return attacks;",


function calc_attack() {
...
char_feats.get({ attack : { "!is": null } }).forEach( function(feat, i) {
// TODO - can we do this by reference
console.log("attack: " + feat.name);
attacks = feat.attack(attacks, weapon);
return attacks;
});

While it's probably technically better, an unfortunate side-effect is that it no longer works on my friends' iPhones or my Android emulator. Must be my IBM training to write software for next-next generation hardware (I'm still waiting for a machine to run Lotus Notes).