Editing Reference Guide

From Platinum Arts Sandbox Free 3D Game Maker
Revision as of 10:06, 21 January 2008 by Mike (Talk | contribs)

Jump to: navigation, search

Sandbox Mapping Command Reference (thanks to Aard for permission to copy the text)

   * Editing
         o edittoggle
         o dragging
         o editdrag
         o selcorners
         o moving
         o editmovedrag
         o cancelsel
         o editface
         o gridpower
         o edittex
         o gettex
         o selextend
         o passthrough
         o reorient
         o flip
         o rotate
         o undo
         o redo
         o copy
         o paste
         o editcopy
         o editpaste
         o replace
         o editmat
         o recalc
         o havesel
   * Heightfield
         o hmapedit
         o hmapselect
         o hmapcancel
         o selectbrush
         o clearbrush
         o brushvert
         o brushx
         o brushy
   * Entity
         o newent
         o delent
         o entflip
         o entpush
         o entrotate
         o entmoving
         o entdrop
         o dropent
         o trigger
         o platform
         o entselect
         o entloop
         o entcancel
         o enthavesel
         o entget
         o insel
         o et
         o ea
         o entset
         o entproperty
         o entfind
         o clearents
         o replaceents
         o entautoview
   * Settings
         o undomegs
         o showsky
         o outline
         o wireframe
         o allfaces
         o showmat
         o optmats
         o entselradius
         o entselsnap
         o entitysurf
         o selectionsurf
         o gravity and jump value
   * Map and Config
         o map
         o sendmap
         o getmap
         o savemap
         o savecurrentmap
         o newmap
         o mapenlarge
         o mapmsg
         o texturereset
         o materialreset
         o texture
         o fog
         o fogcolour
         o waterspec
         o waterfog
         o watercolour
         o shader
         o fastshader
         o setshader
         o setpixelparam
         o setvertexparam
         o music
         o N
         o sound
         o mapsound
         o mapmodel
         o mmodel
         o importcube
         o lodsize
         o writeobj
   * Lighting
         o ambient
         o skylight
         o calclight
         o patchlight
         o fullbright
         o lerpangle
         o lerpsubdiv
         o lerpsubdivsize
         o lightprecision
         o lighterror
         o lightlod
         o blurlms
         o blurskylight
         o dumplms
   * Entity Types
         o "light"
         o "spotlight"
         o "envmap"
         o "sound"
         o "playerstart"
         o "base"
         o "teleport"
         o "teledest"
         o "jumppad"
         o "mapmodel"
         o "box"
         o "platform"
         o "elevator"
         o "respawnpoint"
         o "particles"
   * The HUD
         o hidestats
         o hidehud

Editing

edittoggle

Switches between map edit mode and normal (default key: e). In map edit mode you can select bits of the map by clicking or dragging your crosshair on the cubes (using the "attack" command, normally MOUSE1), then use the commands below to modify the selection. While in edit mode, physics & collision don't apply (noclip), and key repeat is ON.

dragging 0/1

Select cubes when set to 1. stop selection when set to 0

editdrag

Select cubes and entities. (default: left mouse button)

selcorners

Select the corners of cubes. (default: middle mouse button)

moving 0/1

set to 1 to turn on. when on, it will move the selection (cubes not included) to another position. the plane on which it will move on is dependent on which side of the selection your cursor was on when turned on. set to 0 to turn off moving. if cursor is not on selection when turned on, moving will automatically be turned off.

editmovedrag

if cursor is in current cube selection, holding will move selection. otherwise will create new selection.

cancelsel

Cancels out any explicit selection you currently have (default: space).

editface D N

This is the main editing command. D is the direction of the action, -1 for towards you, 1 for away from you (default: scroll wheel). N=0 to push all corners in the white box (hold F). N=1 create or destroy cubes (default). N=2 push or pull a corner you are pointing at (hold Q).

gridpower N

Changes the size of the grid. (default: g + scrollwheel)

edittex D

Changes the texture on current selection by browsing through a list of textures directly shown on the cubes. D is the direction you want to cycle the textures in (1 = forwards, -1 = backwards) (default: y + scrollwheel). The way this works is slightly strange at first, but allows for very fast texture assignment. All textures are in a list. and each time a texture is used, it is moved to the top of the list. So after a bit of editing, all your most frequently used textures will come first, and the most recently used texture is set immediately when you press the forward key for the type. These lists are saved with the map.

gettex

moves the texture on the current selection to the top of the texture list. Useful for quickly texturing things using already textured geometry.

selextend

Extend current selection to include the cursor.

passthrough

normally cubes of equal size to the grid are given priority when selecting. passthrough removes this priority while held down so that the cube the cursor is directly on is selected. Holding down passthrough will also give priority to cube over entities. (default: alt)

reorient

Change the side the white box is on to be the same as where you are currently pointing. (default: shift)

flip

Flip (mirror) the selected cubes front to back relative to the side of the white box. (default: x)

rotate D

Rotates the selection 90 degrees around the side of the white box. Automatically squares the selection if it isn't already. (default: r + scroll wheel)

undo

Multi-level undo of any of the changes caused by the above operations (default: z [or u]).

redo

Multi-level redo of any of the changes caused by the above undo (default: i).

