The Art of WebAssembly Cover

The Art of WebAssembly

by Rick Battagline
May 2021, 304 pp.
ISBN-13: 
9781718501447
Use coupon code PREORDER to get 25% off!

Download Chapter 2: WEBASSEMBLY TEXT BASICS

WebAssembly is the revolutionary new web standard that enables high-performance programs and computer-intensive web applications to run at peak performance inside a browser. Different from a programming language like JavaScript, it’s a fast, compact, portable compilation target for a variety of languages, in a binary code format. This book will give you a solid understanding of WebAssembly, how it works under the hood, when to use it, when not to use it, how to write it, and ways to develop and deploy your own WebAssembly apps.

Author and expert Rick Battagline eases you through all the technology’s complexities using clear explanations, illustrations, and plenty of examples. He’ll show you how to optimize and compile low-level code, as well as how to debug and evaluate WebAssembly, and represent WebAssembly in its human-readable format, WebAssembly Text (WAT) – skills that will set you apart from other programmers as WebAssembly expands into all modern architectures. Once you grasp the basics, you’ll build a collision-detection program to measure the performance of WebAssembly in Chrome and Firefox. You’ll also work with browser rendering technologies to create graphics and animations for your apps, and you’ll see how WebAssembly interacts with other web languages.

You’ll learn how to:

  • Use Node.js and web browsers as the JavaScript embedding environment for WebAssembly apps
  • Write web applications that use WebAssembly for optimal performance
  • Debug WebAssembly code using a variety of tools, including browser debuggers
  • Format variables, loops, functions, strings, data structures, and conditional logic in WAT
  • Manipulate memory through WebAssembly, and build a program that spawns graphical objects randomly and detects when the objects collide
  • Evaluate the output of a WebAssembly compiler (AssemblyScript)

This book doesn’t focus on any particular language toolchains, so the skills learned are applicable to whatever you’re working with.

Author Bio 

Rick Battagline is a game developer and author of Hands-On Game Development with WebAssembly (Packt Publishing, 2019). In 2006 he founded BattleLine Games LLC, an independent game studio focused on web games. Since then, he has written hundreds of games developed in various web technologies including WebAssembly, HTML5, WebGL, JavaScript, TypeScript, ActionScript, and PHP. He’s a member of the WebAssembly Community Group, and the AssemblyScript Community Group.

Table of contents 

Introduction
Chapter 1: Introduction to WebAssembly
Chapter 2: WAT Basics
Chapter 3: Functions and Tables
Chapter 4: Low Level Bit Manipulation
Chapter 5: String Manipulation
Chapter 6: Linear Memory
Chapter 7: Web Applications

Chapter 8: Working with the Canvas
Chapter 9: Optimizing Performance
Chapter 10: Debugging WebAssembly
Chapter 11: AssemblyScript

All chapters are included in this Early Access PDF.