Questions tagged [javascript]

"JavaScript (sometimes abbreviated JS) is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles."

From Wikipedia. http://en.wikipedia.org/wiki/JavaScript

Javascript is a scripting language used to make both client side (browser) and server side (node.js) applications. As of the introduction of HTML5, it is getting increasingly more popular as a choice for game development, usually utilizing the <canvas> tag.

Characteristics:

  • object oriented
  • prototype based
  • C-style syntax

Typing:

  • dynamic
  • weak
  • duck

Game programming in Javascript:

Good resources for JavaScript 2D game programming?

1431 questions
57
votes
18 answers

What are good JS libraries for game dev?

If I decide to write a simple game both text and graphical (2d) what libraries would I use? (Assume we are using a HTML5 compatible browser) The main things I can think of Rendering text on screen Animating sprites (using images/css) Input…
user1047
50
votes
12 answers

How do you prevent your JavaScript / HTML5 web game from being copied or altered?

I'm in the middle of planning a game built using JavaScript and HTML5. I'm having trouble understanding how you could prevent someone from simply copying the JavaScript from the web server and either making their own game with it (not my biggest…
Christian
  • 603
  • 1
  • 6
  • 6
47
votes
7 answers

Managing text-maps in a 2D array on to be painted on HTML5 Canvas

So, I'm making a HTML5 RPG just for fun. The map is a <canvas> (512px width, 352px height | 16 tiles across, 11 tiles top to bottom). I want to know if there's a more efficient way to paint the <canvas> . Here's how I have it right now. How tiles…
test
  • 487
  • 4
  • 11
35
votes
7 answers

Anti-cheat Javascript for browser/HTML5 game

I'm planning on venturing on making a single player action rpg in js/html5, and I'd like to prevent cheating. I don't need 100% protection, since it's not going to be a multiplayer game, but I want some level of protection. So what strategies you…
Billy Ninja
  • 493
  • 1
  • 4
  • 7
34
votes
5 answers

How do I implement features in an entity system?

After asking two questions about entity systems ( 1 , 2 ), and reading some articles on them, I think that I understand them much better than before. I still have some uncertainties, mainly about building a particle emitter, an input system, and a…
jcora
  • 7,917
  • 5
  • 54
  • 89
32
votes
2 answers

In a browser, is it best to use one huge spritesheet or many (10000) different PNG's?

I'm creating a game in jQuery, where I use about 10000 32x32 tiles. Until now, I have been using them all separately (no sprite sheet). An average map uses about 2000 tiles (sometimes re-used PNG's but all separate divs) and the performance ranges…
Nick
  • 1,605
  • 18
  • 27
30
votes
3 answers

How do I lerp between values that loop (such as hue or rotation)?

View Demo I'm trying to make the joint rotate smoothly around the center of the canvas, toward the angle of mouse pointer. What I have works, but I want it to animate the shortest distance possible to get to the mouse angle. The problem occurs when…
jackrugile
  • 405
  • 1
  • 4
  • 10
29
votes
4 answers

Simple noise generation

I'm looking to generate noise that looks like this: (images courtesy of Understanding Perlin Noise ) I'm basically looking for noise with lots of small "ripples". The following is undesirable: Are there any simple ways to do this? I've been looking…
Xeon06
  • 1,152
  • 2
  • 12
  • 13
23
votes
7 answers

HTML5 Game (Canvas) - UI Techniques?

I'm in the process of building a JavaScript / HTML5 game (using Canvas) for mobile (Android / iPhone/ WebOS) with PhoneGap. I'm currently trying to design out how the UI and playing board should be built and how they should interact but I'm not sure…
Jason L.
  • 487
  • 1
  • 4
  • 12
23
votes
3 answers

Double buffering on HTML5 Canvas game?

My simple canvas game seems to work fine on Chrome and FF on Mac/Linux. I haven't had chance to test it on smart phones or Windows environments yet. It doesn't use double buffering but I have seen some JS Canvas examples using it. When is the use of…
Petteri H
  • 1,743
  • 1
  • 18
  • 24
22
votes
12 answers

Isometric game engine in JavaScript/HTML5

Is anybody aware of any stable-ish (ie out of alpha) isometric drawing engines for JavaScript/HTML5? I have done some Google searches and found a few, but they were mostly in alpha/invite-only status. Is there anything mature enough to be used in a…
erik
  • 1,378
  • 3
  • 13
  • 26
21
votes
2 answers

What is a "normal" in game development

I'm new in Game development and probably this is a silly question. I had a look online but haven't found a clear answer, I did it bit quick but enough to evaluate that this is a confusing topic without prior experience. The most topic I found…
Federico Baù
  • 473
  • 4
  • 9
21
votes
5 answers

Prevent cheating in html Javascript game

I have made a Javascript/html game. Now the problem I have is anyone can edit the client code and cheat in game for example there is a man shooting a enemy. Man HP: 100 Enemy HP: 50 <div id ="man" hp="100" > </div> Now if someone changes the hp…
Ohmyholy
  • 321
  • 1
  • 2
  • 5
20
votes
4 answers

How do I make a JS game downloadable?

I can put the HTML and JavaScript together in the same .html file, but the images need to be separate files. The only solution that comes to my mind is to give to the user a .zip folder. This is not pretty though... How else can I do this?
Arnaud
  • 303
  • 2
  • 6
20
votes
6 answers

Are there any alternative JS ports of Box2D?

I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library. I found out Box2D and its JS port.…
Petteri H
  • 1,743
  • 1
  • 18
  • 24
1
2 3
…
95 96