copy

paste

Copy copies the current selection into a buffer. Upon pressing 'paste', a selection box will be created to identify the location of the pasted cubes. Releasing the 'paste' button will actually paste the cubes. So combined with the 'moving' command you can easily place and clone sets of cubes. If the current gridsize is changed from the copy, the pasted copy will be stretched by the same factor.

editcopy

editpaste

Will copy cubes as normal copy, but also features entity copies. There are three different methods of use:

   * If no entity is explicitly selected, editcopy will copy the selected cube, just like normal the normal 'copy' command.
   * If one or more entities are selected, editcopy will copy the last entity selected. Editpaste will create a new entity using copy as the template if no entities are selected, otherwise it will overwrite all selected entities with the copied ent.
   * If there are both entity and cube selections, editcopy will copy the entire selection. In other words, when editpaste is used it will paste the cube selection along with all of the entities that were selected.

replace

Repeats the last texture edit across the whole map. Only those faces with textures matching the one that was last edited will be replaced.

editmat

Changes the type of material left behind when a cube is deleted. Currently the following types of materials are supported:

   * air: the default material, has no effect.
   * water: acts as you would expect. Renders the top as a reflection/refraction and the sides as a waterfall if it isn't contained. Should be placed with a floor at the bottom to contain it. Shows blue volume in edit mode.
   * lava: renders the top as a glowing lava flow and the sides as lavafalls if it isn't contained. Shows orange volume in edit mode.
   * clip: an invisible wall that blocks players movement. Is ideally used to keep players "in bounds" in a map. Can be used sparingly to smooth out the flow around decoration. Shows red volume in edit mode.
   * noclip: cubes are always treated as empty in physics. Shows green volume in edit mode.
   * glass: a clip-like material with a blended/reflective surface. Glass also stops bullets. Will reflect the closest envmap entity, or if none is in range, the skybox. Shows cyan volume in edit mode.

recalc

Recalculates scene geometry. This also will regenerate any envmaps to reflect the changed geometry, and fix any geometry with "bumpenv*" shaders to use the closest available envmaps. This command is also implicitly used by calclight.

havesel

Returns the number of explicitly selected cubes for scripting purposes. Returns 0 if the cubes are only implicitly selected. Heightfield

Heightfields in Sauerbraten are very different from other games. They are just normal cubes and are NOT special meshes. Really, it's just another way of editing the same geometry. Editing this way is a bit different from normal editing, but just as easy. First, instead of selecting cubes, you select a brush (B+wheel) and textures (middle mouse button while in heightmap mode to toggle). Once this is done, you can apply the brush to all cubes that match the textures you've selected. Making hills and valleys can be quite fast when using this feature. By default all textures are automatically selected.

hmapedit 0/1

Set to 1 to turn on heightmap mode (default: hold LCTRL or use H to toggle on and off). In heightmap mode the cursor will turn bright green when hilighting heightmap cubes and the editface command will now use brushes to edit heightmap cubes. In order to avoid accidental edits only heightmap cubes are editable in this mode. If a cubic selection is present, then only cubes within the column of the selection will be modifiable.

hmapselect

Selects the texture and orientation of the hilighted cube (default: mouse buttons while in heightmap mode, or H key). If hmapselall is set to 1, then all textures are automatically selected, and this command will simply select the orientation. All cubes, of equal or larger size, that match the selection will be considered part of the heightmap.

hmapcancel

Return the heightmap texture selection to default (ie: select all textures).

selectbrush D

Switches between the various height map brushes (default: hold B + wheel).

clearbrush

This resets the current brush that is used during heightmap mode editing.

brushvert x y depth

A brush is a 2D map that describes the depth that the editface commands should push into the cubes at various points. The first two parameters of brushvert are the X and Y coordinates, respectively, of a vert on this 2D map. The last parameter is used to set the depth. NOTE: if all of the brush verts are 0, then a smoothing filter will be applied instead of the brush. This filter will affect the same square sized region as the brush.

brushx

brushy

Along with the 2D map, all brushes also have a handle. This handle is a reference point on the 2D map which defines where the brush is relative to the editing cursor. These two variables define the brush handle's coordinates. Entity

newent type value1 value2 value3 value4

Adds a new entity where (x,y) is determined by the current selection (the red dot corner) and z by the camera height, of said type. Type is a string giving the type of entity, such as "light", and may optionally take values (depending on the entity). The types are defines below in the Entity Types section.

delent

deletes the selected entities

entflip

flip the selected entities. cube selection serves as both reference point and orientation to flip around.

entpush D

push the selected entities. cube selection serves as orientation to push towards.

entrotate D

rotate the selected entities in relation to the cube selection.

entmoving 0/1/2

set to 1 to turn on. if an entity is under the cursor when turned on, the entity will get toggled selected/unselected (set to 2 to add to selection instead of toggle). if selected, one can move the entity around using the cursor. if multiple entities are selected, they will also move. the plane on which the entity will be moved is dependent on the orientation of the cube surrounding the entity. set to 0 to turn off moving. if no entity is under the cursor when turned on, it will automatically turn off.

entdrop N

