Settings

Theme

Js Game Wiki

github.com

80 points by chorola 12 years ago · 15 comments

Reader

pachydermic 12 years ago

Awesome!

For as popular as JS is, I've found it pretty difficult to find good tutorials and resources online for it. I guess I was looking in the wrong places? Google was just failing? My google-fu isn't as good as I think it is? I dunno...

I think this will be a big help and a good resource, so thanks a million.

  • ufo 12 years ago

    Do you mean JS the language or game programming in particular? If its just the language then there are is a bunch of good material I could recommend you (and everyone should at least read Javascript the Good Parts even if you dont agree with everything it says)

    • pachydermic 12 years ago

      I am lucky enough to have a "Safari books" subscription from my employer, so I have been able to look at some books - I know that one's supposed to be seminal, but I haven't gotten around to it yet. Any other recommendations are welcome.

      Because I've just started messing with javascript, I'm mostly focused on games programming. But more generally, it seems hard to find information about how to write well optimized javascript (especially in terms of memory usage). This could be my problem, though. I get confused by callbacks and knowing when I'm creating objects (especially functions) versus when I'm reusing them. Callbacks are just confusing the hell out of me - specifically inside of something like requestAnimationFrame... how do I prevent new functions from being created every time I use it?

      I mean, w3schools is awful for anything but a very quick reference, and while the content on MDN seems to be accurate, it's not very exhaustive and doesn't seem to provide much explanation. Whenever I have a problem with matlab or perl I can go to some great websites or just google my problem to find solutions (and often great explanations) quickly.

      • cheapsteak 12 years ago

        Could you elaborate on the problem you're having with callbacks and requestAnimationFrame?

        I initially posted this, but now I'm not sure if this is what you meant:

        Don't do this:

            requestAnimationFrame(function () { 
                //a new instance of this function is created every time
            })
        
        do this:

            var efficientFunc = function () {
                //this is created only once and is reused
                requestAnimationFrame(efficientFunc);
            }
            requestAnimationFrame(efficientFunc);  
        
        Basically avoid writing anonymous functions for callbacks that are going to be callback-ed more than once.

        Another thing that might help with memory is make sure you don't keep references to things you want garbage-collected.

        E.g. if object `A` has a reference to object `B`, `B`'s memory won't be freed even if you never use it again. MDN has a better explanation and example [1]

        As for books I'd recommend Effective Javascript by David Herman.

        [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memo...

      • ufo 12 years ago

        First of all, for tutorials, I really liked this one:

        http://jqfundamentals.com/chapter/javascript-basics

        it gets jquery specific in the end but the start with Javascript basics is very good.

        I agree that its though to find things related to memory use and performance - I am pretty bad at that myself :) That said, a rule of thumb is that whenever you evaluate an object literal ( "{...}") or function expression ( "function(){ ... }") then you will will create a new object/function instance that will have to be garbage collected in the future. As already mentioned, you get around this by declaring the function beforehand (assigning it to a variable) and then reusing that reference in the future.

        As for code reference, stay away from w3schools - they suck and only dominate search rankings because of aggressive SEO. I recommend sticking to MDN, or, if you are feeling adventurous, checking out the Ecmascript spec (dunno how good these are with the newfangled game stuff though)

        http://www.w3fools.com/

        http://es5.github.io/

        For callbacks there are two things I have to say. First of all, some people used to OOP take a while to get used to callbacks instead of classes + method passing, but after you understand whats going on its hard to go back to living without first-class functions. Secondly, if you have complex code with lots of callbacks calling other callbacks then its going to be ugly no matter what you try to do (taming callback hell is a little industry of its own...). Learning about continuation passing style helps understand things a bit better though.

        Finally, one thing you didn't mention but that its good to point out just in case: if you dont already know how to use the debugger in your favorite browser yet, do it ASAP. Use console.log instead of alert for when you want to do "printf debugging" and never use document.write unless you really know what you are doing. I see people doing these last two all the time and its kind of sad...

AndyKelley 12 years ago

See also Game Modules Wiki[1]

[1]: https://github.com/hughsk/game-modules/wiki/Modules

austinhallock 12 years ago

Also http://html5gameengine.com if you're looking for a list of engines. It's limited to the more popular, actively maintained engines and has reviews, links, etc... for each.

TrainedMonkey 12 years ago

Could be better, but few things are perfect. Nice to have all of that info compiled in one place without tons of ads. Now add more detailed descriptions to each of links and organize them in beginner/intermediate/advanced/expert categories. This way a newbie won't be completely lost and pro's won't lose interest by opening first few links that are easy. More ambitious project would be to add some kind of series of links/tutorials so that people who want to learn will have a decent way of tracking their progress.

Kiro 12 years ago

You're missing one of the most vital things: game engines.

FreezerburnV 12 years ago

I was actually just looking for some stuff about Javascript game development. (specifically looking for three.js, which I'd forgotten the name of) So this is kind of wonderful timing to have this pop up.

It looks like a wonderful hub of all sorts of information about game development, good job to the person who put this together! Hopefully I can even apply the lessons I learn from all of this generally to other languages as well.

CmonDev 12 years ago

Not an ideal name choice: JavaScript is used in some mainstream non-web engines e.g. Unity 3D.

alexatkeplar 12 years ago

Nice! You're missing analytics - Google Analytics, Snowplow, MixPanel etc

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection