Instructions for running cube
Install, and run the cube.bat. Needs a decent & compliant OpenGL implementation. before you do, you may want to look at the config which is in "autoexec.cfg" and which should be fairly familiar if you ever played a quake style game. If you want to rebind your keys, see the "bind" command below. press ESC to go into the menu with many useful commands. Cube derives its simplicity from some rather brute force rendering methods, and as such it needs a beefy machine to get good visual quality. It runs best with "vertical sync" OFF and at high refresh rates (you may get excessive LOD/FPS variance otherwise).

 

Command line options
-d runs a dedicated server
-l runs a non-dedicated server that listens for other clients

Default is a non-dedicated server with only a single client. Dedicated servers run in the shell only (no graphics), with increased priority yet use very little cpu time & memory, so you can run one in the background, or at the same time with a client if you want to host a game (which is usually better than using a listen server). Cube servers need to be restarted every 3 weeks, otherwise atleast one game will not have correct timing. Server port is fixed at 28765, currently.

-wX sets desired screen width to X, default is -w640
-hY sets desired screen height to Y, default is -h480
-t runs windowed

-uN sets the server upstream bandwidth to N bytes per second. only set this parameter if you know what you are doing, specifying a wrong value is worse than not specifying it at all.

-nN sets the server description, for people pinging the server. usually does not need to be set if you have a descriptive domain name already, but if you set it, keep it short as it may otherwise be truncated, i.e. -nBobsInstagibServer

-iIP sets the server ip to IP. this option is only useful for people running on machines with multiple network interfaces.

-mM sets the master server to use for either server (registering) and client (updating) to M. M is the base url of the master server and has to end in a / and without a http:// prefix, the default is wouter.fov120.com/cube/masterserver/

General console commands and configuration
    bind K A      
binds key K to commands A (see console language below for what you can put in A). To find out what key names and their default bindings are, look at data/keymap.cfg, then add bind commands to your autoexec.cfg.
    alias N A      
binds name N to commands A, after which you can use N as a shortcut for A. You may re-bind N as often as you like, and bind N again within the execution of A etc.
    quit      
quits without asking.
    forward / backward / left / right      
move you in said direction (defaults to cursor keys).
    attack      
fires the current weapon. default = left mouse
    jump      
triggers a jump. default key space & right mouse.
    invmouse B      
sets mouse to "flight sim" mode if B is not 0
    sensitivity S      
sets mouse sensitivity (default = 10). should be a similar number to quake.
    fov N      
sets your FOV to 10..120.
    fpsrange L H      
sets the desired fps you want between L and H, defaults to 30-40 which is most sensible. Do not set to silly high values as this has a very bad effect on your visuals: the engine tries to reach your desired fps at all costs, by reducing the LOD factor (the higher the LOD, the better visual quality, currently bounded between 25 & 250). because fps doesn't fluctuate as much like in other engines, 30-40 is already very smooth. check the HUD, if the LOD is locked at the minimum specified by minlod, you will need lower fps if you want less popup.
    minlod N      
Sets the minimum LOD factor can take. The higher you set this, the more guaranteed visual quality you will get, but the bigger dips in fps you must endure on slow hardware or slow maps. Setting N to a low value will effectively let fpsrange determine what LOD you will get. Tradeof of LOD vs fps is not linear, you'll have to experiment to find the sweet spot. On most hardware it pays of to have N relatively high, as the fps gain by setting it very low is neglible. Too high only has an effect on big or very detailed maps. Note that while tuning minlod/fpsrange, also take into account the resolution you are running at. If the resolution you set for cube makes your machine "fillrate limited", this may cause the engine to push LOD down in an effort to comply with a framerate your machine can't do at that res.
    fog N      
sets fog distance to N (default currently 160). You can do this for tweaking the visual effect of the fog, or if you are on a slow machine, setting the fog to a low value can also be a very effective way to increase fps (if you are geometry limited). Try out different values on big maps / maps which give you low fps.
    dynlight B R      