variable controlling where entities created with "newent" will be placed. N=0 place entities at your current eye position. N=1 drop entities to the floor beneath you. Lights, however, will be placed at your current eye position as for N=0. N=2 place entities at the center of the currently selected cube face. If a corner is selected, the entity will be placed at the corner vertex. N=3 behaves as with N=2, except all entities, including lights, will then bedropped from that position to whatever floor lies beneath. This mode is useful for placing objects on selected floors. Lights are also dropped to the floor, unlike for N=1.

dropent

Positions the selected entity according to the entdrop variable.

trigger T N

Sets the state of all locked triggers with tag T to N.

platform T N

If N = 0, stops all platforms or elevators with tag T. If N = 1, causes all platforms or elevators with tag T to move forwards or up, respectively. If N = -1, causes all platforms or elevators with tag T to move backwards or down, respectively.

entselect X

Takes a boolean expression as argument. Selects all entities that evaluate to true for the given expression. examples:

   * entselect insel // select all entities in blue selection box
   * entselect [ strcmp (et) "shells" ] // select all shells in map

entloop X

Loops through and executes the given expression for all selected entities. Note that most of the entity commands are already vector based and will automatically do this. Therefore they don't need to be explicitly executed within an entloop. Entloop is to be used when more precise custom instructions need to be executed on a selection.

Another property of entloop is that entity commands within it, that are normally executed on the entire selection, will only be done on the current entity iterator. In other words, the two following examples are equivalent:

   * entset light 120 0 0 0
   * entloop [ entset light 120 0 0 0 ]

The entset in the second statement will NOT be applied n squared times. Entloops can be nested.

entcancel

Deselect all entities.

enthavesel

Returns the number of entities in the current selection.

entget

Returns a string in the form of "type value1 value2 value3 value4". This string is the definition of the current selected entity. For example, the following statement will display the values of all the entities within the current selection:

   * entloop [ echo (entget) ]

Outside of an entloop, the last entity selected will be returned. Normally, if an entity is highlighted by the cursor, it will only be considered as in the selection if an explicit one does not exisit (like cubic selections). However, entget is special in that it considers the highlighted entity as being the last entity in the selection. Entget is used to generate the default entdisplay at the bottom of the screen.

insel

Returns true if the selected entity is inside the cube selection

et

Cuts out the 'type' field from entget.

ea N

Cuts out the given 'value' field from entget. Attributes are numbered 0 to 3.

entset type value1 value2 value3 value4

Change the type and attributes of the selected entity. To quickly bring up the entset command in the console press '.' (default: period). It will come pre-filled with the values of the current entity selection (from entget).

entproperty P A

Changes property P (0..3) of the selected entities by amount A. For example "entproperty 0 2" when executed near a lightsource would increase its radius by 2.

entfind type type value1 value2 value3 value4

Select all entities matching given values. '*' and blanks are wildcard. All ents that match the pattern will be ADDED to the selection.

clearents type

Deletes all entities of said type.

replaceents type value1 value2 value3 value4

Replaces the given values for the selected entity and all entities that are equal to the selected entity. To quickly bring up the replaceents command in the console press ',' (default: comma). It will come pre-filled with the values of the current entity selection.

entautoview N

Centers view on selected entity. Increment through selection by N. ex: N = 1 => next, N = -1 => previous. entautoviewdist N, sets the distance from entity. Settings

undomegs N

Sets the number of megabytes used for the undo buffer (default 5, max 100). Undo's work for any size areas, so the amount of undo steps per megabyte is more for small areas than for big ones.

showsky B

This variable controls whether explicit sky polygons are outlined (in purple) in edit mode. Default = 1.

outline B

This variable controls whether geometry boundaries (outlines) are shown. Default = 0.

wireframe 0/1

Turns on wireframe drawing of the map.

allfaces 0/1

when on, causes the texturing commands to apply the new texture to all sides of the selected cubes rather than just the selected face.

showmat B

This variables whether volumes are shown for invisible material surfaces in edit mode. Material volumes may also be selected while this is enabled. Default = 1.

optmats B

This variables controls whether material rendering should be optimized by grouping materials into the largest possible surfaces. This will always make rendering faster, so the only reason to disable it is for testing. Default = 1.

entselradius N

Sets the 'handle' size of entities when trying to select them. Larger sizes means it should be easier to select entities.

entselsnap 0/1

Turns on snap-to-grid while draggin entities. (default: 6)

entitysurf 0/1

When on, you will move with the entity as you push it with the scroll wheel. Of course, in order to push an entity, you must be holding it.

selectionsurf 0/1

When on, you will move with the selection box as you push it with the scroll wheel. Of course, in order to push a selection box, you must be holding it. Map and Config

gravity N Changes the gravity. For N enter a number. Try entering -100 or 1000, what happens?

jumpvel N Changes the height of the players jump. N is a number. Try entering 1000.

map name

Loads up map "name" in the gamemode set previously by "mode". A map given as "blah" refers to "packages/base/blah.cgz", "mypackage/blah" refers to "packages/mypackage/blah.cgz". The menu has a set of maps that can be loaded. See also map in the gameplay docs.

At every map load, "data/default_map_settings.cfg" is loaded which sets up all texture definitions etc. Everything defined in there can be overridden per package or per map by creating a "package.cfg" or "mapname.cfg" which contains whatever you want to do differently from the default. It can also set up triggers scripts per map etc.

