views:

160

answers:

4

I am currently half-decided to use Kohana + Zend as needed for the PHP part. What I would need next is an excellent base for JavaScript code. There are a bazillion of contenders here and choosing isn't exactly as easy as with PHP.

I would need practically everything from form posting and retrieving results to skinnable widgets and animations. For this reason using multiple libraries will probably be a must, as no one framework can do it all. The requirements I have would be this (initial list):

  1. Good browser support. WebKit-based is hardly an issue and Firefox 3+ is good. However, I'm looking at you Internet Explorer. IE 6 can be ditched, seriously, but 7+ support is needed.
  2. Good performance. While WebKit has had a stupidly fast JS implementation for quite a while (and Chrome even before), Firefox has only recently got TraceMonkey and don't even get me started on Internet Explorer. While it is true that you can't do much about IE as anything will be slow, I don't want to try running Chrome Experiments in the others either.
  3. Excellent support. This is a total must. The better the support, the more inclined will I be towards a library.

I am currently looking into jQuery as it is a very neat library, but the quality of plugins is questioned by some. Processing.js looks extremely promising, but IE does not support canvas, thus something has to be done about that and I am not sure how it could be replaced.

+1  A: 

Go with a known library that is used by many sites. This will ensure all 3 of the points you have mentioned.

Personally, I would go with jQuery for these above reasons:

  • Great cross browser support
  • Good performance, as it is a thin api layer
  • Excellent support. Good documentation, loads of other devs
Oded
I know jQuery is the leader in all three categories. However it does lack in functionality as it is a light library, compare it to dojo for example, though I haven't done a lot of research into plug-ins and I don't know what they offer.
iconiK
Even with all the plugins?
Oded
"though I haven't done a lot of research into plug-ins".
iconiK
One of the strengths of jQuery is the amount of available plug-ins. Some of those blow my mind...
Oded
jQuery's plugin proliferation is a mixed bag. Some are great, most aren't, and some are coded like crap.
Justin Johnson
A: 

Although jQuery seems to be the most used library these days, there are other very good candidates as well.
One of them are YUI Library.

YUI has excellent documentation, and support. And the source code is really good. YUI is developed by Yahoo!, where Douglas Crocford is architect (the author of JavaScript: The Good Parts, and the man behind JSON). Yahoo! is well known for their focus on JavaScript development.

YUI has good browser support and is fast and robust.

rlovtang
However YUI is more business-oriented: it has a lot of widgets for business, like charts, graphs, tables, etc. but not so many general-purpose widgets. YUI is damn slow, not fast: http://blog.creonfx.com/javascript/mootools-vs-jquery-vs-prototype-vs-yui-vs-dojo-comparison-revised
iconiK
Please don't compare old version, that serves no purpose. YUI got a total makeover with version 3. jQuery also got major performance improvements lately. Here is an updated version of the same test suite (slickspeed) with both jQuery 1.4.2 and YUI 3.0.0. http://www.domassistant.com/slickspeed/On my computer YUI used 60ms, jQuery used 92ms.
rlovtang
Ran the test a few times in different browser. Some differences, but on an average, YUI 3.0.0 and jQuery 1.4.2 performs the same.
rlovtang
Ahh, didn't look at the version. I will take a look at it.
iconiK
A: 

Dojo is a great library for writing web applications; however, never having written a game, I'm not sure if it is well suited for that sort of application. I must warn you though that the Dojo documentation is crap. Absolute crap. On the other hand, things like dojo.hitch, dojo.require, and dojo.partial are absolute joys.

I would try to avoid using cross-cutting libraries (like Dojo+jQuery) as much as possible. There's not really a good reason to do it and will create bloat and confusion in your application from day one.

That said, using multiple, non-overlapping libraries does make sense for a project like this. You might want to look into using Processing.js for visual needs and either Dojo or jQuery for your core.


Some other things to consider. Targeting IE, even IE8, for JavaScript game development is a bit ridiculous because of its slow performance and lack of canvas support. Also, according to John Resig, developing games in JavaScript is hard.

Have you considered being a pioneer (wink) and trying something out in 03D?

Justin Johnson
Your mention of the quality of Dojo's documentation quickly made me remove all traces of it from my computer. A quick Google scan confirmed that. I guess I'll use jQuery and I'll have to look only into a good UI library. @Processing.js, the little demo on the front page impressed me a lot more than every other UI library combined. I'll give it a deep study. EDIT: The lack of IE support doesn't made P.js look usable at all :-/ And there is only one party to blame: Microsoft.
iconiK
Dojo isn't all bad, it just takes a little time. I've updated my answer with some other thoughts.
Justin Johnson
The core will be in PHP, to offload all the hard work to the server. The JS is only for displaying the data and manging user interaction. IE is the most used web browser, so I can't possibly not support it from a business point of view. I know canvas is very good, but sadly, for IE at least, it has to be replaced.
iconiK
A: 

If it's war simulation and you have custom objects that you want to animate beyond the simple CSS effects and animations, then canvas tag is your best bet. It's as close as you can get to Flash but much more smoother. Processing.js looks really good for manipulating the canvas.

If that's the core component of your game, then I see the other libraries as adjunct to Processing.js that can be scrapped out without any deep commitments. That said, jQuery is great if you're dealing heavily with the DOM. It has really good support and community. MooTools is highly modular and has been traditionally strong with animations. YUI is a great library too, but a little verbose for my taste. Thought, Yahoo has made heavy changes with v3 to fix that. And a bunch of other libraries, that I don't use at all.

Anurag
IE does not support canvas, so something has to be done, as IE 7+ support is an absolute requirement.
iconiK