Platform/AreWeFunYet: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 126: Line 126:


'''TODO:''' fill this section
'''TODO:''' fill this section
IndexedDB is an API for client-side storage of significant amounts of structured data and for high performance searches on this data using indexes. While DOM Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.
IndexedDB provides separate APIs for synchronous and asynchronous access. The synchronous API is intended to be used inside workers.


* MDN Article: https://developer.mozilla.org/en/IndexedDB
* MDN Article: https://developer.mozilla.org/en/IndexedDB

Revision as of 20:35, 19 December 2011

The purpose of this page is to track progress of the open Web platform toward being ready for gaming, track browser implementation status, and compare to competing technologies.

The goal is twofold: make sure we keep in mind what game developers need; and inform game developers of the recent and ongoing progress made by the open Web platform.

By 'the Web platform' we mean technology that's implemented in multiple browsers (or will soon be): JavaScript and DOM APIs. The competition is proprietary or single-implementation platforms: proprietary plugins like Flash, Silverlight, JavaFX (?), the Unity3D plug-in, Google-only technology like NaCl, etc.

Desktop and console platforms are outside of the scope of this page. Perhaps it would still be useful to compare to Android / iOS application platforms as phone games are typically good candidates for doing as Web pages.

Each section of this page is about a feature that's required to enable gaming.

Fast code

Web technology: JavaScript

Competition:

  • ActionScript in Flash
  • C# in Silverlight

JavaScript has been speed up by orders of magnitude over the past few years.

Here is a benchmark comparing ActionScript to several JavaScript engines. It shows that as of June 2011, JavaScript is faster than Flash 10.3 in all major browsers.

TODO: Find/generate more benchmarks? At least update that one to include Flash 11 and the latest JS engines (Firefox 9 with TI) ?

Known Issues

Garbage collection pauses

The main bug to track in this respect is bug 619558: Generational GC. This should solve most of our problems in this area.

In order to maintain smoothness, talks at the New Game Conference discussed the need to minimize load on the JS garbage collector.

  • Improving the speed of GC or good incremental GC (see above bug, generational GC) could solve this.
  • This leads to reusing objects by assigning them to static/global variables.
  • Ability to manually free objects would also work.

Impact of other tabs

See bug 710359. In the web-gaming era, it will not be tolerable that just having a GMail tab on the side severely harms FPS in a game in another tab. This should have been solved by electrolysis ( = process separation), but it's on hold. We need to figure if electrolysis is the only thing to do about that, or if there are other things we can to to alleviate this in the short term.

Performance issues with large JS files

See bug 644244. Large JavaScript files (which are not uncommon in games) can in some cases run slowly. Some new benchmarks with large files might help here.

Fast/3D Graphics

Web technology: WebGL.

WebGL is enabled by default in Firefox (4+), Chrome (9+), Opera (12+) on all desktop operating systems and Android. It is available but not enabled by default in Safari 5.1, and available for ads on iOS.

Competition:

  • Stage3D in Flash 11
  • XNA 3D in Silverlight 5
  • Unity3D

The first two graphics APIs are very comparable since they stay very close to OpenGL ES 2.0 functionality (or Direct3D equivalent). WebGL has some extra flexibility and advanced features (more general shaders than Flash and Silverlight, bigger textures than Flash, etc). WebGL does not yet have compressed textures, however this is under discussion and an experimental extension has already been drafted.

There shouldn't exist any meaningful speed differences between these 3D APIs per se. Speed differences would more likely be caused by language/compiler differences (JS vs AS, etc).

Audio

TODO: fill this section

  • Mozilla has a Audio Data API; WebKit has Web Audio API; provide links; discuss ongoing convergence efforts?
    • Is our own Audio Data API really up to the task? 3D positional sound is a requirement.
  • implementation status in browsers?
  • equivalent in Flash, Silverlight?
  • Talks at New Game Conference pointed to WebKit's Web Audio API as the best of the existing solutions.
    • It has lower latency, and more powerful out-of-the-box.
  • Android Audio Notes has a transcript and links from a super informative discussion with Randall Jesup and Kinetik about the state of Android audio as of November, 2011.

FullScreen

This feature allows you to build a web application that runs full screen. This includes any HTML element so you can build full screen games, full interactive video experiences, presentation software or anything else that should dominate the experience.

MouseLock

Web technology: Mouse Lock API

The Mouse Lock API is currently under development by David Humphrey and his students at Seneca College. It is also under development in Chrome. This API is currently in W3C Draft Status.

Relevant links:

Gamepad

Web technology: GamepadAPI.

The Gamepad API is currently under development in Firefox and Chrome. Firefox builds are available for download here. Chromium builds need to have --enable-gamepad (?) passed on start-up. This API is currently in W3C draft status

Competition:

  • Nothing native. Only apps, like Xpadder that map gamepads to keyboard/mouse events.

Relevant links:

Keyboard input that ignores keyboard layouts

Many games use the WASD keys for direction control. However, depending on the active keyboard layout, their usual (US-layout) key places can be occupied by different letters. In the AZERTY keyboard layout, for example, these keys have the letters ZQSD, and in Dvorak {comma}AOE.

Users of those keyboard layouts shouldn't need to reconfigure their key mapping or change the system's keyboard layout. Instead, the game should be able to get a pressed key's absolute position on the keyboard, or its "scan code". Key events don't provide that information yet.

I'm not aware of any standardization effort on this.

Competition:

  • unknown

Relevant links:

Local file storage

TODO: fill this section

IndexedDB is an API for client-side storage of significant amounts of structured data and for high performance searches on this data using indexes. While DOM Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.

IndexedDB provides separate APIs for synchronous and asynchronous access. The synchronous API is intended to be used inside workers.

Asset loading/unloading/streaming

From a game developer: "A robust resource/asset loading/unloading/streaming system - The browser is capable of doing a whole lot on this end, particularly streaming and fetching from remote sources. However, a game developer's problem isn't just obtaining and loading the assets, it's managing them from a memory and "readyness" point of view. This is especially key in mobile spaces where you are severely constrained by memory and the traditional mindset of "load all of a level's assets at start and play" begins to break down."

Device orientation control

Ability to block, define and get informed when the device orientation changes. Basic use case is for a game that has to be played in landscape mode. The game should lock the orientation to landscape mode even if the device is currently in portrait mode.

TODO: fill this section

  • link to a spec for the web
  • equivalent in Flash, Silverlight, iOS, Android?

Game-oriented documentation

TODO: fill this section

  • Tutorials
  • Example games
  • Articles in Gamedev.net, Gamasutra, etc.