Modeling Patterns for JavaScript Browser-based Games

Jarod C. Long and Raymond J. Toal


HTML5, Prototypal Inheritance, JavaScript, Canvas


Browser-based graphics applications, including interactive games, written entirely in JavaScript are rapidly gaining popularity among developers as alternatives to plugin-based applications. The use of JavaScript, as opposed to ActionScript or Java browser plugins, forces developers to deal with issues such as prototypal inheritance and full source-code visibility, in addition to classic issues involving the integration of graphics, physics, and animation engines. This paper examines the influence of JavaScript syntax and semantics on the development of rich domain models common to interactive applications, and presents a design pattern for JavaScript modules and types in the context of a two-dimensional physics-based game—a contribution that can be applied in both client-side and server- side JavaScript applications. The work is independent of any particular game engine, and shows how developers can work entirely within JavaScript’s prototypal approach to object orientation without introducing a framework for “artificial” classes.

Important Links:

Go Back