Difference between revisions of "JavaScript"

From RogueBasin
Jump to navigation Jump to search
(added javascript development information)
Line 1: Line 1:
JavaScript is a scripting language used by most web-browsers. Roguelikes can also use it as a scripting language (e.g. for scripted events or quests). This allows changing some game behavior without recompiling. Some browser-based roguelikes are written in Javascript or its Microsoft relative JScript (and JScript.NET).  
JavaScript is a scripting language used by most web-browsers. Roguelikes can also use it as a scripting language (e.g. for scripted events or quests). This allows changing game behavior without recompiling. Some browser-based roguelikes are written in Javascript or its Microsoft relative JScript (and JScript.NET).  
 
===Development Hints ===
* Use jsLint[http://www.jslint.com/] to avoid many mistakes that are normally caught by a compiler
* Javascript frameworks abstract many of the browser inconsistencies.  (MooTools[http://mootools.net], JQuery[http://jquery.com])
* Take advantage of Firebug for Firefox and the Web Inspector for Chrome and Safari
 
===Advantages ===
* Scripting languages usually have a faster feedback loop between development and viewing the changes
* Closures are a powerful language construct that can simplify application structure and enhance readability
* Any user with a modern browser (on any platform) can run your game
* A whole new world of  easy-to-access graphical possibilities with the DOM or <canvas>
* Working in a dynamic and garbage collected language takes a lot of the pain out of strong typing and memory management
 
===Disadvantages ===
* Many errors that are caught at compile-time in a strongly typed language will be caught at run-time
* Existing source for most roguelikes is in C or C++, and not all idioms translate into javascript
* There are browser differences in javascript implementations and javascript speed, so true portability still takes work
* Javascript is much slower than C and C++ (however, not all roguelikes require blazing speed)
* Full filesystem access requires additional plugins


{{stub}}
{{stub}}
Line 8: Line 27:
* [[The Seven Day Quest]] (a {{7DRL}})
* [[The Seven Day Quest]] (a {{7DRL}})
* [[Advent]] (HTML5 and Canvas)
* [[Advent]] (HTML5 and Canvas)
* [[jsMoria]] (javascript port of the roguelike classic [[Moria]], uses MooTools[http://mootools.net])
[[Category:Programming languages]]
[[Category:Programming languages]]

Revision as of 17:02, 3 August 2010

JavaScript is a scripting language used by most web-browsers. Roguelikes can also use it as a scripting language (e.g. for scripted events or quests). This allows changing game behavior without recompiling. Some browser-based roguelikes are written in Javascript or its Microsoft relative JScript (and JScript.NET).

Development Hints

  • Use jsLint[1] to avoid many mistakes that are normally caught by a compiler
  • Javascript frameworks abstract many of the browser inconsistencies. (MooTools[2], JQuery[3])
  • Take advantage of Firebug for Firefox and the Web Inspector for Chrome and Safari

Advantages

  • Scripting languages usually have a faster feedback loop between development and viewing the changes
  • Closures are a powerful language construct that can simplify application structure and enhance readability
  • Any user with a modern browser (on any platform) can run your game
  • A whole new world of easy-to-access graphical possibilities with the DOM or <canvas>
  • Working in a dynamic and garbage collected language takes a lot of the pain out of strong typing and memory management

Disadvantages

  • Many errors that are caught at compile-time in a strongly typed language will be caught at run-time
  • Existing source for most roguelikes is in C or C++, and not all idioms translate into javascript
  • There are browser differences in javascript implementations and javascript speed, so true portability still takes work
  • Javascript is much slower than C and C++ (however, not all roguelikes require blazing speed)
  • Full filesystem access requires additional plugins


Roguelikes in Javascript