News for hackers. Stuff that matters.
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by dejv on Wednesday August 29, 2018 @07:21AM (#17867337)
What could be usecase for using this VM? Any idea why to use it in non-game app?
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by janosch9001 on Wednesday August 29, 2018 @11:54AM (#17869181)
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/Virt... by mietek on Wednesday August 29, 2018 @06:24PM (#17872597)
> … strong typing … C …

This is incorrect. Wikipedia specifies C’s typing discipline as “static, weak, manifest, nominal”, which isn’t great, but is at least in the right ballpark. “Strong” and “weak” are unhelpfully overloaded words.

http://blogs.perl.org/users/ovid/2010/08/what-to-know-before...

Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by Epskampie on Wednesday August 29, 2018 @07:22AM (#17867345)
I don't understand either. If you have to write in C, and you have to compile, what's the advantage?
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by ndepoel on Wednesday August 29, 2018 @08:36AM (#17867717)
The main advantage for Quake 3 was that the server, client and UI code could be compiled into platform-independent bytecode modules. This was mostly a boon to mod creators, who had to build only one version of their mod that would work on all Windows, Mac and Linux systems alike.
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by hinkley on Wednesday August 29, 2018 @12:24PM (#17869485)
I thought I heard this was also a boon for the scenario creators and level builders working alongside the graphics engineeers.

They get something a little less hairy and volatile to work with, and execution speed isn’t that critical because you’re only making hundreds or thousands of decisions per second.

Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by johannes1234321 on Wednesday August 29, 2018 @07:29AM (#17867382)
Speculation: Assuming the VM has no bugs it is sandboxed. The code run can't access the file system or freely allocate memory. Thus code from less trusted sources can be executed. (Another comment indicates that the VM has a history of bugs, so it might not be advisable, but I have no experience with it)
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by Jyaif on Wednesday August 29, 2018 @10:14AM (#17868342)
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/Virt... by jamesu on Wednesday August 29, 2018 @10:54AM (#17868643)
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/Virt... by farnulfo on Wednesday August 29, 2018 @08:10AM (#17867580)
Source code of third party mods ?
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by monocasa on Wednesday August 29, 2018 @10:40AM (#17868527)
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/Virt... by golergka on Wednesday August 29, 2018 @07:50AM (#17867474)
Also, how was it used in Quake3?
Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by juliangoldsmith on Wednesday August 29, 2018 @09:49AM (#17868181)
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/Virt... by hinkley on Wednesday August 29, 2018 @12:21PM (#17869449)
It might be worth mentioning that there’s a long tradition of this pattern in game design. In quite a few cases, much of the game logic is separated from the graphics engine, in a simpler language with an interpreter.

In the case of world of Warcraft, the Lua interpreter allowed for a rich ecosystem of UI (and light behavioral) addons. In some cases very popular addons features were added into the core UI in later updates.

I find that arrangement pretty compelling. In the few cases where I’ve worked on or with a team with addon support I bring this up: use the community sourced features as a popular vote for what to incorporate (just be sure to reward the author somehow).

Re:Q3VM – Lightweight, embeddable Quake III Interpreter/Virt... by monocasa on Wednesday August 29, 2018 @08:07AM (#17867569)