WebAssembly from Scratch: From FizzBuzz to DooM.

Overview

WebAssembly from Scratch: From FizzBuzz to DooM

Exploring WebAssembly from scratch from a backend-person-point-of-view. A story in four acts.


Welcome to my journey where I will explore some WebAssembly. We will start from scratch. My goal is to look at everything bottom-up, without much magic tooling or frameworks on our way. In this article, I prefer to build everything as much from scratch as possible.

Non-goal: We will not implement our own WebAssembly interpreter or runtime, but use existing ones, e.g., wabt or the Chrome and Firefox browsers.



Demo at https://diekmann.github.io/wasm-fizzbuzz/rust/, deployed from (Part 3) via GitHub Actions to GitHub Pages.

Play doom at https://diekmann.github.io/wasm-fizzbuzz/doom/, deployed from (Part 4) via GitHub Actions to GitHub Pages..

You might also like...
Translates WebAssembly modules to C

w2c2 Translates WebAssembly modules to C. Inspired by wabt's wasm2c. Features Implements the WebAssembly Core Specification 1.0 Passes 99.9% of the We

Snake in C++ for WebAssembly

Snake-wasm Snake in C++ for WebAssembly This is a primitive greedy snake game demo in C++(ish) to test WebAssembly Getting Started Install emscripten

Minimal C# WebAssembly WebGL Example
Minimal C# WebAssembly WebGL Example

Minimal C# WebAssembly WebGL Example a minimal example of C# wasm WebGL app based on dotnet/runtimelab/NativeAOT-LLVM WebAssembly This example is port

A simple Unix like operating system from scratch.
A simple Unix like operating system from scratch.

HOS-x86 an x86 operating system written from scratch How to Build? Currently you need NASM, GCC and QEMU to build the image file. Install the packages

This is the source code of SATCH a SAT solver written from scratch in C.

The main purpose of this solver is to provide a simple and clean code base for explaining and experimenting with SAT solvers. It is simpler than the source code of CaDiCaL and of Kissat in particular, while still featuring most important implementation techniques needed to obtain a state-of-the-art SAT solver

This is an experimental OS-from-scratch project. Just for demonstration, not useful at all.
This is an experimental OS-from-scratch project. Just for demonstration, not useful at all.

OS Playground This is an experimental OS-from-scratch project. Just for demonstration, not useful at all. Different from OS in other projects, this OS

A unix operating system made from scratch using c++
A unix operating system made from scratch using c++

pranaos A unix operating system made from scratch using c++ Dependencies g++ version should be more than 10.0.0 ninja gcc compiler needed prana os is

My first os built from scratch

Kernel project My first os built from scratch Contributors are welcome LICENSE TODO GDT IDT PS2 Keyboard PS2 Mouse PIT RTC Initrd Drawing on framebuff

Creating sepia, reflection, grayscale, and blur filters from scratch and returns a modified image

image-filter Created sepia, reflection, grayscale, and blur filters from scratch and returning a modified image Directories: images: contains sample i

