Q3VM - quake 3 virtual machine

Embeddable bytecode virtual machine/interpreter for C-language input

A lightweight (single file: vm.c) embeddable interpreter/Virtual Machine (VM) for compiled bytecode files (.qvm) based on good old C-language input (.c). A complete C compiler to generate .qvm files is included (LCC). The interpreter is based on the Quake III Arena virtual machine (hence the name q3vm) but the interpreter is not tied to Quake III Arena and can be used for any kind of project. For example code that needs to run in a sandbox

Features

  • Small and lightweight (one .c file to include without dependencies)
  • Battle-tested (20 years of use in Quake III Arena)
  • Forked from the well maintained ioquake3 code base
  • Tool tested (static code analysis, test coverage, Valgrind)
  • No need to learn a new scripting language (e.g. Lua)
  • Strong typing in the scripting language (C)
  • Static memory allocation in C, no unpredictable garbage collector
  • Plan B: you can always go back to native code, as .c files are the input
  • Great tool landscape for C. Use the tools that are available for C
  • Computed gotos are used to speed up the interpreter if you compile with GCC

Quake 3 Source Code Review: Virtual Machine

Written on August 29, 2018, Last update on December 29, 2020
games c++ quake vm