Hi everyone,

Would anyone suggest good tutorials on simple game programming in javascript preferably using HTML4 ?

Thank you..

Recommended Answers

All 7 Replies

Anyone do game programming in JavaScript at all?

There are plenty of ways to do it. Also, depends on what type of game you want. However, there is a problem with animation part that browsers seem to leak memory when the time goes by.

Anyway, there is no such a tutorial for game programming purpose. However, you could search for DHTML which was used for game before. Learn from there to get some ideas how to implement certain things.

I like puzzle and I implement all types of puzzle games I could think of in JavaScript. Though, I never publish my work because I do not like people copying my code. Besides, my coding style is "prototype" which to me is intuitive (but may not for others).

The game I would like to make is something like a chess but it behaves a little differently. It has got a matrix of 3x4 and four different players at maximum. So if you click on one of the sequares, it should show you how much food in there (numeric value) and a little ants that you move to find out about the food in nests.

Is it hard to game programe in Javascript? Why does the mark-up language have to be DHTML? These days, people have moved on to HTML5 for the features it provides.

The DHTML is just a suggestion for history/trick learning about how to do scripting in JavaScript. HTML5 supports more graphic rendering (a lot faster). I don't do HTML5 that much because my purpose is not directly deal with their advantages. Though, certain things could be changed later on to support HTML5.

No, it is not hard to do JavaScript, but you need to know how to do any thing you want. Remember one thing though, there is no secret/security in JavaScript. In other words, anything you put out on the page with JavaScript, there is always a way to get to it. For example, you create a function class and have local variables, those variables are accessible by any user if the user has a tool and knows how to read the script. One may argues that obfuscated script is a way to secure the script. You know what, it is not because it is the lowest level of encryption that can simply be decrypted by another script. Not too hard to implement the reverse script either.

In your case, you need to think what your game needs to have. If you want to script it in OO programming fashion, it would be even better. Start with only 1 player first. If I were you to implement it, I would create classes for each part -- game board, controller (mouse/keyboard listener), ants, and the game itself. The game board contains the value of food and animation display the value if a mouse is click on, the controller ties functions from the game to whatever event listener you want (left, right, middle click), the ant displays its animation, and the game itself links and ties everything together. Just a thought.

Thanks for the thought that you're sharing in this discussion. I know OO way is better than the traditional way. Although, I haven't done OO in Javascript. I'm a beginner still.

Just show me what you got so far. If I could give you any input, I will. :)

I don't have anything at the moment. But, I was wondering if anyone knows good tutorials online so I can teach myself a bit. Yeah, I was working on a small animation project for myself but I don't think it was fully working. I will come back to it later and see what needs to be fixed!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.