Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've come across games that are 3D that are playable in a browser. They require a plugin to be installed to work. I guess the plugin creates a D3D window inside the browser.

How would I go about implementing something similar?

share|improve this question
interesting question – Notabene Jan 19 '11 at 10:50
up vote 7 down vote accepted

Unity web player (for windows) can use both DirectX and OpenGL in a window (however it abstracts your access to these APIs).

Another approach would be to implement a DirectX plugin using ActiveX (for Internet Explorer), or NPAPI (for other browsers).

If you use NPAPI, when your plugin starts up you'll receive a window handle where you can draw whatever you want (including a D3D window). If you go this route you're essentially running native code on the clients machines.

share|improve this answer
Note that the NPAPI is on its way to deprecation, so it's recommended that new web games use other technologies like WebGL (which is getting increasingly well-supported and does not require additional plugins) – DMGregory Jun 24 '15 at 12:50

The game you are playing might use WebGL, or something more exotic like a firefox plugin, but I don't think you can embed machine code in a firefox plugin (I'm not sure, that would be a little security flaw).

Unity implements a web plugin version of their engine, and it seems they do so with ActiveX. I don't know if it implements on Mac..., I wonder though.

The best way to find out how this game you are playing use a 3D API or any other kind of plugin stuff, is to look at the HTML source of the page, and look for object or activex or else.

share|improve this answer
Why the down vote? – CiscoIPPhone Jan 19 '11 at 15:04
For the ludicrous suggestion you can't "embed machine code in a firefox plugin." The entire point of plugins is to supplement web content with some set of "native" code. – user744 Jan 19 '11 at 15:28
well we can still discuss the dictionnary entries for addon, extension, plugin, mod, etc... It's still better to be precise about what does what... – jokoon Jan 19 '11 at 16:05
And "plugin" is exactly what has, since Netscape Navigator 2, referred to executing unsandboxed (native or otherwise) code on the client machine. – user744 Jan 19 '11 at 16:14
netscape navigator 2, are you talking about a car, some kind of SUV ? I don't see any connection with the question ... – jokoon Jan 19 '11 at 16:20

Check out Firebreath for Cross-broswer support.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.