Hands-On Game Development with WebAssembly : Learn WebAssembly C++ Programming by Building a Retro Space Game.
Within the next few years, WebAssembly will change the web as we know it. It promises a world where you can write an application for the web in any language you like, and compile it for native platforms as well as the web. This book gives the reader hands-on experience developing web applications an...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing, Limited,
2019.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Cover; Title Page; Copyright and Credits; Dedication; About Packt; Contributors; Table of Contents; Preface; Chapter 1: Introduction to WebAssembly and Emscripten; What is WebAssembly?; Why do we need WebAssembly?; Why is WebAssembly faster than JavaScript?; Will WebAssembly replace JavaScript?; What is asm.js?; A brief introduction to LLVM; A brief introduction to WebAssembly text; Emscripten; Installing Emscripten on Windows; Installing Emscripten on Ubuntu; Using Emscripten; Additional installation resources; Summary; Chapter 2: HTML5 and WebAssembly; The Emscripten minimal shell file
- Creating a new HTML shell and C fileDefining the CSS; HTML5 and game development; Immediate mode versus retained mode; Adding a canvas to the Emscripten template; Summary; Chapter 3: Introduction to WebGL; WebGL and canvas contexts; An introduction to WebGL shaders; WebGL and JavaScript; WebGL coordinate system versus 2D canvas; Vertex and UV data; 2D canvas to WebGL; Minor tweaks to the head tag; Major JavaScript changes; WebGL global variables; The return of vertex and texture data; Buffer constants; Defining the shaders; The ModuleLoaded function; The ShipPosition function
- The MoveShip functionSummary; Chapter 4: Sprite Animations in WebAssembly with SDL; Using SDL in WebAssembly; Initializing SDL; Clearing the SDL renderer; Using the WebAssembly virtual filesystem; Rendering a texture to the HTML5 canvas; Cleaning up SDL; Compiling hello_sdl.html; Render a sprite to the canvas; Animating a sprite; Moving the sprite; Compiling sprite.html; Summary; Chapter 5: Keyboard Input; JavaScript keyboard input; Adding SDL keyboard input to WebAssembly; Using keyboard input to move a sprite; Summary; Chapter 6: Game Objects and the Game Loop; Understanding the game loop
- Writing a basic game loopCompiling gameloop.html; Game objects; The player's spaceship game object; Object pooling; Pooling the player's projectiles; Creating an enemy; Compiling game_objects.html; Summary; Chapter 7: Collision Detection; Types of 2D collision detection; Circle collision detection; Rectangle collision detection; A short refresher on trigonometry; Line collision detection; Compound colliders; Implementing circle collision detection; Destroying a spaceship on collision; Pointers in memory; Implementing compound circle colliders; Compiling collider.html; Summary
- Chapter 8: Basic Particle SystemAdding to the virtual file system; A brief introduction to SVG; Vector versus raster graphics; Trigonometry again?; Adding the JavaScript; The simple particle emitter tool; The Point class; The Particle class; The Emitter class; WebAssembly interface functions; C++ name mangling; Dead code elimination; Updating the emitter; The looping function; Initialization; Compiling and testing the particle emitter; Summary; Chapter 9: Improved Particle Systems; Modifying our HTML shell file; Scaling values; Color-blending values; Particle burst; Looping the emitter; Aligning particle rotation.