Comments
  • Add a LICENSE

    Add a LICENSE

    The tutorials are great! Thank you for putting this together.

    I would like to build on the doom example for my own, "But can it run DOOM" project. Does this project have a LICENSE?

    @diekmann

    opened by ricochet 2
  • Fix doom running at 32FPS instead of desired 35 FPS.

    Fix doom running at 32FPS instead of desired 35 FPS.

    A simple typo set the TICRATE to 32 instead of 35. The C sources clearly say it should be 35: linuxdoom-1.10/doomdef.h:#define TICRATE 35

    Wow, I was debugging for so long why I only see 35 FPS in the browser. I was blaming a bad interaction between the 60 FPS the browser renders animations frames vs. the 35 FPS doom likes, which are not a multiple of each other. After 12 browser frames and 7 doom frames (at 200ms), both are in sync again.

    Here is the python script to simulate how late a doom frame will be:

    pdf = 0 # previous doom frame for browser_frame in range(12+1): time = browser_frame1/601000 #ms print(f"Broser frame {browser_frame} at {time:.2f} ms") pending_doom_frame = 1/35*1000 * pdf # ms if pending_doom_frame <= time: print(f" new doom frame for {pending_doom_frame:.2f}; delayed for {time-pending_doom_frame:.2f} ms") pdf += 1

    Output: Broser frame 0 at 0.00 ms new doom frame for 0.00; delayed for 0.00 ms Broser frame 1 at 16.67 ms Broser frame 2 at 33.33 ms new doom frame for 28.57; delayed for 4.76 ms Broser frame 3 at 50.00 ms Broser frame 4 at 66.67 ms new doom frame for 57.14; delayed for 9.52 ms Broser frame 5 at 83.33 ms Broser frame 6 at 100.00 ms new doom frame for 85.71; delayed for 14.29 ms Broser frame 7 at 116.67 ms new doom frame for 114.29; delayed for 2.38 ms Broser frame 8 at 133.33 ms Broser frame 9 at 150.00 ms new doom frame for 142.86; delayed for 7.14 ms Broser frame 10 at 166.67 ms Broser frame 11 at 183.33 ms new doom frame for 171.43; delayed for 11.90 ms Broser frame 12 at 200.00 ms new doom frame for 200.00; delayed for 0.00 ms

    This means, a doom frame is at most displayed 14.29 ms too late. This seems okayish to me for now.

    Simply fixing the typo is good enough for me.

    opened by diekmann 0
Owner
Cornelius Diekmann
Proving stuff in Isabelle. Computer networks and security.
Cornelius Diekmann
Doom port for InfOS - the University of Edinburgh Informatics research operating system used in the UG3 OS course

Doom on InfOS InfOS is the Informatics research operating system, designed specifically for the UG3 Operating Systems course. This project aims to por

Cheng Kai 14 Aug 20, 2022
DOOM BSP renderer for ZenithOS.

Zenith DOOM This project ports the DOOM BSP renderer to Zenith for use in custom games. It includes a zos/ directory in src/ which has includes that e

null 3 Jun 10, 2021
Doom port to the Ikea Tradfri RGB1923R5 and any device using Silicon labs EFR32MG21 based modules

MG21DOOM Doom port to the Ikea Tradfri RGB1923R5 lamp and any device using Silicon labs EFR32MG21 based modules. Coded by Nicola Wrachien. WARNING Do

null 20 Aug 2, 2022
Fork of dsda-doom with experiments

dsda-doom-experiments This is my personal fork of dsda-doom for running experiments. This breaks demo compatibility. DO NOT USE. The current experimen

jsd1982 1 Oct 7, 2021
old 'cross' project of DooM for various platforms

README - DOOM assembly code Okay, I add the DOS assembly module for the historically inclined here (may rec.games.programmer suffer). If anyone feels

null 3 Dec 27, 2022
Doom ported to a nRF52840-based BLE dongle

nRF52840 Doom Doom port to an nRF52840-based USB BLE dongle, the Adafruit CLUE board, and any device using Nordic Semiconductors nRF52840. Coded by Ni

null 30 Dec 29, 2022
DOOM ported to the dos-like framework

doom-for-dos-like This is a quick but fairly complete version of the original DOOM ported to the dos-like framework. The data included is for original

Mattias Gustavsson 30 Sep 25, 2022
Speed Running and Competition Doom. For strictly vanilla speed runs and competitions - forked from CNDoom

Speed Running and Competition Doom Speed Running and Competition Doom is based on Chocolate Doom and aims to accurately reproduce the original DOS ver

Gibbon 3 May 24, 2022
A DOOM 32 extension for DOS using increased limits beyond what DOOM32 provides.

DOOM128 A DOOM 32 extension for DOS using increased limits beyond what DOOM32 provides. Why Because having a DOS compatible DOOM source port that incr

Gibbon 10 May 5, 2022
Run statically-compiled WebAssembly apps on any embedded platform

embedded-wasm-apps Run native, statically-compiled apps on any platform, using WebAssembly. Examples include AssemblyScript, Rust, C/C++, TinyGo, Zig,

Wasm3 Labs 112 Dec 20, 2022