When the map finishes it will load the next map when one is defined, otherwise reloads the current map. You can define what map follows a particular map by making an alias like (in the map script): alias nextmap_blah1 blah2 (loads "blah2" after "blah1").

sendmap

Saves the current map (without lightmaps) and sends it to the server so other clients may download it. Only works in coopedit game mode.

getmap

Gets a map from the server if one is available. Automatically loads the map when done. Only works in coopedit game mode.

savemap name

savecurrentmap

Saves the current map, using the same naming scheme as "map". Makes a versioned backup to "mapname_N.BAK" if a map by that name already exists, so you can never lose a map. With "savemap", if you leave out the "name" argument, it is saved under the current map name. With "savecurrentmap", the map is saved with the name determined by the current game. Where you store a map depends on the complexity of what you are creating: if its a single map (maybe with its own .cfg) then the "base" package is the best place. If its multiple maps or a map with new media (textures etc.) its better to store it in its own package (a directory under "packages"), which makes distributing it less messy.

newmap size

Creates a new map of size^2 cubes (on the smallest grid size). 10 is a small map, 15 is a large map but it goes up to 20.

mapenlarge

Doubles the dimensions of the current map.

mapmsg "Title by Author"

sets the map msg, which will be displayed when the map loads. Either use the above format, or simply "by Author" if the map has no particular title (always displayed after the map load msg).

texturereset

Sets the texture slot to 0 for the subsequent "texture" commands.

materialreset

Resets the material texture slots for subsequent "texture" commands.

texture TYPE FILENAME ROT X Y SCALE

FILENAME Binds the texture indicated to the current texture slot, then increments the slot number depending on TYPE. TYPE Specifying the primary diffuse texture advances to the next texture slot, while secondary types fill additional texture units in the order specified in the .cfg file. Allows secondary textures to be specified for a single texture slot, for use in shaders and other features, the combinations of multiple textures into a single texture are performed automatically in the shader rendering path:

   * "c" or 0 for primary diffuse texture (RGB)
   * "u" or 1 for generic secondary texture
   * "d" for decals (RGBA), blended into the diffuse texture if running in fixed-function mode. To disable this combining, specify secondary textures as generic with 1 or "u"
   * "n" for normal maps (XYZ)
   * "g" for glow maps (RGB), blended into the diffuse texture if running in fixed-function mode. To disable this combining, specify secondary textures as generic with 1 or "u"
   * "s" for specularity maps (grey-scale), put in alpha channel of diffuse ("c")
   * "z" for depth maps (Z), put in alpha channel of normal ("n") maps
   * "e" for environment maps (skybox), uses the same syntax as "loadsky", and set a custom environment map (overriding the "envmap" entities) to use in environment-mapped shaders ("bumpenv*world")

This may also be a material name, in which case it behaves like 0, but instead associates the slot with a material. ROT Specifies preprocessing on the image, currently only rotation and flipping:

   * 0 = none
   * 1 = 90 CW
   * 2 = 180
   * 3 = 270 CW
   * 4 = X flip
   * 5 = Y flip

X and Y These are the X and Y offset in texels. SCALE This will multiply the size of the texture as it appears on world geometry.

fog N

