Map config

From Platinum Arts Sandbox Free 3D Game Maker
Jump to: navigation, search

Normally the defaults will suffice, but for that occasion when you wish to perhaps use a specific set of textures, play some music, write some cubescript triggers etc, you can use a map configuration file. Pretty much anything placed in a regular cfg file can be placed in one of these. But take note these can't overwrite persistent variables and overwrite binds without some special tinkering. it's a safety thing

Things to do

level_triggers

level triggers are the 4th mapmodel tag, you can assign a specific level trigger action. and don't forget the special aliases that're trigger specific. The following is for a type 11 and some sort of a switch combo

level_trigger_1 = [if (= $triggerstate -1) [echo "The door is locked"] [echo "The doors screeches violently as it flies open"]]

in fact, that's just an example of what you can do with triggers, there are plenty more possibilities, the next one would be a type 12, a triggered once only.

level_trigger_2 = [setfullscreenshader bloom - 200; echo "it becomes hard to see"]

Loading Skyboxes

The two commands useful in loading a skybox is /skybox, and /spinsky. /loadsky was removed and turned into an alias. the change allowed /skybox to echo the current skybox

To even consider loading a skybox. there have to be _dn, _up, _ft, _rt, _lf and _bk versions of it. those are down, up, front, right, left and back

an example of such a command is /skybox skyboxes/dunes

Playing Background Music

The music command is /music (file) [ondone]

The file is a song you specify to play, if an ondone isn't specified, it'll just loop over and over. if an ondone is specified, a script will be executed once it's done

eg /music music/sample.ogg [echo "finished playing"]

Loading textures

There are 6 key commands in loading textures.

  • materialreset
  • setshader
  • setpixelparam
  • setvertexparam
  • texturereset
  • texture

They all perform different functions, texturereset will clear the texture list, meaning it has to be populated from, the begining. Materialreset will do the same, but only for materials (as texturereset leaves materials unaffected). setshader is used to set a shader for the textures, so they can take advantage of bump, glow, parallax and specular mapping. the setparam commands are used to set variables on a per texture basis. this is to intensify an effect or speed it up.

texture will add textures obviously, you have to specify the type of texture as well. valid arguements are 0, 1, n, z, g, d, water, lava, s, e

the full syntax is texture T F (R) (X) (Y) (S)

they each stand for type, file, rotation, x offset, y offset and scale, the ones in () are optional.

Note the first texture you specify as texture 0 must be a skybox one.

0 is a new texture slot. 1 loads an additional texture to use with the current texture slot, n loads a normalmap for the current texture, z loads a depth map (also called a bump map), g loads a glow map, d loads a decal to place over the texture (use 32 bit pngs WITH transparency for this. TGA will also suffice). water will load the water texture if material reset was used, and likewise for lava. s loads a specular map, and e loads an environment map (it uses the envmap entities or just reflects the skybox if one isn't specified).

Materials

water takes a surface texture, and has use for 3 additional slots. Note the below, and their order especially.

texture water golgotha/water2.jpg
texture 1 textures/waterfall.jpg
texture 1 textures/watern.jpg
texture 1 textures/waterdudv.jpg

For lava, there's only room for 1 additional slot. mostly as there's no need for a normal map, or a dudv one. As you can notice there's no specularity on the lava, and no distorted reflections either.

texture lava hirato/lava.jpg texture 1 hirato/lava.jpg

setshader

setshader is used to set the used shader of any following texture slots. The available list is

  • bump{env}{spec{map}}{parallax}{{pulse}glow}world
    • the main shader is bumpworld, the parts in {}'s are optional
  • colorworld
  • decalworld
  • envworld
  • envworldfast
  • glowworld
  • pulseworld
  • pulseglowworld
  • stdworld

Bump: Enabled the use of normal maps ('n' slot)
Parallax: Enables use of parallax maps, these are provided in the alpha channel of the normal map or through another image ('z' slot)
env: causes it to reflect envmaps, an env map can be specified by the 'e' slot
spec: enables specularity, with the map addition you can specify the specularity map via slot 's'
glow: enables a glow map specified by the 'g' slot. If it's a pulse variant the colours will pulse between two magnitudes

if they have any attributes to set, use /setpixelparam and /setvertexparam to do it, the syntax is set*param (ID) (val1) (val2) (val3) (val4)

All the bump variations have the same vertex and pixel params, just the majority goes unused.

Shader params

As of 2.4, shader parameters are named, and can be invoked via setshaderparam N A1 A2 A3

The shader params are as follows. The colours are multipliers and the speeds are in Hz.

  • specscale R G B
  • envscale R G B
  • parallaxscale X Y
  • glowcolor R G B
  • pulseglowcolor R G B
  • pulseglowspeed F - used in every other pulsing shader
  • pulsespeed F - unique to pulseworld

Realtime Editing

As of 2.6.0, it is possible to create additional virtual slots in real time by invoking certain commands. This virtual slot is managed automatically and is unique to the map. The following commands are available for use. Also note that if the command is enclosed within a vdelta statement (ie vdelta [voffset 64 64]), the difference is applied. Also note that this applies to the whole selection, and as such allfaces (Shift + 0) also takes effect here when invoking these commands.

  • vcolor R G B
  • vlayer L
  • voffset X Y
  • vrotate R
  • vscale S
  • vscroll X Y
  • vshaderparam N A1 A2 A3

Specifying Shaders

Overwriting the menu

Setting special binds

Base messages

Split map file

You can split the map file in many files. But in the main file you must set the paths to the files. For example: The main file is in this example test.cfg and map is test.ogz

test.cfg: exec packages/base/test-menu.cfg exec packages/base/test-model.cfg exec packages/base/test-code.cfg

It´s only example you can choose names that you want.

See Also