MDN/Development/Emscripten: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 20: Line 20:
Although Emscripten can be used to compile a number of different languages into JavaScript, it would make sense to start with C++, as that is the best supported and most useful target laguage for our current projects. The following quote from Jukka provides some good context for the purpose of these docs:
Although Emscripten can be used to compile a number of different languages into JavaScript, it would make sense to start with C++, as that is the best supported and most useful target laguage for our current projects. The following quote from Jukka provides some good context for the purpose of these docs:


<blockquote>My experience and perspective is mainly from the "Game developer who has written a native game in C/C++ for Android/iOS/PC and wants to port it to FxOS/browser" viewpoint. There, the process comes with the following questions, roughly in the following chronological learning order:</blockquote>
<blockquote>My experience and perspective is mainly from the "Game developer who has written a native game in C/C++ for Android/iOS/PC and wants to port it to FxOS/browser" viewpoint.</blockquote>


(feasibility/disbelief) 1. Web doesn't do 3D well and I know web is slow. Is this port even feasible? What kind of sacrifices will I have to do in my existing game in terms of performance? How does web compare to native Android/iOS/PC?
===Introducing Emscripten===


(feasibility/disbelief) 2. Which browsers can I target with emscripten? ff/chrome/ie/opera/safari? desktop and mobile?
An introduction to Emscripten, including how it works, how to get it set up and start wqorking with it, and some beginner's tutorials


(feasibility research) 3. My game uses C/C++ libraries/technologies X, Y and Z. Are these supported? What do I need to rewrite?
* What is Emscripten and how does it work?
**The nature of Emscripten compiled JS
* Your first steps with Emscripten
** Download and install
** Hello world


(feasibility research) 4. I am looking an alternative to library X, which I know isn't supported. Which C/C++ technologies can I use instead? Can C/C++ do everything, or do I need to write JS to implement X/Y/Z?
===Web abilities and limitations===


(adoption,familiarization) 5. How do I get hands-on experience with the toolchain? Where is that minimal GL rendering sample that shows how to get stuff up and running?
This could be a single article but may well be multiple articles under a single section as the document resource grows. The main purpose here is to provide native developers trying to research the feasibility of running their project on the web with some answers.


(r&d port attempt) 6. How do I work my existing build system X to target emscripten? How do I co-maintain both native and emscripten targets simultaneously?
* How does the web differ to runing native code?
** non-threading
** async main loop
** async file loading
** memory model
**networking
** performance
* Performance on the web
** How does it compare to native?
** What are the bottlenecks?
** 3D on the web is slow; how come?
** What kind of sacrifices need to be made when porting to the web, in terms of performance?
* Browser support for Emscripten compiled code
** What does Emscripten rely on?
** What browsers currently support this combination?
* C++ landscape support for Emscripten
** Common C++ libraries/technologies that Emscripten handles successfully
** Common C++ libraries/technologies that Emscripten doesn't handle so well
***What needs to be rewritten in C++
***What is better written from scratch on the JavaScript side?


(r&d port attempt) 7. How do I deploy and run my app on a mobile device?
===Integrating Emscripten into your workflow===


(r&d port attempt) 8. How do I do debugging?
As a native developer, how can I get up and running with Emscripten, including it as an additional development target that fits into my existing toolchain?


(r&d port attempt) 9. Where is the compiler and toolchain documentation? Where is the graphics/WebGL/GLES2 info I need to know?
* Emscripten in your development toolchain
** An ideal toolchain
** Other alternatives
** A minimal GL rendering sample that shows how to get stuff up and running?
* Emscripten in your build system
** Reworking your existing build system to target emscripten
** Co-maintaining both native and emscripten targets simultaneously
** Deploying and running your app on a mobile device
* Debugging Emscripten code output
 
===Techniques for working with Emscripten===
 
More detailed tutorials than you got with the hello world section in the introductory material.
 
===Reference documentation===
 
* Compiler reference
* Links to relevant C/C++ library documentation, with annoatations relevant to Emscripten usage
* Links to relevant JS/API documentation, with annotations relevant to Emscripten usage
* Links to other relevant docs - Graphics, GLES2?
* Links to relevant tool documentation


(disbelief/solving blockers) 10. I have learned about these hard problems (non-threading, async main loop, async file loading, memory model, networking, performance, ...) that I am now able to relate to my own codebase having attempted a port. What can I do? How do I architect around these problems?
(disbelief/solving blockers) 10. I have learned about these hard problems (non-threading, async main loop, async file loading, memory model, networking, performance, ...) that I am now able to relate to my own codebase having attempted a port. What can I do? How do I architect around these problems?
Confirmed users
228

edits

Navigation menu