Difference between revisions of "Engine getting started"

From Quake Wiki

m (Editing your own Quake engine)
(Updated Code::Blocks Link)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
=== First Steps ===
 +
To get started, download the source code for an [[Engines|engine]]. This might be available as a compressed package or in a revision control repository. Make sure your platform and operating system are supported, make sure you have the required dependencies (make, OpenGL, etc.), and then follow the provided build instructions. All of these things will vary from engine to engine. Make sure the engine compiles and runs on your machine before you begin making modifications, lest you think you made a mistake when you did not.
 +
 +
You can use your [http://en.wikipedia.org/wiki/List_of_text_editors#Graphical_user_interface text editor] to alter the files, but you might want an [http://en.wikipedia.org/wiki/List_of_IDEs#C.2FC.2B.2B integrated development environment]. A good place to start is the makefiles, which determine how the program is compiled. It shows how all the files in the project are related to each other. You can begin by making changes to the files, recompiling, running the program, and seeing what has changed. It might be beneficial to use a [http://en.wikipedia.org/wiki/Version_control_system revision control system] to organize and track your changes.
 +
 +
 +
===Editing your own Quake engine (2013)===
 +
 +
We are going to use FitzQuake Mark V's source code and Windows for this example as GLQuake's source code doesn't compile without many modifications.
 +
 +
What you need:
 +
 +
1. [https://sourceforge.net/projects/codeblocks/files/Binaries/20.03/Windows/codeblocks-20.03mingw-setup.exe/download CodeBlocks + MinGW] (75MB) or [http://www.microsoft.com/visualstudio/eng/downloads Visual Studio Express 2012] (5 GB).  Both are free.
 +
 +
2. [http://quake-1.com/docs/utils/fitzquake_mark_v_r9.zip FitzQuake Mark V source code] Decompress the source.zip included.
 +
 +
Visual Studio Express 2012: Open Fitzquake_Visual_Studio_2012.vcxproj and press F5 [or click Build->Build Solution] to compile + run.
 +
 +
CodeBlocks + MinGW: Open Fitzquake_CodeBlocks.cbp and press F9 (or click Build->Build and Run).
 +
 +
That's it, the Mark V source compiles out-of-the-box.  There are [http://forums.insideqc.com/viewforum.php?f=12 engine tutorials here] and [http://forums.insideqc.com/viewforum.php?f=3 an engine discussion forum here].
 +
 
===Editing your own Quake engine===
 
===Editing your own Quake engine===
 
* Get [http://www.mingw.org MinGW] or [http://msdn.microsoft.com/visualc/ buy Visual C++]
 
* Get [http://www.mingw.org MinGW] or [http://msdn.microsoft.com/visualc/ buy Visual C++]
 
* Dowload whatever you want engine sources
 
* Dowload whatever you want engine sources
 
* '''Suggestion''':
 
* '''Suggestion''':
** [http://tomaz.quakesrc.org/q/files/Clean.zip CleanSrc] simple
+
** [http://tomaz.quakesrc.org/q/files/Clean.zip CleanSrc] Simple and most likely to fit with general information about the Quake engine.
** [[QMB]] [http://www.flyingsaucepan.com/QMB (web)] - another good start
+
** [[TomazQuake]] [http://tomaz.quakesrc.org/q/ (web)] - Like CleanSrc it will fit with general information about engine development but with enhancements and extra features already added. Will build on Windows (Visual Studio).
** [[TomazQuake]] [http://tomaz.quakesrc.org/q/ (web)] - for TQ clones
+
** [[QMB]] [http://www.gluonporridge.net/QMB (web)] [//https://github.com/DrLabman/QMB (git)] - Moving away from the standard source layout, originally based on CleanSrc. Will build on Unix and Windows (GMingW).
** [[DarkPlaces]] [http://www.icculus.org/twilight/darkplaces/ (web)] - for level wizardry coders and huge enginemods
+
** [[DarkPlaces]] [http://www.icculus.org/twilight/darkplaces/ (web)] - One of the most comprehensive feature sets. Unlikely to fit with general information about Quake engines. Better suited to experienced programers who want the features it offers.
** [[FuhQuake]] [http://www.fuhquake.net/ (web)] - great starting point for QuakeWorld
+
** [[FuhQuake]] [http://www.fuhquake.net/ (web)] - Great starting point for QuakeWorld
 
* Unzip
 
* Unzip
 
* Open the *.dsw file (VC++) or the makefile (gcc/[http://www.mingw.org/ MinGW])
 
* Open the *.dsw file (VC++) or the makefile (gcc/[http://www.mingw.org/ MinGW])
Line 13: Line 35:
 
* Recompile ( VC: build button, "make" command for gcc/mingw)
 
* Recompile ( VC: build button, "make" command for gcc/mingw)
 
* If the build failed...
 
* If the build failed...
** Use your proyect *.s files? -> then you have to build these with gas, also included often. Or [http://www.quakesrc.org/forum/viewtopic.php?t=148&highlight=assembler+quake+build remove these and subst by c]
+
** Use your project *.s files? -> then you have to build these with Gas, also included often. Or [http://www.quakesrc.org/forum/viewtopic.php?t=148&highlight=assembler+quake+build remove these and substitute by c]
** Is your project for another compiler? (Darkplaces compiles on both VC an GCC for example, but some others only compile for VC)
+
** Is your project for another compiler? (Darkplaces compiles on both Visual C and GCC for example, but some others only compile for Visual C)
** Ask at [http://www.quakesrc.org QuakeSRC]
+
** Ask at [http://forums.insideqc.com InsideQC]
 
* [[Test Engine]]
 
* [[Test Engine]]
  
 
===Understanding the code structure===
 
===Understanding the code structure===
This is a list of source files and a list of some of the things done in them.
+
This is a partial list of source files and brief explanation of what they do. They will vary from engine to engine, so don't worry if you can't find a particular file. If you are missing any files but have one with a similar name, it probably performs the same function.
  
 
*cl_ - client files (demo playback, input, temp entities)
 
*cl_ - client files (demo playback, input, temp entities)
Line 26: Line 48:
 
**_main - assorted client functions
 
**_main - assorted client functions
 
**_parse - server command parsing
 
**_parse - server command parsing
**_tent - temp entitie parsing and beam parsing
+
**_tent - temp entity parsing and beam parsing
  
 
*sv_ - server files (physics, collision detection, movement)
 
*sv_ - server files (physics, collision detection, movement)
Line 35: Line 57:
  
 
*net_ - network files<br>
 
*net_ - network files<br>
**basicly convert quake client/server packets to be sent over a transport protocal like tcp or ipx, as well as network server/client stuff
+
**basically convert quake client/server packets to be sent over a transport protocol like tcp or ipx, as well as network server/client stuff
  
 
*pr_ - qc virtual machine (runs progs.dat)
 
*pr_ - qc virtual machine (runs progs.dat)
Line 48: Line 70:
 
**_model - map and model loading
 
**_model - map and model loading
 
**_rlight - dynamic lights
 
**_rlight - dynamic lights
**_screen - statis bar, console etc drawing
+
**_screen - status bar, console etc drawing
 
**_sprite - sprite drawing
 
**_sprite - sprite drawing
 
**_vidnt - video init functions, and other startup functions
 
**_vidnt - video init functions, and other startup functions
Line 65: Line 87:
 
**console - console text control (calls functions from gl_screen to draw)
 
**console - console text control (calls functions from gl_screen to draw)
 
**cvar - cvar functions
 
**cvar - cvar functions
**common - common low level functons (string compairs, file stuff)
+
**common - common low level functions (string compairs, file stuff)
 
[[Category:DarkPlaces]]
 
[[Category:DarkPlaces]]

Latest revision as of 08:38, 19 February 2021

First Steps[edit]

To get started, download the source code for an engine. This might be available as a compressed package or in a revision control repository. Make sure your platform and operating system are supported, make sure you have the required dependencies (make, OpenGL, etc.), and then follow the provided build instructions. All of these things will vary from engine to engine. Make sure the engine compiles and runs on your machine before you begin making modifications, lest you think you made a mistake when you did not.

You can use your text editor to alter the files, but you might want an integrated development environment. A good place to start is the makefiles, which determine how the program is compiled. It shows how all the files in the project are related to each other. You can begin by making changes to the files, recompiling, running the program, and seeing what has changed. It might be beneficial to use a revision control system to organize and track your changes.


Editing your own Quake engine (2013)[edit]

We are going to use FitzQuake Mark V's source code and Windows for this example as GLQuake's source code doesn't compile without many modifications.

What you need:

1. CodeBlocks + MinGW (75MB) or Visual Studio Express 2012 (5 GB). Both are free.

2. FitzQuake Mark V source code Decompress the source.zip included.

Visual Studio Express 2012: Open Fitzquake_Visual_Studio_2012.vcxproj and press F5 [or click Build->Build Solution] to compile + run.

CodeBlocks + MinGW: Open Fitzquake_CodeBlocks.cbp and press F9 (or click Build->Build and Run).

That's it, the Mark V source compiles out-of-the-box. There are engine tutorials here and an engine discussion forum here.

Editing your own Quake engine[edit]

  • Get MinGW or buy Visual C++
  • Dowload whatever you want engine sources
  • Suggestion:
    • CleanSrc Simple and most likely to fit with general information about the Quake engine.
    • TomazQuake (web) - Like CleanSrc it will fit with general information about engine development but with enhancements and extra features already added. Will build on Windows (Visual Studio).
    • QMB (web) (git) - Moving away from the standard source layout, originally based on CleanSrc. Will build on Unix and Windows (GMingW).
    • DarkPlaces (web) - One of the most comprehensive feature sets. Unlikely to fit with general information about Quake engines. Better suited to experienced programers who want the features it offers.
    • FuhQuake (web) - Great starting point for QuakeWorld
  • Unzip
  • Open the *.dsw file (VC++) or the makefile (gcc/MinGW)
  • Edit some files (VC IDE, Dev-C++ ide, SciTE, notepad,...)
  • Recompile ( VC: build button, "make" command for gcc/mingw)
  • If the build failed...
    • Use your project *.s files? -> then you have to build these with Gas, also included often. Or remove these and substitute by c
    • Is your project for another compiler? (Darkplaces compiles on both Visual C and GCC for example, but some others only compile for Visual C)
    • Ask at InsideQC
  • Test Engine

Understanding the code structure[edit]

This is a partial list of source files and brief explanation of what they do. They will vary from engine to engine, so don't worry if you can't find a particular file. If you are missing any files but have one with a similar name, it probably performs the same function.

  • cl_ - client files (demo playback, input, temp entities)
    • _demo - demo playback
    • _input - keyboard input (higher level)
    • _main - assorted client functions
    • _parse - server command parsing
    • _tent - temp entity parsing and beam parsing
  • sv_ - server files (physics, collision detection, movement)
    • _main - general server functions
    • _move - movement related functions like movestep and moretogoal
    • _phys - physics functions, gravity etc
    • _user - user/client related functions
  • net_ - network files
    • basically convert quake client/server packets to be sent over a transport protocol like tcp or ipx, as well as network server/client stuff
  • pr_ - qc virtual machine (runs progs.dat)
    • _cmds - builtin commands
    • _exec - qc executing
    • _edict - loading progs.dat and other edict functions
  • gl_ - opengl drawing files
    • _rsurf - map and brush drawing
    • _warp - sky, water etc drawing
    • _mesh - alias model drawing
    • _model - map and model loading
    • _rlight - dynamic lights
    • _screen - status bar, console etc drawing
    • _sprite - sprite drawing
    • _vidnt - video init functions, and other startup functions
    • _rmain, _rmisc - general draw stuff, cvar registering
    • _draw - texture loading
    • _rpart (for engines that dont use qmb partices its r_part.c or something) - Particle system, physics and drawing
  • snd_ and cd_ - sound files
  • and the rest are just bits and pieces, such as zone does memory managment
    • menu - drawing menu and stuff
    • sbar - sbar higher level drawing (calls functions from screen to do the actual drawing)
    • mathlib - assorted maths functions
    • wad - wad file loading
    • world - map stuff
    • console - console text control (calls functions from gl_screen to draw)
    • cvar - cvar functions
    • common - common low level functions (string compairs, file stuff)