JavaScript embedding and coding

Original author: John Resig
  • Transfer
Note: below is a translation of the article “Embedding and Encoding in JavaScript” , in which the author (JavaScript evangelist in Mozilla and the author of the jQuery library in combination) considers methods of compressing information and combining it using JavaScript and some other methods. My comments are further in italics.

A rough implementation in JavaScript (a note on Habr , link blog.nihilogic.dk/2008/04/super-mario-in-14kb-javascript.html ) the first level of Super Mario Brothers literally the other day went around the entire Internet. In general, you can play it, although many key aspects have been missed (no mushrooms, no flag, no raising points, etc.). However, this is actually not the most interesting aspect in this game.

Probably the most interesting thing in this web application is not the game mechanics themselves, but the fact that everything is collected in one single file - a game script that includes all game sprites and all music.

This is a very curious piece of engineering, and it contains things that you can apply in your own code. Let's move on and see how this was done so that we can use all these tricks for our own sites.

read more on webo.in → .

Also popular now: