3 ms·
I don't know why you would opt to write a browser game from scratch in JavaScript and then use libraries with horrible garbage characteristics. Even these simpl
by kevingadd 15y ago
I don't know why you would opt to write a browser game from scratch in JavaScript and then use libraries with horrible garbage characteristics. Even these simple demos have horrible collection pauses.
Bundling a local development server with their dev tools is a good move, though. Doing development against file:// is basically impossible at this point due to how badly modern browsers mishandle requests for non-http resources.
- phoboslab 15y agoGarbage collection pauses are a problem, but Mozilla and Google are aware of it and working to improve the situation. The GC in IE9 seems to be surprisingly good (well, "fast" at least) already. What do you mean with "write from scratch"? There are libraries (like this one, or ImpactJS[1]) to help you out. If you develop a new browser game, HTML5 has a lot of advantages over Flash today - mobile browser or even "native" mobile support[2] is one of them. And yes, file:// URIs are horrible to deal with. Most browsers have a very broken "same origin policy" for file:// URIs - e.g. you can't manipulate images loaded from a file:// URI, because file://c/foo/bar.jpg is handled as if not loaded from the same "domain" as the hosting file://c/foo/test.html (Opera got this right, though). Disclaimer: I'm the ImpactJS guy. [1] http://impactjs.com/ http://impactjs.com/ [2] http://www.phoboslab.org/log/2011/04/ios-and-javascript-for-real-this-time http://www.phoboslab.org/log/2011/04/ios-and-javascript-for-...
- kevingadd 15y agoI'm referring to how if you look at the demos linked, they're using C++/Java style OO patterns in JavaScript that's apparently being written from scratch (instead of ported from existing C++/Java game code). If you're writing from scratch, you should really use JS-friendly patterns so that your code will perform better. Some of this might be due to the fact that they're porting libraries from other languages (like Box2D, for example). Entity.position = new geo.Point(x, y) versus entity.x = x, entity.y = y; ... etc.
- Meai 15y agoI don't understand why people have to build everything with Javascript. Objectively there is nothing that makes Javascript better suited for games than Flash/as3. I don't think that last ~0.5% of lacking Flash adoption is bothering anyone. There are no good IDEs for javascript. Library support is bad (Greensock? Flixel?) You don't honestly think that your 99$ library holds its own against these completely free features: http://flixel.org/features.html http://flixel.org/features.html Also People can much more easily steal your code and images than in Flash. As soon as Javascript really catches up with Flash on most of these things (which will still take a few years) we hopefully can program in Native Client which will destroy both Javascript and Flash. Extra topic on why browsers refuse to implement native client: If someone could explain what stake Browsers have in Javascript, I'd love to hear it. I have two theories: Browsers want to keep the web as "open" as possible. This means Javascript, because native binary executables would close this up immediately. On the other hand, I don't really understand the point of this openess. Every other market in existance goes by fine with binaries. Vendors give you tutorials and examples on how to build software. So what is the point of being open? To steal code? I don't see any other reason anymore. So I don't really think it's about being open for browser vendors. It's about control. If anyone can trivially write their own layout engine, has their own favorite language on the client....what are browsers worth then? Absolutely nothing, they would be degraded to cURL. It can't be security. Obviously javascript can call c code too, Nodejs does it. It's about sandboxing, and I see zero reasons why it can't be possible to sandbox pure c properly.
- azakai 15y ago> Bundling a local development server with their dev tools is a good move, though. Doing development against file:// is basically impossible at this point due to how badly modern browsers mishandle requests for non-http resources. You can run a local development server with a single line of Python, python -m SimpleHTTPServer 8000 so not sure why bundling a server is needed. In fact I would worry about running a bundled server, since I am not sure I can trust them to not listen for outside connections by default or have other security issues.