# Overall architecture: coupling between game, cgame, etc?

**URL:** <https://discourse.ioquake.org/t/overall-architecture-coupling-between-game-cgame-etc/426>\
**Category:** dev\
**Created:** [January 9, 2015, 12:28pm UTC](https://discourse.ioquake.org/t/overall-architecture-coupling-between-game-cgame-etc/426 "2015-01-09T12:28:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinnyvicious](https://avatars.discourse-cdn.com/v4/letter/v/76d3ee/32.png) [@vinnyvicious](https://discourse.ioquake.org/u/vinnyvicious)\
**Post date:** [January 9, 2015, 12:28pm UTC](https://discourse.ioquake.org/t/overall-architecture-coupling-between-game-cgame-etc/426/1 "2015-01-09T12:28:59Z")

</div>

I have decided to rewrite most of the code inside cgame, by slowly deactivating old code and migrating to newer code. However, i’m not completely sure about the Quake 3 architecture. Is there any other dependency between cgame and the engine, other than the vmMain and the events it receives?

There seems to be some tight coupling with other parts of the system, and i’m afraid about global variables and shared global state. Or is it really completely isolate and i should just care about vmMain and drawing the current frame properly?

---

<div class="post-metadata">

**Author:** ![WofWca](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.ioquake.org/wofwca/32/795_2.png) [@WofWca](https://discourse.ioquake.org/u/WofWca)\
**Post date:** [February 14, 2026, 10:29am UTC](https://discourse.ioquake.org/t/overall-architecture-coupling-between-game-cgame-etc/426/2 "2026-02-14T10:29:41Z")

</div>

> [@vinnyvicious](#):
>
> other than the vmMain and the events it receives?

There is also `cg_syscalls.c` which shares some types defined in `cg_public.h` with `code/client` (and `code/client` is a part of the engine). One example is `snapshot_t` which must be the same between the `client` and `cgame`, because the `CG_GETSNAPSHOT` syscall writes to wherever the `snapshot_t` pointer points to.

> <https://github.com/ioquake/ioq3/blob/fe42b8653d8bcb213a3532a1cbacc0e1c6854a87/code/cgame/cg_public.h#L36-L54>

> <https://github.com/ioquake/ioq3/blob/dd859ae43d88d7e3863ef2aaaae143c18670befb/code/cgame/cg_syscalls.c#L319-L321>
