Ray Casting “Hello World” in Web Assembly

Web Assembly graphics programmers hello world

 

As a old C++ programmer it is very compelling to write your code and test it nativly and using Emscripten you can publish and use your code directly on the web.

But there is a learning curve to everything so to make a relevant and fun “Hello World” Application. That actually uses some Cpu power i decided to do a Wolfenstein Ray Casting demo. This is a cool an relativly easy technique and there are interesting design choice where to devide the computation between Java script and Web Assembly (c++).

Prereqs:

I asume  a bit knowledge about web development and javascript.

 

Ray Casting Algorithm

The basic idea is to render a 2.5D image like in wolfenstein, where each collumn of the final image.

 

References:

https://emscripten.org/index.html

https://www.permadi.com/tutorial/raycast/rayc1.html (Very good ray casting tutorial.