Web-based Gaming
An Evaluation of JavaScript, ActiveX, and Java

Stephen Letschin - sletsc1@umbc.edu | Steve Matuszek - smatus1@umbc.edu | Greg Sturniolo - gsturn1@umbc.edu

November 25, 1996


This document examines the JavaScript and Java languages, as well as the development suite ActiveX, in the context of World Wide Web-based gaming. After summarizing the advantages and disadvantages of each language, the conclusion is drawn that Java is the best suited for this application. Case studies from real Web games help to highlight key points.

This paper was developed as part of the requirements for the course: CMSC 331 Priciples of Programming Languages, University of Maryland Baltimore County.



Computer games have always been at the forefront of using new technologies in computers. Games went from being single-player to using network technology to involve multiple players. With the rapid growth of the Internet, games have begun to appear on the World Wide Web which allow any number of players to play the games at the same time from their own sites, some even supporting head-to-head competition. The emerging technologies that have made this widely feasible are the languages Java and JavaScript, and the application development suite ActiveX. These languages, while they share certain characteristics that make them suited to Web gaming applications, are also different in many important respects. While JavaScript and ActiveX include several features that make them viable candidates for web-based gaming, the browser- and platform-independence of Java, combined with its compiled nature and increased security, make Java the most suitable language for this type of application.

Brief history of computer games

Computer games for most computer systems have their beginnings in Pong. This rudimentary game established games as part of the computing landscape, and secured gaming a place at the forefront of technology. Over time, Pong was replaced by text-based, often role-playing, games. While these games were more involved than Pong in concept, they lacked the graphical capability of the games yet to come. These text-based games were quickly replaced by games involving basic graphics and, ocassionally, sound. Over time, these graphic games developed with better graphics and improved player interaction. In recent years, games such as DOOM have developed that allow the standard gaming enviornment to extend to multiple players over a network. These network-based games have continued to improve and involve more and more features. Latest generation network games such as Descent provide 3-D, CD-quality sound, multi-user support, and numerous other improvements. These networked-games are but a prelude however to the capabilities that exist for games played over the World Wide Web, the graphical portion of the biggest network in the world, the Internet.

Application specifications

In order to make comparisons between Java, JavaScript and ActiveX for purposes of Web gaming, we must first settle on exactly what the important aspects of gaming are -- in other words, the application specifications.

  1. Game-specific programming. Ideally, for programming of games, a language or development environment has special capabilities for manipulating graphics, sound, user interface (mouse control handing, keystroke handling), and multiple user support.

  2. Performance. Even as the capabilities of machines grow greater, software developers always endeavor to squeeze the best graphics, complication of environment, and response time out of their programs. So the application must run efficiently and effectively.

  3. Platform- and browser-independence. One of the most important features of the Web is that users with most any computer platform can use it. Similarly, for games to reach the maximum possible audience, they should be able to run on the greatest number of computers and WWW browsers. Realistically, this means the browsers Netscape Navigator and Microsoft Internet Explorer (MSIE) on Windows, Macintosh, and UNIX platforms.

  4. Security. One would hope that it would be possible to play a game without endangering one's data, privacy, etc. So ideally a Web application should not be able to write to or read from the user's local system. Also, a connection between the Web site and the client should be secure, to prevent password theft and so forth.

  5. Multiple user support. This includes both the ability to handle an arbitrary number of single players playing multiple instances of the same game, and the ability to handle multiple players playing head-to-head in the same game.

  6. Game worthiness, interest, and playability. This has more to do with the skill of the programmer than the nature of his program. This is the first thing that the end user will notice, however, and we included it in our research of the state of Web gaming.


JavaScript is, according to the JavaScript white paper, "a compact, object-based scripting language for developing client-server Internet applications." In fact, it began life as LiveScript, a scripting language being developed by Netscape for Navigator. When Java became popular, Netscape and Sun reworked it to use some Java flow-control and expression syntax, renamed it JavaScript and incorporated it into Navigator.


This gave JavaScript an instant advantage of potential userbase, as Navigator version 2.0 or later and MSIE version 3 and later support it out of the box.

JavaScript is easy to program in, at least relative to more complicated object-oriented languages such as Java and C++. JavaScript is not truly object-oriented in that it does not involve inheritance or true classes, but rather supplies useful objects such as the document object and the image object for the programmer to use.

But JavaScript's single largest advantage is that anyone with a web page can put up a JavaScript application. This is because the script is interpreted on the fly by the browser, rather than being compiled code residing on the web server. This allows code to be included "inline", placed directly into a Web document, rather than referenced, which would require that the browser and the page author have access to a web server's executable files.


As mentioned before, JavaScript is interpreted rather than compiled. This results in slower performance.

