ClientGame QVM/DLL startup

Hello guys,

I am kinda new to ioquake and I am interested in creating games with this engine.
I’ve already been reading the source repo on github a bit and seem to have a general understanding of how the engine works.
There is just one thing that throws me off a bit…
I don’t really see where and how the code execution of the Client Game module works:
I could find several functions which handle general data initialization of the VM’s, but I couldn’t find any thread creations (which could initiate VM calls for example).
So my particular questions are:

a) Is the Client Game VM/DLL code running once per Client Frame or does it execute in its own dedicated thread?
b) Which function is calling Client Game VM/DLL functions for the first time (eventually doing some startup initialization)?

I am truly sorry if my question seems stupid, but I really don’t understand right now how such a “cgame” qvm or dll is structured.

Thanks a lot for your answers in advance :slight_smile: ,

Aether34

The qagame/cgame/ui VMs aren’t separate threads. The engine calls functions in them using the VM_Call() function with arguments passed to vmMain() function in each VM (in g_main.c, cg_main.c, ui_main.c). The VMs can call functions in the engine using trap_*() syscalls.

GAME_INIT, CG_INIT, and UI_INIT are passed to VM_Call() (and thus vmMain()) as the first call into each VM.

1 Like