SlideShare a Scribd company logo
1 of 34
C++ on the Web:
Run your big 3D game in
the browser!
Quo Vadis 2013
Andre “Floh” Weissflog
Head of Development, Berlin
Bigpoint GmbH
Outline
2
WHY?
• Why now?
• Why C++?
• Why the web?
WHAT?
• emscripten
• flascc
• Google Native Client
HOW?
• Build system
• Workflow & Debugging
• Specific problems and solutions
Wrap-up & Questions
Why Now?
3
New technologies have become mature which cross-compile C++ code to
sandboxed runtime environments:
Adobe’s flascc
Mozilla’s emscripten
Google’s Native Client
C++
Why C++?
4
C++ is everywhere!
Why C++ continued…
5
• Support many target platforms from a single code base
• Nearly all professional game-dev middleware written in
C/C++
• Good for large code-bases (static type system, compiled
language, rock-solid compilers and debuggers)
• Cross-compiled C++ code is actually faster then typical
handwritten Javascript or ActionScript
Why OpenGL
6
GL is (nearly)
everywhere!
Why develop for the Web?
7
It’s the most friction-less platform for users AND developers:
Users:
• True “click-and-play”: No downloads, no installations, no patching.
• No security concerns (ideally): untrusted code runs sandboxed.
A truly open distribution platform for developers:
• no “walled gardens”
• no arbitrary certification process
• free choice of payment, hosting, “store-front” providers
No Vendor or Platform Lock-In !!
8
90% of your C++ code base will be platform-agnostic*
*(if done right)
Switch your target platform with a simple compile-switch!
• Consoles dying? Switch to PC!
• PC dying? Switch to mobile!
• Flash dying? Switch to HTML5!
You don’t need to “invest big” into the uncertain future of
a specific platform, C++ and OpenGL got your back.
Interlude: LLVM
9
LLVM is the magic sauce which makes C++ on the Web possible.
A highly modular and flexible compiler infrastructure.
Started in 2000 as OpenSource project.
1. Language front-ends compile source code to “LLVM bitcode”.
2. Generic optimizer passes work on bitcode.
3. Back-ends translate bitcode to “anything” (usually CPU native
instructions, but also VM byte code or different languages).
C/C++
ObjectiveC
GLSL
…
LLVM bitcode
x86
x64
ARM
AVM2
JS
Optimizer
Passes
Google Native Client (NaCl)
10
• Project started in 2008.
• Executes pre-compiled machine code safely in a sandbox.
• Integrated into web page with the object tag (similar to Flash SWFs).
• Currently CPU-specific “executables”, pNaCl aims to solve this problem.
• Only implemented in Google Chrome.
• Currently only enabled for Chrome Web Store apps.
• Not much hope that other browsers will ever adopt NaCl.
FOR: solid runtime and tools, full CPU performance, rich API and Middleware
support, full pthreads implementation
AGAINST: only on Chrome and Chrome Web Store
Adobe flascc
11
• Project started in 2008 as experimental “Adobe Alchemy”.
• Cross-compiles C++ code to AVM bytecode.
• Requires Flash plugin.
• Proprietary 3D API (Stage3D)
• Very slow translation of LLVM bitcode to AVM2 :(
FOR: 3D on IE, full access to Flash runtime environment
AGAINST: requires Flash plugin, extremely slow compilation process
Mozilla emscripten
12
• Project started in 2010.
• Cross-compiles C++ code to low level Javascript.
• Maps OpenGL to WebGL for 3D rendering.
• Rich support for standard APIs (SDL, OpenGL/ES2, EGL, GLUT, …).
• Custom WebWorker API instead of pthreads (more on that later).
• Compiler tools fast enough for large code bases.
• asm.js code generation mode (more on that later)
FOR: doesn’t require plugins, runs in all browsers (except WebGL), modern JS
engines “fast enough”
AGAINST: IE vs. WebGL, threaded code can’t simply be cross-compiled
emscripten FTW!
13
Will concentrate on emscripten from here on.
Why? (all IMHO of course):
• Everything about emscripten is completely open.
• Biggest “near future potential”.
• Extremely responsive and fast development team.
• Seamless integration into web page.
• It’s “fast enough” already, and getting still faster.
• asm.js!
BUT: all 3 technologies are very similar to port to.
Why is emscripten-generated JS fast?
14
emscripten is NOT a source-level translator from C++ to high-level JS!
C++ LLVM
Instead it translates LLVM bit code to Javascript which looks like “high-level assembly”:
.bc .jsemscripten
emscripten uses a big TypedArray as C/C++ memory heap.
RESULT:
• no objects, no properties
• no dynamic typing
• just functions, numbers and local variables
• no garbage collection!
• LLVM optimization passes!
Emscripten generated JS (minified)
What’s up with asm.js?
15
From the spec: a strict subset of JavaScript that can be used as a low-
level, efficient target language for compilers.
Formalizes the subset of JS generated by emscripten and similar
JavaScript generators, BUT is still standard Javascript.
How fast?
Within 2xof native code (gcc –O2), and
performance is much more consistent.
Good performance in standard JS engines, big performance boost in
asm.js aware JS engines (e.g. in Firefox Nightly).
If your game is GPU bound, CPU performance isn’t really that important.
In our experiments, “CPU speed” is fast enough even without asm.js, it’s WebGL
and the GPU that really matters.
But no matter whether asm.js is specifically optimized by an JS engine:
Platform-dependent components of a 3D Game Engine
16
Build System
Memory Management
Asset Loading
Input
3D Rendering
Audio
Networking
Threading
Timing
Game Loop
Let’s look at those one by one (in no particular order)
Interlude: CMake
17
Cmake is a meta-build-system: create build files for many platforms and IDEs
from a single set of project description files (CMakeLists.txt)
CMakeLists.txt
make
Setting up GCC-style cross-
compiling is really trivial with
CMake. NaCl
emscripten’s Build System
18
What emscripten provides:
• gcc compatible drop-in tools (emcc, em++, emar, …)
• system headers
• system libs
• hello_world.cpp, and lots of other samples
What you provide:
• Makefiles which invoke emcc instead of gcc (easily generated with a “cmake
toolchain file”)
Only 3 things are important in a cross-compiling scenario:
• The right compiler is called.
• The right headers are included.
• The right libs are linked.
Make sure that the cross-compiling SDK’s compiler, headers and libs are
used, not the host system’s native files!
emscripten is very fool-proof about using the right headers and linking against the right libs.
Workflow & Debugging Tips
19
Make sure your app compiles and runs also as normal OSX or Windows app!
Do your normal development work and debugging on this native desktop
version inside XCode or Visual Studio, this gives you the best turnaround
times and debugging experience.
Only fallback to “low level debugging” for bugs in emscripten-specific code.
Having said that, low-level debugging of emscripten-generated JS isn’t
that bad: function __ZNK9Graphics215CameraComponent14GetViewFrustumEv($this)
{
var label = 0;
var $1;
$1=$this;
var $2=$1;
var $3=(($2+12)|0);
var $4=__ZNK6Shared14CameraSettings14GetViewFrustumEv($3);
return $4;
}
Inject log messages directly into JS without recompiling, make use of the
browser’s Javascript debugger and profiler, etc…
emscripten Memory Management
20
emscripten uses a single, big TypedArray with multiple views as heap for the C/C++ code:
var buffer = new ArrayBuffer(TOTAL_MEMORY);
HEAP8 = new Int8Array(buffer);
HEAP16 = new Int16Array(buffer);
HEAP32 = new Int32Array(buffer);
HEAPU8 = new Uint8Array(buffer);
HEAPU16 = new Uint16Array(buffer);
HEAPU32 = new Uint32Array(buffer);
HEAPF32 = new Float32Array(buffer);
HEAPF64 = new Float64Array(buffer);
Pointers are actually indices into this typed array
emscripten links against dlmalloc.c to for malloc()/free()
From a C/C++ programmer’s perspective, dynamic memory management
isn’t different from other platforms. Just don’t spam malloc()/free() and be
aware of memory fragmentation.
Input Handling and Timing
21
emscripten offers mouse / keyboard input support through the GLUT,
GLFW and SDL library wrappers.
If your code already sits on top of GLUT, GLFW or SDL, you don’t need to do
anything.
Otherwise it’s trivial to add minimal wrapper code interfacing those APIs just
for input.
Nebula3 currently uses GLUT code to setup the display and handle input, the
emscripten team recommends to use SDL though, since it is used more
broadly.
For timing, emscripten has a simple function emscripten_get_now() which
returns a float number in milliseconds.
EASY!
Break up your Game Loop!
22
Your Javascript code runs inside a per-frame callback during the “browser loop”,
and there’s no way around it.
Spending too much time in your code will affect the whole browser (sluggish
behaviour, freezes, eventually the browser will kill your page).
YOU CANNOT OWN THE GAME LOOP!
NEVER BLOCK FOR MORE THEN A FEW DOZEN
MILLISECONDS
You may have to rethink your high-level application
model to solve this problem. Always return after XX
milliseconds to the browser, and split expensive work
into pieces, and/or move to WebWorker threads!
The Flash guys had to solve the same problem many years ago, google for “Elastic
Racetrack” and “Marshaled Slices”.
Break up your Game Loop, Nebula3 style
23
Nebula3 uses a “PhasedApplication” model, app goes through states/phases which tick
themselves forward when phase is finished.
Individual per-frame-callbacks should return within 16 or 32 milliseconds, and never block.
Expensive (init) work is distributed across several frames.
OnInitial
OnPreloading
OnOpening
OnRunning
OnClosing
OnQuit
OnFrame
(dispatch)
BrowserBrowser
<16ms or <32ms
Multithreading / Parallelism
24
This can be tricky since emscripten doesn’t support pthreads.
OMG WHY? ...because JavaScript.
JS doesn’t allow shared state between “threads”.
WebWorkers to the rescue!
WebWorkers implement a simple, high level parallel-task system.
Request
Reponse
Worker ThreadBrowser Thread
Good thing about WebWorkers: it’s really hard to shoot yourself in the foot.
Because: no mutexes, no crit-sects, no cond-vars, no atomic-ops…
Multithreading porting strategies
25
So what about your existing multithreading code?
Option 1: slice it into frames and call an UpdateThread() method
from main loop:
Before After
No multithreading, everything runs on the browser thread now 
But useful to get your code up and running quickly.
Only option if your code absolutely relies on shared state.
Multithreading porting strategies
26
Option 2: move to web workers (preferred)
Before After
Watch the overhead of getting data in/out of web worker!
Worker code must reside in its own .js, and has its own address
space, so don’t pass pointers around.
Workers have limited runtime
environment (no DOM access, no
GL, …
Asset Loading
27
There’s The Easy Way, and The Right Way to load assets.
But (big BUT):
1. Preload all files from HTTP server and map them into “virtual file
system” in RAM.
2. Use fopen / fread / fclose to read data synchronously.
emscripten makes this approach extremely easy, and you don’t need
to change your existing loader code.
The Easy Way
Big monolithic asset download required before your app can start.
Not very user friendly, and may be impossible with big games.
Asset Loading
28
Implement “HTTP file system” which asynchronously downloads
files from web server on demand.
The Right Way
Engine must be able to handle asynchronous loading for all file
types: up to several seconds until data is available.
Can’t simply block until data is downloaded! The whole browser will
block too and eventually kill the page.
Just think of the web as an extremely slow and unreliable HDD
or DVD.
emscripten has several C wrapper functions to start downloading
data from an URL, with callbacks when succeeded / failed, uses
XMLHttpRequest inside.
Networking / Multiplayer
29
This is the bleeding edge
Not much personal experience with this yet, but some pointers:
WebSockets are widely available, but sorta suck (esp. for action
games).
WebRTC data channels offer UDP- and TCP-based, peer-to-peer
messaging. Much better but not yet standardized across browsers.
emscripten wraps both WebSockets and WebRTC, and has a working
ENET port (http://enet.bespin.org/).
Audio
30
This is another area full of pain:
<audio> tag vs WebAudio
The <audio> tag is fundamentally broken and hopefully dies a painful death:
• Browsers either support MP3 or Ogg Vorbis, but not both
• Designed for simple web pages, but not demanding 3D games.
WebAudio is (hopefully) the future, but currently only supported in Chrome
and Firefox Nightly.
Web Apps will have to rely on ugly hacks and workarounds for the
foreseeable future.
emscripten has SDL Audio (based on <audio> tag), and OpenAL (based on
WebAudio).
3D Rendering
31
OpenGL ES2 support is really good in emscripten. If
you code is already running on mobile platforms,
you’re ready to go.
GL context setup via GLUT, SDL, GLFW or EGL, your choice.
DXT texture format transparently exposed through extension, but
beware of PowerVR on mobile platforms!
WebGL has higher function call overhead than native OpenGL, so
reducing number of GL calls is important.
In Firefox and Chrome on Windows, WebGL is actually translated to
Direct3D9 (surprisingly fast!).
Wrap-up
32
• You can run big C/C++ code bases (“a million lines of code”) in the browser.
• Javascript is already fast enough for many types of games.
• Massive performance improvements happening right now (better code
generation, JS engines better at running generated code, asm.js…)
• Development moves fast in the browser world, but standardization is slow.
• Audio and Networking in the browser is still a pain.
• WebGL is here to stay.
Tech Blog: http://flohofwoe.blogspot.com
Demos: http://www.flohofwoe.net/demos.html
Questions?
Thanks!
33
Find us on
Bigpoint GmbH
Andre Weissflog
Head of Development, Berlin
Drehbahn 47-48
20354 Hamburg
Germany
Tel +49 40.88 14 13 - 0
Fax +49 40.88 14 13 - 11
info@bigpoint.net
www.bigpoint.net
34

More Related Content

What's hot

apply() talk - Sarah Catanzaro (Amplify Partners).pdf
apply() talk - Sarah Catanzaro (Amplify Partners).pdfapply() talk - Sarah Catanzaro (Amplify Partners).pdf
apply() talk - Sarah Catanzaro (Amplify Partners).pdfSarahCatanzaro1
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotXiang Fu
 
Introduction à Neo4j
Introduction à Neo4jIntroduction à Neo4j
Introduction à Neo4jNeo4j
 
Building Better Data Pipelines using Apache Airflow
Building Better Data Pipelines using Apache AirflowBuilding Better Data Pipelines using Apache Airflow
Building Better Data Pipelines using Apache AirflowSid Anand
 
Presto Summit 2018 - 09 - Netflix Iceberg
Presto Summit 2018  - 09 - Netflix IcebergPresto Summit 2018  - 09 - Netflix Iceberg
Presto Summit 2018 - 09 - Netflix Icebergkbajda
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoopclairvoyantllc
 
Improving Apache Spark for Dynamic Allocation and Spot Instances
Improving Apache Spark for Dynamic Allocation and Spot InstancesImproving Apache Spark for Dynamic Allocation and Spot Instances
Improving Apache Spark for Dynamic Allocation and Spot InstancesDatabricks
 
Delta Lake, un vernis pour parquet
Delta Lake, un vernis pour parquetDelta Lake, un vernis pour parquet
Delta Lake, un vernis pour parquetAlban Phélip
 
Advancing your data science career
Advancing your data science careerAdvancing your data science career
Advancing your data science careerAlexey Grigorev
 
2021 04-20 apache arrow and its impact on the database industry.pptx
2021 04-20  apache arrow and its impact on the database industry.pptx2021 04-20  apache arrow and its impact on the database industry.pptx
2021 04-20 apache arrow and its impact on the database industry.pptxAndrew Lamb
 
Premier Inside-Out: Apache Druid
Premier Inside-Out: Apache DruidPremier Inside-Out: Apache Druid
Premier Inside-Out: Apache DruidHortonworks
 
LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드Tae Young Lee
 
Efficient Data Formats for Analytics with Parquet and Arrow
Efficient Data Formats for Analytics with Parquet and ArrowEfficient Data Formats for Analytics with Parquet and Arrow
Efficient Data Formats for Analytics with Parquet and ArrowDataWorks Summit/Hadoop Summit
 
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...Cloudera, Inc.
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkDatabricks
 
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...Zalando Technology
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Flink Forward
 
Neo4j et ses cas d'usages
Neo4j et ses cas d'usagesNeo4j et ses cas d'usages
Neo4j et ses cas d'usagesNeo4j
 

What's hot (20)

apply() talk - Sarah Catanzaro (Amplify Partners).pdf
apply() talk - Sarah Catanzaro (Amplify Partners).pdfapply() talk - Sarah Catanzaro (Amplify Partners).pdf
apply() talk - Sarah Catanzaro (Amplify Partners).pdf
 
Real-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache PinotReal-time Analytics with Trino and Apache Pinot
Real-time Analytics with Trino and Apache Pinot
 
Introduction à Neo4j
Introduction à Neo4jIntroduction à Neo4j
Introduction à Neo4j
 
Building Better Data Pipelines using Apache Airflow
Building Better Data Pipelines using Apache AirflowBuilding Better Data Pipelines using Apache Airflow
Building Better Data Pipelines using Apache Airflow
 
Sql Antipatterns Strike Back
Sql Antipatterns Strike BackSql Antipatterns Strike Back
Sql Antipatterns Strike Back
 
Presto Summit 2018 - 09 - Netflix Iceberg
Presto Summit 2018  - 09 - Netflix IcebergPresto Summit 2018  - 09 - Netflix Iceberg
Presto Summit 2018 - 09 - Netflix Iceberg
 
Running Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on HadoopRunning Airflow Workflows as ETL Processes on Hadoop
Running Airflow Workflows as ETL Processes on Hadoop
 
Improving Apache Spark for Dynamic Allocation and Spot Instances
Improving Apache Spark for Dynamic Allocation and Spot InstancesImproving Apache Spark for Dynamic Allocation and Spot Instances
Improving Apache Spark for Dynamic Allocation and Spot Instances
 
Delta Lake, un vernis pour parquet
Delta Lake, un vernis pour parquetDelta Lake, un vernis pour parquet
Delta Lake, un vernis pour parquet
 
Advancing your data science career
Advancing your data science careerAdvancing your data science career
Advancing your data science career
 
2021 04-20 apache arrow and its impact on the database industry.pptx
2021 04-20  apache arrow and its impact on the database industry.pptx2021 04-20  apache arrow and its impact on the database industry.pptx
2021 04-20 apache arrow and its impact on the database industry.pptx
 
Premier Inside-Out: Apache Druid
Premier Inside-Out: Apache DruidPremier Inside-Out: Apache Druid
Premier Inside-Out: Apache Druid
 
LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드LLM 모델 기반 서비스 실전 가이드
LLM 모델 기반 서비스 실전 가이드
 
Efficient Data Formats for Analytics with Parquet and Arrow
Efficient Data Formats for Analytics with Parquet and ArrowEfficient Data Formats for Analytics with Parquet and Arrow
Efficient Data Formats for Analytics with Parquet and Arrow
 
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
 
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
 
Quantum Fourier Transform
Quantum Fourier TransformQuantum Fourier Transform
Quantum Fourier Transform
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
 
Neo4j et ses cas d'usages
Neo4j et ses cas d'usagesNeo4j et ses cas d'usages
Neo4j et ses cas d'usages
 

Viewers also liked

Minko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.jsMinko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.jsMinko3D
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindBeMyApp
 
Informatica 1_1_.pdf;filename_= utf-8''informatica_(1)[1]
Informatica  1_1_.pdf;filename_= utf-8''informatica_(1)[1]Informatica  1_1_.pdf;filename_= utf-8''informatica_(1)[1]
Informatica 1_1_.pdf;filename_= utf-8''informatica_(1)[1]CARLOS VIERA
 
Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4
Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4
Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4khair20
 
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for CodersEast Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for CodersGerke Max Preussner
 
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...Mary Chan
 
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...Gerke Max Preussner
 
East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4
East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4
East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4Gerke Max Preussner
 
GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++Gerke Max Preussner
 
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...Gerke Max Preussner
 
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...Gerke Max Preussner
 
Cross platform web app development
Cross platform web app developmentCross platform web app development
Cross platform web app developmenttomasperezv
 
Unreal conference slides
Unreal conference slidesUnreal conference slides
Unreal conference slidesCharles Schultz
 
NDC2015 멘탈레이 라이팅 튜토리얼
NDC2015 멘탈레이 라이팅 튜토리얼NDC2015 멘탈레이 라이팅 튜토리얼
NDC2015 멘탈레이 라이팅 튜토리얼Wuwon Yu
 
Next generation mobile gp us and rendering techniques - niklas smedberg
Next generation mobile gp us and rendering techniques - niklas smedbergNext generation mobile gp us and rendering techniques - niklas smedberg
Next generation mobile gp us and rendering techniques - niklas smedbergMary Chan
 

Viewers also liked (20)

Minko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.jsMinko - Build WebGL applications with C++ and asm.js
Minko - Build WebGL applications with C++ and asm.js
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mind
 
UTF-8
UTF-8UTF-8
UTF-8
 
Informatica 1_1_.pdf;filename_= utf-8''informatica_(1)[1]
Informatica  1_1_.pdf;filename_= utf-8''informatica_(1)[1]Informatica  1_1_.pdf;filename_= utf-8''informatica_(1)[1]
Informatica 1_1_.pdf;filename_= utf-8''informatica_(1)[1]
 
Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4
Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4
Muslim rule lect_4.ppt_filename_= utf-8''muslim rule lect 4
 
Three Optimization Tips for C++
Three Optimization Tips for C++Three Optimization Tips for C++
Three Optimization Tips for C++
 
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for CodersEast Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
East Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders
 
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
 
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
West Coast DevCon 2014: Concurrency & Parallelism in UE4 - Tips for programmi...
 
East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4
East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4
East Coast DevCon 2014: Engine Overview - A Programmer’s Glimpse at UE4
 
GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++
 
Docker
DockerDocker
Docker
 
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
West Coast DevCon 2014: Extensibility in UE4 - Customizing Your Games and the...
 
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
 
Alexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal EngineAlexey Savchenko, Unreal Engine
Alexey Savchenko, Unreal Engine
 
Cross platform web app development
Cross platform web app developmentCross platform web app development
Cross platform web app development
 
Unreal conference slides
Unreal conference slidesUnreal conference slides
Unreal conference slides
 
NDC2015 멘탈레이 라이팅 튜토리얼
NDC2015 멘탈레이 라이팅 튜토리얼NDC2015 멘탈레이 라이팅 튜토리얼
NDC2015 멘탈레이 라이팅 튜토리얼
 
Next generation mobile gp us and rendering techniques - niklas smedberg
Next generation mobile gp us and rendering techniques - niklas smedbergNext generation mobile gp us and rendering techniques - niklas smedberg
Next generation mobile gp us and rendering techniques - niklas smedberg
 

Similar to C++ on the Web: Run your big 3D game in the browser

WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014Minko3D
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1Sisir Ghosh
 
mloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentmloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentDavid Galeano
 
TestUpload
TestUploadTestUpload
TestUploadZarksaDS
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll buildMark Stoodley
 
Minko - Flash Conference #5
Minko - Flash Conference #5Minko - Flash Conference #5
Minko - Flash Conference #5Minko3D
 
Source vs object code
Source vs object codeSource vs object code
Source vs object codeSana Ullah
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?Albert Mietus
 
Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...Minko3D
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko3D
 
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...Embarcados
 
Emscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScriptEmscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScript穎睿 梁
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assemblyShakacon
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application DevelopmentRamesh Prasad
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 

Similar to C++ on the Web: Run your big 3D game in the browser (20)

WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014WebGL games with Minko - Next Game Frontier 2014
WebGL games with Minko - Next Game Frontier 2014
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
 
Php on Windows
Php on WindowsPhp on Windows
Php on Windows
 
Asm.js introduction
Asm.js introductionAsm.js introduction
Asm.js introduction
 
mloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentmloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game development
 
TestUpload
TestUploadTestUpload
TestUpload
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Os Lattner
Os LattnerOs Lattner
Os Lattner
 
Minko - Flash Conference #5
Minko - Flash Conference #5Minko - Flash Conference #5
Minko - Flash Conference #5
 
Source vs object code
Source vs object codeSource vs object code
Source vs object code
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
 
Where should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and moreWhere should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and more
 
Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...Paris Android User Group - Build 3D web, mobile and desktop applications with...
Paris Android User Group - Build 3D web, mobile and desktop applications with...
 
Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013Minko - Windows App Meetup Nov. 2013
Minko - Windows App Meetup Nov. 2013
 
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
 
Emscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScriptEmscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScript
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 

Recently uploaded

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

C++ on the Web: Run your big 3D game in the browser

  • 1. C++ on the Web: Run your big 3D game in the browser! Quo Vadis 2013 Andre “Floh” Weissflog Head of Development, Berlin Bigpoint GmbH
  • 2. Outline 2 WHY? • Why now? • Why C++? • Why the web? WHAT? • emscripten • flascc • Google Native Client HOW? • Build system • Workflow & Debugging • Specific problems and solutions Wrap-up & Questions
  • 3. Why Now? 3 New technologies have become mature which cross-compile C++ code to sandboxed runtime environments: Adobe’s flascc Mozilla’s emscripten Google’s Native Client C++
  • 4. Why C++? 4 C++ is everywhere!
  • 5. Why C++ continued… 5 • Support many target platforms from a single code base • Nearly all professional game-dev middleware written in C/C++ • Good for large code-bases (static type system, compiled language, rock-solid compilers and debuggers) • Cross-compiled C++ code is actually faster then typical handwritten Javascript or ActionScript
  • 6. Why OpenGL 6 GL is (nearly) everywhere!
  • 7. Why develop for the Web? 7 It’s the most friction-less platform for users AND developers: Users: • True “click-and-play”: No downloads, no installations, no patching. • No security concerns (ideally): untrusted code runs sandboxed. A truly open distribution platform for developers: • no “walled gardens” • no arbitrary certification process • free choice of payment, hosting, “store-front” providers
  • 8. No Vendor or Platform Lock-In !! 8 90% of your C++ code base will be platform-agnostic* *(if done right) Switch your target platform with a simple compile-switch! • Consoles dying? Switch to PC! • PC dying? Switch to mobile! • Flash dying? Switch to HTML5! You don’t need to “invest big” into the uncertain future of a specific platform, C++ and OpenGL got your back.
  • 9. Interlude: LLVM 9 LLVM is the magic sauce which makes C++ on the Web possible. A highly modular and flexible compiler infrastructure. Started in 2000 as OpenSource project. 1. Language front-ends compile source code to “LLVM bitcode”. 2. Generic optimizer passes work on bitcode. 3. Back-ends translate bitcode to “anything” (usually CPU native instructions, but also VM byte code or different languages). C/C++ ObjectiveC GLSL … LLVM bitcode x86 x64 ARM AVM2 JS Optimizer Passes
  • 10. Google Native Client (NaCl) 10 • Project started in 2008. • Executes pre-compiled machine code safely in a sandbox. • Integrated into web page with the object tag (similar to Flash SWFs). • Currently CPU-specific “executables”, pNaCl aims to solve this problem. • Only implemented in Google Chrome. • Currently only enabled for Chrome Web Store apps. • Not much hope that other browsers will ever adopt NaCl. FOR: solid runtime and tools, full CPU performance, rich API and Middleware support, full pthreads implementation AGAINST: only on Chrome and Chrome Web Store
  • 11. Adobe flascc 11 • Project started in 2008 as experimental “Adobe Alchemy”. • Cross-compiles C++ code to AVM bytecode. • Requires Flash plugin. • Proprietary 3D API (Stage3D) • Very slow translation of LLVM bitcode to AVM2 :( FOR: 3D on IE, full access to Flash runtime environment AGAINST: requires Flash plugin, extremely slow compilation process
  • 12. Mozilla emscripten 12 • Project started in 2010. • Cross-compiles C++ code to low level Javascript. • Maps OpenGL to WebGL for 3D rendering. • Rich support for standard APIs (SDL, OpenGL/ES2, EGL, GLUT, …). • Custom WebWorker API instead of pthreads (more on that later). • Compiler tools fast enough for large code bases. • asm.js code generation mode (more on that later) FOR: doesn’t require plugins, runs in all browsers (except WebGL), modern JS engines “fast enough” AGAINST: IE vs. WebGL, threaded code can’t simply be cross-compiled
  • 13. emscripten FTW! 13 Will concentrate on emscripten from here on. Why? (all IMHO of course): • Everything about emscripten is completely open. • Biggest “near future potential”. • Extremely responsive and fast development team. • Seamless integration into web page. • It’s “fast enough” already, and getting still faster. • asm.js! BUT: all 3 technologies are very similar to port to.
  • 14. Why is emscripten-generated JS fast? 14 emscripten is NOT a source-level translator from C++ to high-level JS! C++ LLVM Instead it translates LLVM bit code to Javascript which looks like “high-level assembly”: .bc .jsemscripten emscripten uses a big TypedArray as C/C++ memory heap. RESULT: • no objects, no properties • no dynamic typing • just functions, numbers and local variables • no garbage collection! • LLVM optimization passes! Emscripten generated JS (minified)
  • 15. What’s up with asm.js? 15 From the spec: a strict subset of JavaScript that can be used as a low- level, efficient target language for compilers. Formalizes the subset of JS generated by emscripten and similar JavaScript generators, BUT is still standard Javascript. How fast? Within 2xof native code (gcc –O2), and performance is much more consistent. Good performance in standard JS engines, big performance boost in asm.js aware JS engines (e.g. in Firefox Nightly). If your game is GPU bound, CPU performance isn’t really that important. In our experiments, “CPU speed” is fast enough even without asm.js, it’s WebGL and the GPU that really matters. But no matter whether asm.js is specifically optimized by an JS engine:
  • 16. Platform-dependent components of a 3D Game Engine 16 Build System Memory Management Asset Loading Input 3D Rendering Audio Networking Threading Timing Game Loop Let’s look at those one by one (in no particular order)
  • 17. Interlude: CMake 17 Cmake is a meta-build-system: create build files for many platforms and IDEs from a single set of project description files (CMakeLists.txt) CMakeLists.txt make Setting up GCC-style cross- compiling is really trivial with CMake. NaCl
  • 18. emscripten’s Build System 18 What emscripten provides: • gcc compatible drop-in tools (emcc, em++, emar, …) • system headers • system libs • hello_world.cpp, and lots of other samples What you provide: • Makefiles which invoke emcc instead of gcc (easily generated with a “cmake toolchain file”) Only 3 things are important in a cross-compiling scenario: • The right compiler is called. • The right headers are included. • The right libs are linked. Make sure that the cross-compiling SDK’s compiler, headers and libs are used, not the host system’s native files! emscripten is very fool-proof about using the right headers and linking against the right libs.
  • 19. Workflow & Debugging Tips 19 Make sure your app compiles and runs also as normal OSX or Windows app! Do your normal development work and debugging on this native desktop version inside XCode or Visual Studio, this gives you the best turnaround times and debugging experience. Only fallback to “low level debugging” for bugs in emscripten-specific code. Having said that, low-level debugging of emscripten-generated JS isn’t that bad: function __ZNK9Graphics215CameraComponent14GetViewFrustumEv($this) { var label = 0; var $1; $1=$this; var $2=$1; var $3=(($2+12)|0); var $4=__ZNK6Shared14CameraSettings14GetViewFrustumEv($3); return $4; } Inject log messages directly into JS without recompiling, make use of the browser’s Javascript debugger and profiler, etc…
  • 20. emscripten Memory Management 20 emscripten uses a single, big TypedArray with multiple views as heap for the C/C++ code: var buffer = new ArrayBuffer(TOTAL_MEMORY); HEAP8 = new Int8Array(buffer); HEAP16 = new Int16Array(buffer); HEAP32 = new Int32Array(buffer); HEAPU8 = new Uint8Array(buffer); HEAPU16 = new Uint16Array(buffer); HEAPU32 = new Uint32Array(buffer); HEAPF32 = new Float32Array(buffer); HEAPF64 = new Float64Array(buffer); Pointers are actually indices into this typed array emscripten links against dlmalloc.c to for malloc()/free() From a C/C++ programmer’s perspective, dynamic memory management isn’t different from other platforms. Just don’t spam malloc()/free() and be aware of memory fragmentation.
  • 21. Input Handling and Timing 21 emscripten offers mouse / keyboard input support through the GLUT, GLFW and SDL library wrappers. If your code already sits on top of GLUT, GLFW or SDL, you don’t need to do anything. Otherwise it’s trivial to add minimal wrapper code interfacing those APIs just for input. Nebula3 currently uses GLUT code to setup the display and handle input, the emscripten team recommends to use SDL though, since it is used more broadly. For timing, emscripten has a simple function emscripten_get_now() which returns a float number in milliseconds. EASY!
  • 22. Break up your Game Loop! 22 Your Javascript code runs inside a per-frame callback during the “browser loop”, and there’s no way around it. Spending too much time in your code will affect the whole browser (sluggish behaviour, freezes, eventually the browser will kill your page). YOU CANNOT OWN THE GAME LOOP! NEVER BLOCK FOR MORE THEN A FEW DOZEN MILLISECONDS You may have to rethink your high-level application model to solve this problem. Always return after XX milliseconds to the browser, and split expensive work into pieces, and/or move to WebWorker threads! The Flash guys had to solve the same problem many years ago, google for “Elastic Racetrack” and “Marshaled Slices”.
  • 23. Break up your Game Loop, Nebula3 style 23 Nebula3 uses a “PhasedApplication” model, app goes through states/phases which tick themselves forward when phase is finished. Individual per-frame-callbacks should return within 16 or 32 milliseconds, and never block. Expensive (init) work is distributed across several frames. OnInitial OnPreloading OnOpening OnRunning OnClosing OnQuit OnFrame (dispatch) BrowserBrowser <16ms or <32ms
  • 24. Multithreading / Parallelism 24 This can be tricky since emscripten doesn’t support pthreads. OMG WHY? ...because JavaScript. JS doesn’t allow shared state between “threads”. WebWorkers to the rescue! WebWorkers implement a simple, high level parallel-task system. Request Reponse Worker ThreadBrowser Thread Good thing about WebWorkers: it’s really hard to shoot yourself in the foot. Because: no mutexes, no crit-sects, no cond-vars, no atomic-ops…
  • 25. Multithreading porting strategies 25 So what about your existing multithreading code? Option 1: slice it into frames and call an UpdateThread() method from main loop: Before After No multithreading, everything runs on the browser thread now  But useful to get your code up and running quickly. Only option if your code absolutely relies on shared state.
  • 26. Multithreading porting strategies 26 Option 2: move to web workers (preferred) Before After Watch the overhead of getting data in/out of web worker! Worker code must reside in its own .js, and has its own address space, so don’t pass pointers around. Workers have limited runtime environment (no DOM access, no GL, …
  • 27. Asset Loading 27 There’s The Easy Way, and The Right Way to load assets. But (big BUT): 1. Preload all files from HTTP server and map them into “virtual file system” in RAM. 2. Use fopen / fread / fclose to read data synchronously. emscripten makes this approach extremely easy, and you don’t need to change your existing loader code. The Easy Way Big monolithic asset download required before your app can start. Not very user friendly, and may be impossible with big games.
  • 28. Asset Loading 28 Implement “HTTP file system” which asynchronously downloads files from web server on demand. The Right Way Engine must be able to handle asynchronous loading for all file types: up to several seconds until data is available. Can’t simply block until data is downloaded! The whole browser will block too and eventually kill the page. Just think of the web as an extremely slow and unreliable HDD or DVD. emscripten has several C wrapper functions to start downloading data from an URL, with callbacks when succeeded / failed, uses XMLHttpRequest inside.
  • 29. Networking / Multiplayer 29 This is the bleeding edge Not much personal experience with this yet, but some pointers: WebSockets are widely available, but sorta suck (esp. for action games). WebRTC data channels offer UDP- and TCP-based, peer-to-peer messaging. Much better but not yet standardized across browsers. emscripten wraps both WebSockets and WebRTC, and has a working ENET port (http://enet.bespin.org/).
  • 30. Audio 30 This is another area full of pain: <audio> tag vs WebAudio The <audio> tag is fundamentally broken and hopefully dies a painful death: • Browsers either support MP3 or Ogg Vorbis, but not both • Designed for simple web pages, but not demanding 3D games. WebAudio is (hopefully) the future, but currently only supported in Chrome and Firefox Nightly. Web Apps will have to rely on ugly hacks and workarounds for the foreseeable future. emscripten has SDL Audio (based on <audio> tag), and OpenAL (based on WebAudio).
  • 31. 3D Rendering 31 OpenGL ES2 support is really good in emscripten. If you code is already running on mobile platforms, you’re ready to go. GL context setup via GLUT, SDL, GLFW or EGL, your choice. DXT texture format transparently exposed through extension, but beware of PowerVR on mobile platforms! WebGL has higher function call overhead than native OpenGL, so reducing number of GL calls is important. In Firefox and Chrome on Windows, WebGL is actually translated to Direct3D9 (surprisingly fast!).
  • 32. Wrap-up 32 • You can run big C/C++ code bases (“a million lines of code”) in the browser. • Javascript is already fast enough for many types of games. • Massive performance improvements happening right now (better code generation, JS engines better at running generated code, asm.js…) • Development moves fast in the browser world, but standardization is slow. • Audio and Networking in the browser is still a pain. • WebGL is here to stay. Tech Blog: http://flohofwoe.blogspot.com Demos: http://www.flohofwoe.net/demos.html
  • 34. Find us on Bigpoint GmbH Andre Weissflog Head of Development, Berlin Drehbahn 47-48 20354 Hamburg Germany Tel +49 40.88 14 13 - 0 Fax +49 40.88 14 13 - 11 info@bigpoint.net www.bigpoint.net 34