We also mentioned before the advantages conferred by the fact that JavaScript is not a true object- oriented language. This also has some disadvantages, of course. The programmer cannot create new objects, or extend existing objects. If he could, he could also distribute that code; as it is, there is no extant body of object-oriented classes and objects which the programmer can use for himself.

Case Studies

The INCREDIBLE JavaScript Maze Game ( http://www.tisny.com/js_maze.html ) is the sort of game that many JavaScript programmers find to be the height of what they are able to do within the language's framework. It's a simple text-based game, using a form input field for output, with iffy redraw capabilities and a clunky interface (notice the four buttons).

A better game is Dr. Clue's Netris ( http://www.cnw.com/drclue/tetris/tetris.htm ). With a great deal of code, the author has managed to incorporate moving pieces and an incrementing score. Note that the pieces are still controlled by buttons, which is a weaker alternative to keystroke control -- and the down button doesn't do anything. This game runs quite slowly, too... but it's about the best JavaScript game out there.


ActiveX is "a set of technologies that enable software components to interact with one another in a network environment, regardless of the languages in which they were created. ActiveX is built on a Component Object Model (COM) and leverages 5+ years of Microsoft investment." (Microsoft web page). ActiveX is the heir apparent to OLE and OLE control (OCX) architectures.


Since ActiveX is based on existing OLE and OCX technology, migration of existing OLE and OCX objects is quickly feasible. This provides a wealth of existing code for usage on the Web. As well as the code, there are any number of OLE/OCX programmers whose expertise is therefore instantly applicable.

ActiveX objects can bedeveloped not only for usage with the WWW but for integration into any number of applications that support OLE. These include word processors, spreadsheets, database applications, etc.

Additionally, ActiveX's close ties to the Visual Basic development environments (both were created by Microsoft) allow for easily designed ActiveX controls. Visual Basic is also well known to numerous programmers already, meaning again that programmers skilled in it need not learn much more in order to be able to develop for ActiveX.


First and foremost, ActiveX is currently implemented only for Windows 95 and Windows NT. Additional implementations for Macintosh and Windows and 3.1 are in development by Microsoft, but are not fully functional. Microsoft's recent decision to release ActiveX to the Active Group, an industry-wide development test forum, may help partially to alleviate this platform dependence on the client side. However, Microsoft's refusal to release server-side development may severely hamper further platform support.

And, of course, ActiveX only works inline with Microsoft's own web browser, Internet Explorer. There are third-party solutions appearing to allow Navigator to use ActiveX, but Netscape does not intend to support it.

Despite the ability of ActiveX to use existing OLE/OCX objects, many of these objects were developed using C and C++ and often include direct hardware calls, severely compromising their usefulness on the Web.

Significantly, many corporations that are developing interactive Web applications are choosing Java over ActiveX. This limited industy support, combined with Microsoft's own embracing of Java technology, make ActiveX's future uncertain at best.

Case Studies

We couldn't find any ActiveX games that would run on any of our systems. Hopefully, ActiveX will be fully supported on more platforms soon.


Sun, in the Java white paper, describes Java as a "simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multi-threaded, and dynamic programming language." It began as an attempt to create a programming language, then called Oak, that could run on any of the numerous different platforms within the company. With the explosive growth of the World Wide Web, its developers realized that the cross-platform language would be ideal for Web applications.


Java is a compiled language, based on platform-independent byte codes, executed on the Java Virtual Machine. This increases its performance in terms of speed.

Its biggest advantage is that it can be run on both Netscape Navigator and MSIE, on any platform for which there exists a Java Development Kit. This includes Windows 95 and NT, Macintosh OS, and most major UNIX window systems. It does not currently include Windows 3.1, but Netscape has already pledged to support it in Navigator once a 3.1 JDK is released.

As for the Java Virtual Machines themselves, their most important feature is how seamlessly they fit into their respective operating systems. Specifically, the Java Abstract Windowing Toolkit allows for simple use of otherwise complicated OS components such as dialog boxes, windows, scroll bars, and so forth.

In sharp contrast to the lack of industry support enjoyed by ActiveX, Java has been embraced by most major computer corporations, as well as some electronics manufacturers, as an excellent starting point for all sorts of network applications.

It has been said that Java is essentially C++ with the object-oriented components "done right". Its close similarity to this language allows it to be learned with a minimum of effort by a maximum number of programmers who already know C++, an industry standard. Furthermore, there are uncountable C++ classes than could be simply converted into Java code.

Java includes in its design automatic garbage collection, dynamic variable declaration, and a complete lack of pointers. These by themselves eliminate the cause of the most common and insidious errors in C++, saving time and providing greater reliability.


Java, as stated before, doesn't run on Windows 3.1. This is just one operating system, yet it is still the one run by the majority of users.

Compared to JavaScript, Java is unwieldy in terms of disk space on the server, requiring a Java Development Kit, source code, and object code, and an HTML file, while JavaScript requires only the HTML file. ActiveX, of course, shares this problem.

The browsers themselves, in fact, have needed more memory as the Java Virtual Machine has been incorporated right into the application.

Case Studies

One sample game is called Gridlock and can be found on Riddler ( http://www.riddler.com/ ), a site featuring many professional-level Java games. The nice graphics, sophisticated user interface, quick response time, and head-to-head capability are representative of most Java games we tested, and showcase many of the language's capabilities.

Comparisons and Contrasts

Performance assessment

After long research of games already written for the Web, our initial impression was that most of the best games tested had been written in Java. To explain the reasons for this, we will revisit our application specifications and evaluate each language's strengths and weaknesses.


JavaScript has only simple graphics ability, relying on the image object's methods and attributes, which are limited. ActiveX could have a great deal of power to manipulate graphics, because it could be supported by full-fledged graphics libraries in OLE. However, few such are usable as yet. Java has extensive and efficient pre-established libraries, specifically the Abstract Windowing and Imaging Toolkits, which allow fast and sophisticated graphics and furthermore can be extended by the programmer.

Multiplayer head-to-head

Over the Web, this involves complicated juggling of TCP ports. JavaScript cannot open TCP ports, so it is restricted to single-user play. ActiveX, using OLE controls, would have to incorporate TCP functions written in another language, of which there are plenty. Java, however, has built-in support of TCP handling and even multiple threading, which is a complicated way of processing more than one data set at once, helping the cause of multiple users.

Worthiness, interest and playability

JavaScript is included directly in a page's HTML, but this limits its ability to change what is on the page. For output, it must either return a new page or use form input fields as output areas, which has to be considered a big kludge. Also, it can respond to mouse and keyboard events, but can't extend their behavior. ActiveX and Java have the same ability to heavily customize the user interface, putting up complicated layouts and extending the behavior of mouse and key events, but Java has proven itself whereas ActiveX is again hard to evaluate.

Platform- and browser-independence

JavaScript is supported by the two major browsers for all operating systems. ActiveX runs only on PCs under Windows 95 or NT. Java runs on every platform except for Windows 3.1. ActiveX and Java, furthermore, can run even outside browsers.


JavaScript has excellent security, because it cannot make use of any Internet communication outside of being served in straight HTTP. Java has well-written TCP socket functions, which if used right allow for good security -- now that the surprising number of security faults reported by beta users have been fixed. ActiveX has serious security concerns, as the user has no idea what OLEs are being executed and what sort of calls they might be making, which opens the door to data theft or more dangerous behaviors.

End User Impact and Conclusion

The most important criterion, in the end, will be how much game players enjoy games written in a given language. JavaScript games are able to reach the most users, followed closely by Java games, with ActiveX lagging well behind.

JavaScript games work fine, but there is not much interesting being done with them. ActiveX doesn't do much yet, but will probably become more relevant as Microsoft continues to pour money and effort into trying to take over the Internet.

Java games look good, run well, and there are a lot of them out there. In this case at least, it appears that the standard the industry is adopting is in fact the best choice.


"App Dev Tackles the Intranet". David S. Linthicum. Datamation, September 1996, pp. 113-118.
"Battle for the Internet Infrastructure". Jim Flynn. Datamation, May 1996, pp. 28-35.
"Getting Wired on HotJava". Michael Swaine. Dr. Dobb's Journal, October 1995, pp. 131-133
"A Hot Cup of Java". Andrew Singleton. Byte, April 1996, pp. 129-132.
"Inside the Netscape Navigator Platform". Richard Dragan and Thomas Mace. PC Magazine, October 8, `996, pp. 283-289.
"Java and Java Tools: Walking Up the Web". John Lam. PC Magazine, June 11, 1996, pp. 221-230.
"Java Programming with the Web". Jeff Prosise. PC Magazine, August 1996, pp. 279-284.
"Programming with Java". Jim Waldo. UNIX Review, May 1996, pp. 31-37.
"Sun Microsystems Inc.". David Bottoms. Internet World, December 10, 1995, pp. 36-38.
"Using JavaScript to Create Interactive Web Pages". Tom Tessier. Dr. Dobb's Journal, March 1996, pp. 84-97.
"Win '95, Lose '96?". Amy Cortese. Business Week, December 18, 1995, pp. 34-35.
"JavaScript Adventures". Rex Baldazo. Byte, August 1996, pp. 117-120.
Riddler WWW Site. URL: http://www.riddler.com
Gamelan WWW Site. URL: http://www.gamelan.com
JavaScript Handbook. URL: http://home.netscape.com/eng/mozilla/2.0/handbook/javascript/index.html

Steve Matuszek / UMBC / smatus1@gl.umbc.edu
Last updated Dec 27, 1996.