Game Development

From ioquake3 wiki
Jump to navigation Jump to search

This page badly needs to be re-organized and the content within moved elsewhere or replaced.

Code Overview

ioquake3 is divided into two general parts, the client part and the {{#ifexist:SV_Frame|server|server}} part, with a networking system that connects the two. The client mainly takes care of user interface. That is, it displays the 3D rendering of the game world and also collects keyboard, mouse, and joystick input events. The {{#ifexist:SV_Frame|server|server}} is responsible for taking care of everything else: moving the user's position and view based on keyboard/mouse/joystick inputs, detecting collisions, processing bot AI, determining hits and frags, etc.

Program Flow

During startup of a standard game, the top-level flow of control goes like this:

  • Depending on whether you're using a unix environment or Windows, program control will start at either main() or WinMain().
  • Windows will first create a console window using {{#ifexist:Sys_CreateConsole|Sys_CreateConsole()|Sys_CreateConsole()}}.
  • Misc. initialization of CD path, install path, and command line buffer.
  • Call Com_Init(), which processes the command line, initializes some internal memory buffers, loads cvars, and initializes the server, the client, and the network channel.
  • Call {{#ifexist:Com_Frame|Com_Frame()|Com_Frame()}} in an infinite loop. Each call to {{#ifexist:Com_Frame|Com_Frame()|Com_Frame()}} results in one frame of gameplay.