StrafeSpec

StrafeSpec is a declarative language for defining race tracks, made for Quake defrag compatible games such as Xonotic. A StrafeMap is a track written in it as a list, one piece on each line. The map workshop builds the list into a map and adds the start, the finish and a way back after a fall.

The output is a standard .map file. Quake and Xonotic map editors open it, and it compiles to a .bsp that plays in compatible engines. The map workshop is a web-based editor modelled on NetRadiant, with extensions that add building tools.

Try it

Change a number or add a line, and the picture follows. Drag the picture to turn it. Click a piece to jump to its line. The colour shows the speed, from blue (slow) to red (fast).

    The numbers, line by line
    LineWhat it saysSpeed inSpeed outLength

    A first StrafeMap, line by line

    Press the buttons in order. Each one adds a line to the box above.

      The basics

      Sizes

      Every number is in game units. A player is 32 wide and 69 tall, runs at 360 units a second, and clears about 230 with a running jump that rises 42.

      auto

      Write auto where a gap or a bend needs a size, and it gets the size that fits the runner's speed at that point. @500 asks for the gap that takes a speed of 500 to clear.

      Tracks that split

      A track does not have to be a single line. ring splits it round an island, knot makes it cross itself (level, over a bridge or under one), and plaza opens a square with room to turn. fork { } { } lays two routes side by side, fork left { } ahead { } right { } makes a junction, and fork above { } below { } puts one route over the other.

      Stairs round a bend

      curve left auto up 256 quarters 4 stairs is a spiral staircase that makes one full turn. Runners walk stairs, so the spiral is as tight as its steps allow and not sized for speed.

      Other bends

      curve left auto banked raises the outer edge, so the same speed takes a tighter bend. slant left auto 1024 is a quarter turn with a straight stretch at 45 degrees in the middle. angle 30 changes that angle.

      Speed from the floor

      boost 200 is a strip that adds 200 to the runner's speed, once. surf 2048 left is a face too steep to stand on. Drop onto it and hold the strafe key towards it to ride along. surfbend is the same face round a corner, and drop -128 makes a face climb.

      Things that move

      movers 3 gap auto lays platforms that slide from side to side, and shutters 2 lays walls that rise and fall. auto sizes the gaps, but the runner has to time the jump.

      What is added for you

      The start line, the finish line, a sheet under the gaps that puts a fallen runner back, and a room round the track. catch off removes the sheet and room off the room.

      Round the track

      around hills trees houses puts ground under the track, plants trees on it and builds a town. The picture in Try it shows the ground and the trees only. A number after the ground sets its height (hills 900). gorge raises the ground beside the track and ridge drops it away. tunnel 192 buried takes the track under a hill, and space purple leaves it hanging in open sky.

      Weapons and lava

      weapon devastator gives the runner a weapon and weapon off takes it away. ledge 128 is a wall too high to jump, to be climbed with a weapon jump. catch lava shows lava under the gaps. A runner who falls in is put back as usual.

      How to write

      Put one piece on each line. Give its numbers in the listed order, or name them: pads 4 gap 160 len 256. Anything after a # is a comment.

      Red and yellow

      A red line has a mistake, and the map is not built until it is fixed. A yellow line has a warning, and the map is built anyway.

      The version line

      strafemap 1 on the first line names the version of StrafeSpec the text is written in. Save adds it. A text older than version 1 has its old words replaced when it is opened.

      The speeds are estimates

      Speeds come from tables for running on flat floor and from the height of each drop. Banks, boosts, surf and weapon jumps are calculated and less reliable. Play the track before trusting a tight gap.

      How it fits together

      A StrafeMap has three layers, and each can change without touching the others. The course is the track itself: the pieces, in order. The library holds patterns, which are named groups of pieces. The StrafeSkin holds the look. One course can be given a different StrafeSkin, and one StrafeSkin can be used by many courses.

      The three layers, and the steps from text to map. The course refers to patterns and styles by name.

      Every word and where it belongs

      Each word of the language belongs to one layer. Click a piece to see its numbers further down.

      Every word of StrafeSpec, grouped by layer and kind.

      The words for sizes

      A size word means the same on every piece. In the drawing the runner goes from left to right.

      What each size word measures.
      lenlength, in the direction of the runwidewidth, across the runhighheight of the thing itself
      up, drophow much higher or lower a piece ends, or the next one startsriseheight step from each item in a row to the next (negative steps down)gapempty space to jump over
      apartspacing of things that stand on one floorsizelength and width of a square thingalong, across, overwhere a block stands: distance ahead of the next piece's start, left of the centre line, and above the floor

      Which look wins

      1. A line in the coursetheme or texture, from that line on
      2. The style's own linesin the course text, else in the StrafeSkin
      3. The style it starts fromstyle other inside a style
      4. A themea texture for every part
      5. The usual lookthe theme metal, in a room

      When two of these disagree, the one higher in the list wins. A style in the course text beats a style of the same name in the StrafeSkin. A name that matches no style is read as a theme. A name that matches neither gets the usual look and a warning.

      How a line is read

      The parts of a line, in the colours the editor uses.
      flat 512A line is a word followed by its numbers. Upper and lower case are the same. Spaces or commas separate the words.
      gap auto; drop 64; flat 512; ends a line, so several fit on one.
      # a noteEverything from # to the end of the line is a comment.
      name "Long way down"Text in quotes is kept exactly as written. name and say take it.
      gap autoauto is the size that fits the runner's speed at that point: a gap they clear, or a bend they stay on.
      gap @500@500 is the gap that takes 500 units a second to clear.
      flat 256*3A number can be a calculation, written without spaces: + - * /, brackets, min(a,b) and max(a,b). The result is rounded to a whole number.
      repeat 4 { gap auto; flat 448-i*64 }Lays the lines in the braces four times. Inside, i counts the rounds from 0, so a size can change each time.
      def step fall 64 { gap auto; drop fall; flat 512 }Defines a piece of your own. It goes above the first piece. The words after its name are numbers used inside the braces. See Patterns.
      use standardMakes every library pattern available by name, without its def in the text. To take only some packs, name them: use torture places. A def of your own with the same name wins.
      style keep { theme castle; kerb stein1x/base-marble }Defines a style: a look with a name. style keep on its own line applies it. Styles can also be kept in a separate file, the StrafeSkin.
      fork { flat 768 } { gap auto; flat 768 }Two routes side by side. The left one is written first.
      fork left { ... } right { ... }With named sides the track splits at a junction. Each route is as wide as the track and leaves on the side named: left, ahead or right. Routes join again once they point in the original direction. A route can also end with its own finish.
      fork above { ... } below { ... }One route above the other. Over the first 512 units the left half of the floor climbs a ramp 256 high while the right half stays level. After that each route has the full width. The upper route must end at least 192 above the lower one, and drops onto it where they join.
      walls 96 ... walls offA setting applies from its line until it is set again: walls, ceiling, tunnel, width, theme, texture, catch, marks, edges.
      skill, name, physics, around, room, open, spaceThese apply to the whole track wherever they are written. By convention they go first.

      Every line

      Click one to add it to the box.

      Piece by piece

      Every piece and the numbers it takes. Give the numbers in the order shown, or name them in any order: pads 4 160 and pads gap 160 n 4 mean the same. A number left out keeps its default.

      Words that take a name

      Each of these words is followed by one of the names in its row.

      Patterns

      A pattern is a group of lines with a name. Write it once with def, above the first piece, then use the name like any other piece. The words after the name are its numbers. Random track builds its tracks from the patterns below. Click one to add it to the box.

      def step fall 64 land 512 { gap auto; drop fall; flat land }Defines step. After that, step, step 96 or step 96 640 on a line lays it.
      slope fall*5 drop fallA number can be a calculation, written without spaces: + - * / and brackets. This works outside a def too: flat 256*3.
      fall 64 96 rarely 192The first number is the default. Random track picks from all of them, and picks those after rarely less often.
      side left rightA word that takes left or right. Inside the braces, -side is the opposite side.
      random hardTells Random track how to use the pattern: hard (late in the track), once, bend, not beginner, off (never).

      Examples

      Complete StrafeMaps to read and change. Each picture shows the whole track, coloured by speed. Click one to open it in the box at the top.