Sets fog distance to N (default: 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 or maps which give you low fps.

fogcolour N

The colour of the fog, which may be represetned as a decimal integer from 0..16777215, or a hexidecimal value from 0x000000..0xFFFFFF (note the "0x") in "0xRRGGBB" format, where R is red, G is green, and B is blue values (default: 8427955 (0x8099B3)).

waterspec N

This sets the percentage of light water shows as specularity (default: 150).

waterfog N

Sets the distance beneath the surface of water at which it fogs, from 1..10000 (default: 150).

watercolour R G B

Sets the the colour of fog inside the water to the specified R G B value from 0..255 (default: 20 80 80). Used to give water some colour.

shader TYPE NAME VS PS

defines a shader NAME with vertex shader VS and pixel shader PS (both in ARB OpenGL 1.5 assembly format). See data/stdshader.cfg for examples. These definitions can be put in map cfg files or anywhere else, and will only be compiled once. TYPE indicates what resources the shader provides, or what backup method should be used if the graphics card does not support shaders. TYPE is either 0 for default shader, or 1 for normal-mapped world shaders. Requires DX9 / shader 2 class hardware (radeon 9500 or better, geforce 5200 or better) to run (older hardware will default to basic rendering).

fastshader NICE FAST N

Associates shader FAST so that it will run in place of shader NICE if shaderdetail is less than or equal to N.

setshader NAME

Sets a previously defined shader as the current shader. Any following texture slots (see "texture" command) will have this shader attached to them. Any pixel or vertex parameters are reset to the shader's defaults when this command is used.

setpixelparam INDEX X Y Z W

Overrides a pixel parameter for the current shader. Any following texture slots will use this pixel parameter until its value is set/reset by subsequent commands. INDEX is the index of a program environment parameter (program.env[10+INDEX]) to the pixel program of the current shader. It's value is set to the vector (X, Y, Z, W). Coordinates that are not specified default to 0.

setvertexparam INDEX X Y Z W

Overrides a vertex parameter for the current shader. Any following texture slots will use this vertex parameter until its value is set/reset by subsequent commands. INDEX is the index of a program environment parameter (program.env[10+INDEX]) to the vertex program of the current shader. It's value is set to the vector (X, Y, Z, W). Coordinates that are not specified default to 0. Shader Pixel params Vertex params Texture slots stdworld c The default lightmapped world shader. decalworld c, d Like stdworld, except alpha blends decal texture on diffuse texture. glowworld

   * 0: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk

c, g Like stdworld, except adds light from glow map. bumpworld c, n Normal-mapped shader without specularity (diffuse lighting only). bumpglowworld

   * 0: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk

c, n, g Normal-mapped shader with glow map and without specularity. bumpspecworld

   * 1: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk

c, n Normal-mapped shader with constant specularity factor. bumpspecmapworld same as above c, n, s Normal-mapped shader with specularity map. bumpspecglowworld

   * 0: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk
   * 1: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk

c, n, g Normal-mapped shader with constant specularity factor and glow map. bumpspecmapglowworld same as above c, n, s, g Normal-mapped shader with specularity map and glow map. bumpparallaxworld

   * 2: Scale, Bias - Scales the heightmap offset

c, n, z Normal-mapped shader with height map and without specularity. bumpspecparallaxworld

   * 1: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk
   * 2: Scale, Bias - Scales the heightmap offset

c, n, z Normal-mapped shader with constant specularity factor and height map. bumpspecmapparallaxworld same as above c, n, s, z Normal-mapped shader with specularity map and height map. bumpparallaxglowworld

   * 0: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk
   * 2: Scale, Bias - Scales the heightmap offset

c, n, z, g Normal-mapped shader with height and glow maps, and without specularity. bumpspecparallaxglowworld

   * 0: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk
   * 1: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk
   * 2: Scale, Bias - Scales the heightmap offset

c, n, z, g Normal-mapped shader with constant specularity factor, and height and glow maps. bumpspecmapparallaxglowworld same as above c, n, s, z, g Normal-mapped shader with specularity, height, and glow maps. bumpenv*

   * 3: Rk, Gk, Bk - multiplies the environment map color by the factors Rk, Gk, Bk

Any of the above bump* shader permutations may replace "bump" with "bumpenv" (i.e. bumpenvspecmapworld), and will then reflect the closest envmap entity (or the skybox if necessary). They support all their usual texture slots and pixel params, in addition to the envmap multiplier pixel param. If a specmap is present in the given shader, the raw specmap value will be scaled by the envmap multipliers (instead of the specmap ones), to determine how much of the envmap to reflect. A calclight (if it has not been done before) or recalc (thereafter) is also needed by this shader to properly setup its engine state.

music name [ondone]

Plays song "name" (with "packages" as base dir). This command is best used from map cfg files or triggers. Evaluates ondone when the song is finished, or just keeps looping the song if ondone is missing. Example: music "songs/music.ogg" [ echo "Song done playing!" ]

N = registersound name V

Registers sound "name" (see for example data/sounds.cfg). This command returns the sound number N, which is assigned from 0 onwards, and which can be used with "sound" command below. if the sound was already registered, its existing index is returned. registersound does not actually load the sound, this is done on first play. V is volume adjustment; if not specified (0), it is the default 100, valid range is 1-255.

sound N

Plays sound N, see data/sounds.cfg for default sounds, and use registersound to register your own. for example, sound 0 and sound (registersound "aard/jump") both play the standard jump sound.

mapsound name V N

Registers sound "name" as a map-specific sounds. These map-specific sounds may currently only be used with "sound" entities within a map. The first map sound registered in a map has index 0, and increases afterwards. V is volume adjustment; if not specified (0), it is the default 100, valid range is 1-255. N is the maximum number instances of this sound that are allowed to play simultaneously; the default is only 1 instance. If N is -1, then an unlimited number of instances may play simultaneously.

mapmodel R H T N SH

mmodel N

NOTE: the mapmodel form is deprecated.. set additional properties of a mapmodel in its .cfg Registers a mapmodel that can be placed in maps using newent mapmodel (see newent). N is the name, R is the square radius, H the height, T the texture slot to skin the model with (0 for default skin), and SH toggles whether the it will cast shadows (not given or 1 casts shadows, 0 has no shadows). The radius R and height H define the collision bounding box of the model (if either is 0, players won't collide with the mapmodel). Name N is the name of a folder inside packages/models folder. Loaded from that folder are: tris.md2 and skin.jpg (and if not available, skin.png, or the same from the parent folder to allow skin sharing).

Example: mapmodel 4 32 0 "tree1"

This map model is loaded from packages/models/tree1/. It has a collision box 8x8x32 in size (x=2*R, y=2*R, z=H). It uses the model's default skin (texture slot=0). It casts shadows (default).

importcube N

Imports a cube map (.cgz) and converts it to sauerbraten's map format. N is the name of the map, without the .cgz. The map file must reside in packages/cube, which is because that folder has a package.cfg that sets the default cube textures. If the cube map in question has a custom texture list, it will have to be adapted manually. Currently converts everything relatively faithfully, except heighfields which are converted as best as possible but not always accurately. Slopes tend to work faultlessly, landscape style stuff is usuable, but curves/arches are problematic, and may have to be redone. All entities are converted though mapmodels may not be present, and light entities are useless because of their 2d nature, so probably the first thing to do after converting a map is /clearents light, and place some new lights. Pickups and other items may spawn inside the walls because they have no proper Z value, you may have to correct these manually. The importcube command does not automatically save the map, you still have to do a /savecurrentmap which will create packages/cube/N.ogz. Reload the map to be able to pick up stuff. Waterlevel is also not supported, you will have to add water using the new material system.

lodsize N

Turn on world LOD (level of detail) for this map if N=32 (default is N=0, off). The state of this command is saved with the map. N is the size of the blocks that will be used for LOD, in theory you can use 16 or 64 as well, but this usually just either just hurts performance, memory usage or visual quality. Use 32 unless you know exactly what you are doing. After setting this var, LOD will only become apparent after a "recalc" (and "calclight") command. Turning LOD on for a map is only useful on really large maps with lots of detail where you can see for half a mile, on smaller maps it will have no effect and only wastes memory / lightmap space. LOD works on entire vertex array blocks at a time, and is dependent on the "loddistance" variable which the player can set to trade off speed vs visual quality.

writeobj N

Writes out the current map as N.obj, so you could use sauerbraten as a generic modeller with any program/engine that uses meshes. The meshes aren't very optimal and don't have texture/lighting information.

flipnormalmapy D N

Normalmaps generally come in two kinds, left-handed or righ-handed coordinate systems. If you are trying to use normalmaps authored for other engines, you may find that the lighting goes the wrong way along one axis, this can be fixed by flipping the Y coordinate of the normal. This command loads normalmap N (MUST be 24bit .tga), and writes out a flipped normalmap as D (also tga).

mergenormalmaps H N

Normalmaps authored for Quake 4 often come as a base normal map, with seperate height offset file *_h.tga. This is NOT a height file as used for sauerbraten parallax, instead its detail to be blended onto the normals. This command takes normalmap N and a _h file H (both MUST be 24bit .tga), and outputs a combined normalmap N (it *overwrites* N).

Lighting

ambient N

This sets the level of ambient light (default: 25), where N is interpreted as a grayscale light value 0..255, or rather, the minimum amount of light that will a surface will get, even when no light entities are shine on the surface.

skylight R [G B]

This enables the skybox to "emit" light, that can be occluded by geometry or models in the map. A surface will cast a number of rays (currently 17), and any of them that hit the skybox will contribute a portion of the R G B light value above the "ambient" level to the surface (1/17th of the light). Effectively, the light will vary between the "ambient" value and the "skylight" value depending on how much of the skybox is visible. R G B are values in the range 0..255 (default: 0). If only R is specified it is interpreted as a grayscale light value. Use "skylight 0" to disable.

calclight Q

This calculates all lightmaps. Usually takes only a few seconds, depending on map size and settings. If you "savemap", the lightmap will be stored along with it. Q is these predefined quality settings:

   * 3: 8x anti aliasing, shadows for mapmodels with alpha (maximum quality, extremely slow)
   * 2: 8x anti aliasing, shadows for mapmodels (high quality, very slow)
   * 1: 8x anti aliasing, world shadows only (better lighting quality for huge maps, slow)
   * 0: 4x anti aliasing, world shadows only (default, good enough for most maps)
   * -1: no anti aliasing, but still shadowed (good for shadow previews)
   * -2: no anti aliasing and no shadows (VERY fast, good for lighting previews)

patchlight

This will calculate lightmaps for any newly created cubes. This will generally be much quicker than doing a "calclight", and so is very useful when editing. However, it will make very inefficient use of lightmap textures, and any new cubes will not properly cast shadows on surfaces that are already lit. It is recommended you do a "calclight" on your map before you publish it with "savemap".

fullbright B

This variable controls whether the map will be shown with lighting disabled. Fullbright 1 will disable lighting, whereas 0 will enable lighting. (Default = 0)

lerpangle A

Default = 44. This variable controls whether surface normals are interpolated for lighting. Normals are sampled at each vertex of the surface. If the angle between two surfaces' normals (which meet at a vertex) is less than A, then the resulting normal will be the average of the two. Normals are then later interpolated between the normals at the vertexes of a surface.

lerpsubdiv N

Default = 2. This allows more normals to be sampled at points along an edge between two vertexes of a surface. 2^N-1 extra normals will be sampled along the edge, i.e. the edge is split in half for every increment of N.

lerpsubdivsize N

Default = 4. This sets the minimum size to which an edge may be subdivided. Edges smaller than N or edge sections smaller than N will not be sampled.

lightprecision P

Default = 32. This is the most important variable for tweaking the lighting, it determines what the resolution of the lightmap is. As such has a BIG effect on calculation time, video memory usage, and map file size. The default is good for most maps, you may go as low as 16 if you are lighting a really small map and love hard shadows, and for bigger maps you may need to set it to 64 or so to get reasonable memory usage.

The number to watch out for is the number of lightmaps generated which are shown on the HUD (and also as output after a calclight). 1 or 2 lightmap textures is very good, over 10 lightmap textures is excessive.

The map file size is 90% determined by the lightmaps, so tweak this value to get an acceptable quality to size ratio. Look at the size of the map files, sometimes a slightly higher lightprecision can halve the size of your .ogz.

Every surface matters, even though sauerbraten attempts to compress surfaces with a uniform lightvalue, it is always a good ideas to delete parts of the world that are not part of your map. Lightprecision, lighterror, and lightlod are stored as part of map files.

lighterror E

There should be little reason to tweak this. If in your map you can see visible polygon boundaries caused by lighting, you can try stepping this down to 6 or 4 to improve quality at the expense of lightmap space. If you have an insanely large map and looking for ways to reduce file size, increasing error up to 16 may help. (Default = 8)

lightlod D

Default = 0. This will double the resolution of lightmaps (cut the lightprecision in half) if size of the surface being lit is smaller than 2^D units. This allows large maps to have pockets of detailed lighting without using a high resolution over everything. NOTE: if you feel like using this, test it thoroughly. On medium or small sized detailed maps, this command wastes space, use lightlod 0. Lightlod > 0 is only useful for huge maps

blurlms N

This variable controls whether to apply a blur filter to the lightmap after they are generated, as a post-pass. For N=0, no blur is applied. For N=1, a 3x3 blur filter is used. For N=2, a 5x5 blur filter is used. NOTE: this can cause lightmaps to mismatch at surface boundaries in complex scenes.

blurskylight N

This variable controls whether to apply a blur filter to the ambient skylight (enabled via the "skylight" command) before it is combined with the other lighting to create the final lightmap. This variable is useful for softening the skylight and making it appear more scattered. For N=0, no blur is applied. For N=1, a 3x3 blur filter is used. For N=2, a 5x5 blur filter is used.

dumplms

Dumps all lightmaps to a set of .bmps. Mostly interesting for developers, but mappers may find it interesting too. Entity Types

Entities are shown in editmode by blue sparklies, and the closest one is indicated on the HUD.

"light" radius r g b

If G and B are 0 the R value will be taken as brightness for a white light. A good radius for a small wall light is 64, for a middle sized room 128... for a sun probably more like 1000. Lights with a radius of 0 do not attenuate and may be more appropriate for simulating sunlight or ambient light; however, this comes at the cost of slightly greater map file sizes. See the lighting commands for an indepth list of all lighting related commands.

"spotlight" radius

Creates a spotlight with the given "radius" (in degrees, 0 to 90). A 90 degree spotlight will be a full hemisphere, whereas 0 degrees is simply a line. These will attach to the nearest "light" entity within 100 units of the spotlight. The spotlight will shine in the direction of the spotlight, relative to the "light" entity it is attached to. It inherits the sphere of influence (length of the spotlight) and color values from the attached light as well. Do not move these very far from the light they're or attached to or you risk them detaching or attaching to the wrong lights on a map load!

"envmap" [radius]

Creates an environment map reflecting the geometry around the entity. The optional radius overrides the maximum distance within which glass or geometry using the "bumpenv*" shaders will reflect from this environment map. If none is specified, the default is taken from the variable "envmapradius" (which defaults to 128 units), which may also be set in map cfgs. Environment maps are generated on a map load, or can be regenerated while editing using the "recalc" command. Please use the absolute minimum number of these possible. Each one uses up a decent amount of texture memory. For instance, rather than using two environment maps on each side of a window, use only one in the middle of the pane of glass. If you have a wall with many windows, place only one environment map in the middle of the wall geometry, and it should work just fine for all the windows.

"sound" N radius [size]

Will play map-specific sound N so long as the player is within the radius. However, only up to the max uses allowed for N (specified in the mapsound command) will play, even if the player is within the radius of more N sounds than the max. By default (size 0), the sound is a point source. Its volume is maximal at the entity's location, and tapers off to 0 at the radius. If size is specified, the volume is maximal within the specified size, and only starts tapering once outside this distance. Radius is always defined as distance from the entity's location, so a size greater than or equal to the radius will just make a sound that is always max volume within the radius, and off outside.

"playerstart"

Spawn spot, yaw is taken from the current camera yaw.

"teleport" N

"teledest" [Y] N

Creates a teleport connection, teleports are linked to a teledest with the same N (of which there should be exactly one). N can be 0..255. Y is the yaw of the destination and is initially taken from the current camera yaw, it cannot be specified when creating the entity.

"jumppad" Z [Y] [X]

A jumppad entity which gives you a push in the direction specified. For example, "jumppad 30 5" makes you bounce up quite a bit and also pushes you forward a bit (so it is easier to land on a higher platform). This entity does not render anything, so you are responsible for creating something that looks logical below this entity.

"mapmodel" [Y] N T R

A map model, i.e. an object rendered as md2/md3 which you collide against, cast shadows etc. Y is the yaw of the model and is initially taken from the current camera yaw, it cannot be specified when creating the entity. N determines which mapmodel you want, this depends on "mapmodel" declarations in the maps cfg file. T specifies mapmodel behaviour such as triggers, see table below. R is the trigger number, 0 means no trigger. This number specifies what trigger to activate, and in addition, the alias "level_trigger_Trigger" will be executed, where Trigger is substituted accordingly (this allows you to script additional actions upon a trigger, i.e. put this into your map cfg file to print a message: alias level_trigger_1 "echo A door opened nearby"). The alias "triggerstate" will hold a value of -1, 0, or 1 indicating how the trigger was activated. Type Trigger states Trigger how often Sound 0 0 loops mapmodel animation 1 1 do trigger animation when touched for the first time only and return to starting position (best for switches, use switch/lever models) 2 1 rumble same as above but with sound 3 toggle (0/1) 1 do trigger animation when touched for the first time only and stay in toggled position (best for switches, use switch/lever models) 4 toggle (0/1) 1 rumble same as above but with sound 5 N do trigger animation when touched every time and return to starting position (best for switches, use switch/lever models) 6 N rumble same as above but with sound 7 toggle (0/1) N do trigger animation when touched every time and toggle positions (best for reversible switches, use switch/lever models) 8 toggle (0/1) N rumble same as above but with sound 9 closed/open (0/1) 1 door? opened by approach first time only, stays open afterwards. Collides while closed. (use door specific models) 10 closed/open (0/1) N door? opened by approach every time, closes after 5 seconds. Collides while closed. (use door specific models) 11 locked (-1) 0/N door? opened/closed only by associated trigger. When approached while closed, collides and invokes level trigger with triggerstate -1. (use door specific models) 12 disappear (0) 1 do trigger animation once when touched, disappear after (good for triggers that look more like pickups, such as the carrot) 13 disappear (0) 1 rumble same as above but with sound 14 disappear (-1) 0 like 11, but disappears after opening. 29 disappear (0) 1 end? END LEVEL

Be careful when using "switch many" for thing that affect gameplay, such as opening doors, as it can be confusing. Best is to reserve a particular model to mean "many" and others "once". All types >0 are snapped to 15 degree angles for orientation.

"box" [Y] N W

Y is the yaw of the model and is initially taken from the current camera yaw, it cannot be specified when creating the entity. N determines which mapmodel you want, this depends on "mapmodel" declarations in the maps cfg file. W is the weight of the box where the heavier it is the less it moves; if W is not specified or 0, it defaults to 25.

"platform" [Y] N T S

"elevator" [Y] N T S

Like a mapmodel, except it moves around and carries players, monsters, or other dynamic entities. Y is the yaw of the model and is initially taken from the current camera yaw, it cannot be specified when creating the entity. N determines which mapmodel you want, this depends on "mapmodel" declarations in the maps cfg file. A platform will travel horizontally back and forth along the direction of its yaw, while an elevator will travel only up and down. When they hit an obstacle such as geometry, they will reverse their direction. T is a tag that may be used to start or stop the elevator with the "platform" command; if a non-zero tag is specified, then the platform or elevator will stop upon hitting an obstacle, rather than reversing direction. S is the speed at which the entity moves, in units per second; if S is not specified or 0, it defaults to to 8.

"respawnpoint"

A respawnpoint for classic SP mode (see "SP Respawning"), when the player dies, they will repsawn at the last one of these they touched, otherwise they start at the playerstart entity.

"particles" type value1 value2 value3 value4

A particle emitter. Particles includes many of the effects as seen for weapons, explosions, and lens flares. Type Values Description 0 fire with smoke 1 direction (0..5) smoke vent 2 direction (0..5) water fountain 3 size (0..40), rgb (0x000..0xFFF) explosion, i.e. fire ball [*expensive compared to other particles] 4 direction (0..5), length(0..100), rgb (0x000..0xFFF) tape/flare 4 direction (256+effect), length(0..100), rgb (0x000..0xFFF) multiple tape/flare effect [*consider experimental] Effect Description 0..2 circlular 3..5 cylinderical shell 6..11 conic shell 12..14 cubic volume 15..30 planar surface 21 sphere note: +32 to reverse direction of tapes 5 percentage (0..100), rgb (0x000..0xFFF) capture meter, i.e. rgb vs black 6 percentage (0..100), rgb (0x000..0xFFF) vs capture meter, i.e. rgb vs bgr 32 red (0..255), green (0..255), blue (0..255) plain lens flare 33 red (0..255), green (0..255), blue (0..255) lens flare with sparkle center 34 red (0..255), green (0..255), blue (0..255) sun lens flare, i.e. fixed size regardless of distance 35 red (0..255), green (0..255), blue (0..255) sun lens flare with sparkle center The HUD

On the bottom left of the screen are a bunch of stats. You'll find out what they mean below.

   * cube: the number of cubes in the current selection. Only the visible (leaf)cubes are counted.
   * fps: frames per second
   * ond: number of cubes in the system. This includes parent cubes, copied cubes,and undos.
   * va: number of vertex arrays used to store vertecies in the map. you probablydon't need to use this.
   * vtr: number of triangles currently being displayed. will be a useful stat whenculling is done.
   * vvt: number of vertecies currently being displayed. again, useful when cullingis done.
   * tri: number of triangles in the entire map
   * wvt: number of vertecies in the entire map
   * evt: misc rendering effects. stuff like particles displayed, or text written on screen.

hidestats 0/1

Turn on to hide the above stats

hidehud 0/1

Turn on to hide all HUD elements