# How can I edit .qvm (Quake Virtual Machine) files?

I was browsing through how to mod a game (Urban Terror, a Quake 3 mod). I found that it can be done by editing .qvm files in the game. Under the file named zpak000.pk3. That file contains other files named

ui.qvm
qagame.qvm
cgame.qvm


But I can't find a way in which I can edit these files.

You create qvm files using the c-compiler in the Quake SDK.

You can't edit QVM files.

(You could technically modify them using a hex editor, in the same way that you can modify other compiled programs, but this is not useful for your purposes.)

• U know urban terror is a mod of quacke 3. And from where can i get that The modded sdk ? Jul 22, 2011 at 16:16
• You don't need a "modded" SDK. Urban terror uses the SDK that ID Software provides. You can't edit the QVM files that the Urban Terror modders produced, as I've already said. Jul 22, 2011 at 18:16
• To clarify on Olhovsky's comment: to modify Urban Terror, you'll probably need to get your hands on the source code that the devs used to compile the QVMs. That probably means contacting them and asking for it, unless they've released it. Jul 22, 2011 at 20:00
• @Olhovsky There is (was?) plethora of mods for Urban Terror. Most of the mod-developers used "qvm" disassemblers; many of which, I know, where written by the mod-developers them self in a long night. Those disassemblers were used to locate specific procedures, so that the mod-devs could overwrite them. Also, Urban Terror doesn't use the original quake SDK. In fact, they use their own version, called ioQuake SDK, which is open source. Jan 27, 2017 at 0:19
• @GregoryAvery-Weir The engine "ioQuake" is open source on GitHub. See here. Jan 27, 2017 at 0:23

There are basically 2 ways to "mod a mod". Either you get hands on the original source code or you have to delve into the blackbox.

Since the source of Urban Terror is closed-source (except for the engine; which is a fork of the Quake 3 engine, called ioQuake 3), you have to 'delve' into the blackbox.

This involves using a disassembler, which is able to process them .qvm's binary data and yields the assembler logic of the mod. Using this, one is able to make modifications. The "workflow" is quite comparable to "cracking" existing software: Disassemble the binary. Find the instructions of interest overwritte them.

On the links posted below, you'll find a small guide and a disassembler.

It is important to notice, that the License of the game prohibits ANY modifications.

EDIT: I answered this when I was 14, the original answer isn't good. But left here "historical" reasons.

Look at game-deception it explains how to modificate a qvm (' after it has been compiled '). It just over-compile the certain lines / commands. The only problem ( for you ) is, that you have to work with opcodes ( / assembler ). Well, here's the tutorial made by the great macpunk : http://www.gamedeception.net/threads/19198-Runtime-QVM-Modification

> vmHeader_t *hook_VM_LoadQVM( vm_t *vm, qboolean alloc )
>
> {
>
>
> if(!strcmp(vm->name, "cgame")
>
> {
>
>     vm->instructionPointers[0x0FF5E7] = 0x00; //0x00 is the opcode of whatever you want the instruction to be
>
> }
>
> return ret; }


You need to Quake3 Engine SDK for the structs.