Live data from Hacker News

Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

github.com

11–20 of 32 posts

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#12
post #7
post #3

What could be usecase for using this VM? Any idea why to use it in non-game app?

Also, how was it used in Quake3?

All of the code for the UI, server-side game logic, and client-side game logic in Quake 3 was run in the VM. It allowed code to be stored with game data, and client-side mods to be safely downloaded directly from the game server.

The link in the sibling post has most everything you'd ever want to know about it.

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#15
post #3

What could be usecase for using this VM? Any idea why to use it in non-game app?

I don't understand either. If you have to write in C, and you have to compile, what's the advantage?

You compile it once and it runs on all architectures (including ones that did not exist at the time).

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#16

It's not clear from the documentation, is this forked out of the Q3 codebase or based on the LCC book or just totally independently created?

id took the LCC compiler and targeted it toward their custom bytecode VM. I have no idea what this author has done with the code since then, though.

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#17
post #9

Earlier quoted context omitted.

I don't understand either. If you have to write in C, and you have to compile, what's the advantage?

Source code of third party mods ?

You don't really get source code. You only get bytecode that's harder to reverse than a fully compiled binary if only for the lack of tooling.

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#18
post #3

What could be usecase for using this VM? Any idea why to use it in non-game app?

I don't understand either. If you have to write in C, and you have to compile, what's the advantage?

These days, there isn't much advantage. You'd be much better off using a well supported third party vm implementation like coreclr for instance.

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#19
post #3

What could be usecase for using this VM? Any idea why to use it in non-game app?

Hi, author here. It is indeed a niche thing. But there are some use cases:

* Sandbox for code you don't fully trust (e.g. download the bytecode from a web server)

* Mods for small hobby game engines

* There are many virtual machines, but not many are so small, with strong typing and no garbage collector

* Learn about virtual machines in general, but directly have a C compiler available for the virtual machine

* Sandbox for embedded applications, e.g. plug-ins for IoT applications on microcontrollers (bounded CPU time, bounded memory area, restrict access to peripheral devices)

* There is also a historical value: learn about the Quake III engine

Re: Q3VM – Lightweight, embeddable Quake III Interpreter/Virtual Machine

#20

It's not clear from the documentation, is this forked out of the Q3 codebase or based on the LCC book or just totally independently created?

It is forked from the ioquake3 code base. I've added computed gotos to the interpreter to speed it up a bit.
Post reply on HN