determines wether dynamic shadows & lights are rendered (default B=1). provided just incase they slow your fps down too much. With radius you can optionally specify the radius of a dynamic light (default 16), smaller to maybe gain some speed, or bigger to see the effect of dynamic shadows more dramatically (try shooting it past some pillars that have a dark area on the other side... or use the "gamespeed" variable).
    lighterror E      
Allows you to finetune the amount of "error" the mipmapper/stripifier allow themselves for changing lightlevels. Set to 1 for maximum light quality at the expense of fps, set to some high value to gain fps but with messier lighting (only helps if you are geometry limited). Default = 8. If you change this during play, you have to do a "recalc" to see the effect.
    watersubdiv N      
determines the subdivision of the water surface in maps, which can greatly affect fps on slow machines. Must be a power of 2: 4 is the default, 8 is recommended for people on slow machines, 2 is nice for fast machines, and 1 is quite OTT. See "waterlevel" (edit reference) on how to add water to your own levels.
    maxparticles N  
Sets the maximum number of particles rendered at any one time. If more particles are generated than this number, the oldest ones are culled, so you can safely set this number relatively low without loss of information. default 1000.
    screenshot      
writes out "screenshotN.bmp", where N is the number of milliseconds since cube was launched (default key = F12).
    musicvol n      
    soundvol n      
sets the music/sound volume from 0 to 255
    gamma n      
sets the hardware gamma value to n percent (default 100). May not work if your card/driver doesn't support it.
    hidestats b      
turns on/off display of fps/rendering stats on the HUD (default = 1).
    maxroll n      
sets the maximum value your display will roll on strafing (0..20, default = 3)
    crosshairsize n      
sets the size of your crosshair, 0 being off (default = 3)
    crosshairfx b      
turns on or of crosshair effects (default 1). when on, the crosshair will go grey when the weapon is reloading, orange when health <= 50, or red when <=25.
    exec C      
executes all commands in config file C.
    newmenu N      
creates a new menu with name N. All following menuitem commands will apply to this menu
    menuitem N A      
    menuitem A      
creates a new menuitem with description N and action A. if you only specify 1, then it will be used for both the description and the action. See data/menus.cfg for examples.
    showmenu N      
displays the menu with name N previously defined, and allows the user to pick an item with the cursor keys. Upon pressing return, the associated action will be executed. pressing ESC will cancel the menu.
    history N     
Executes the Nth command in the command line history. For example, binding "history 0" to a key allows you to quickly repeat the last command typed in (useful for placing many identical entities etc.)
    keymap K N A      
sets up the keymap for key code K with name N and default action A. You should never have to use this command manually, use "bind" instead.
    lightscale N      
used to finetune the "overbright lighting" rendering feature when enabled: lower numbers make the scene brighter, default = 4. After changing this value, you need to use "recalc" to see the differences.

To use overbright lighting, your card needs to support the "EXT_texture_env_combine" extension (Nvidia from TNT1 and upwards, ATI from rage128/radeon and upwards, but not on voodoos afaik). Overbright lighting uses a different lighting model (lights that overlap "add" rather use the biggest of the two, and lightsources have an exponential rather than linear model), so lighting may look different depending on how the mapper placed the lights. Maps should be made with additive/exponential lighting in mind, however, because soon everyone will have a card that supports this extension.

Do not confuse "lightscale" with "gamma", they have different effects. It is best to leave "lightscale" at the default and tune gamma to get the right brightness level for your situation, but you can tune the other way around if you find the saturation level of a certain gamma level more important. changing the lightscale will have an effect on the distribution of lightsources (higher lightscale will make them more like spotlights). Generally, gamma needs to be lower compared to previous cube releases.

 

Console Language
Cube's console language is similar to console languages of other games (e.g. Quake), but is a bit more powerful in that it is almost a full programming language.

What is similar to quake is the basic command structure: commands consist of the command itself, followed by any number of arguments seperated by whitespace. you can use "" to quote strings with whitespace in them (such as the actions in bind/alias), and whereever a command is required you can also use ; to sequence multiple commands in one.

What is new compared to quake is that you can evaluate aliases and expressions. You can substitute the value of an alias as an argument by prefixing it with a "$" sign, i.e.: echo The current value of x is $x You can even substitute the values of console variables this way, i.e $fov gives the current fov. Some aliases are set automatically, for example $arg1 to $argN are set if you supply arguments when you execute an alias.

There are two alternative ways to "" to quote a string: () and []. They work in the same way as "", with the difference that they can be nested infinitely, and that they may contain linefeeds (useful for larger scripts). () is different from [] in that it evaluates the commands contained in it _before_ it evaluates the surrounding command, and substitutes the results. () bracketed strings are called expressions, and combined with some commands made especially for "programming", you have a minimal language:

    + A B      
    - A B      
    * A B      
    div A B      
    mod A B      
(add, substract, multiply, divide, modulo): these all work like the integer operators from other languages. Example:
echo x squared is (* $x $x)
    = A B      
    < A B      
    > A B      
    strcmp A B      
(equals, lessthan, greaterthan, stringcompare): comparison operators that return 1 for true and 0 for false.
    if cond true false      
executes the true or false part depending on wether cond is "0" or something else. Example:
if (< $x 10) [ echo "x is" $x ] [ echo "x is too big" ]
    loop N body      
evaluates body N times, and sets the alias "i" from 0 to N-1 for every iteration. Example:
loop 10 [ echo $i ]
    while cond body      
evaluates body while cond evaluates to true. Note that cond here has to have [], otherwise it would only be evaluated once. Example (same result as the "loop" example):
alias i 0; while [ (< $i 10) ] [ echo $i; alias i (+ $i 1) ]
    concat S...      
concatenates all the arguments into alias "s"
    concatword S...      
same as concat but without spaces between the elements.
    at S N      
grabs the Nth word out of string S and puts it into alias "s"
    onrelease A      
only executes A if the command is executed on the release of a key/button (must be in an action in a bind or an alias in a bind). 

variables that are only really useful when used as value:

    $editing      
true when in edit mode
    $flrceil      
0 when the player looks at the floor, and 2 when looking at the ceiling.
 

How cube works
The cube engine is simplicity itself. The whole map consists of a large 2D array of "cubes", each with a floor and ceiling height, textures (for floor/ceiling/wall) and other properties. These cubes are grouped 2x2 at a time recursively into a "quad tree", which is used hold bigger cubes which can be rendered faster. For those who have edited doom, this is very similar to having a lot of square sectors but at overlapping sizes. This is results in a map that can have no room over room (yet), and is pretty cubic, except for the odd slope/slant here and there.

The floor size of a single unit (single cube) is similar to about 16x16 units in games such as doom & quake, so a staircase step is usually 1 unit, a wall 8 units high etc.

Cube renders this world by first determining which cubes are visible using a "dynamic occlusion culling" algorithm and frustrum culling. You can see the effect of this when you switch to edit mode (E), and then fly out above a map: you'll see parts of the map dropping away as you move. The remaining cubes are then rendered in their most efficient size (i.e. cube will render a mixture of 1x1 2x2 4x4 etc. size cubes, depending on wether they have the same properties: height, texturing etc.).

if you are on a fast machine, or you are playing a simple/small map, cube will simply render all of these visible cubes (this is indicated by LOD at its maximum of 250 on the hud). Cube can however make complex maps run fast even on slower computers by a technique called LOD: this will render cubes that are further away using bigger approximations (2x2 and up), even the properties of the constituent cubes don't match exactly. This reduces the amount of polys to be rendered tremendously, and thus allows even slow machines to have a consistent frame rate (cube will adapt the LOD figure every frame to aim for the fps you specify). The downside is of course that if the approximations are visible closeup, this can lead to ugly graphical glitches (this is called "popup" because it changes as you move). So in the end the choice is up to you: good fps or constant visual quality (most engines only cater for the latter).