Sauer Map

Update as of 2006-09-19 - I've noticed that this utility has been downloaded once or twice a day since I posted it in mid June, but I have not received any feedback. Consequently before investing the time to make it work with the very latest maps, such as metl4, if somebody could let me know that they are actually using it that would be great.

Overview

This page has my sauer-map utility for Sauerbraten that I wrote. Parts of it are based on the Sauerbraten engine. It's similar to the cube-map utility that I previous wrote for Cube. Sauerbraten maps are made out of four types of items (in physical order the header, entities, cubes and lightmaps). sauer-map allows each of the four item types to be queried, updated, deleted and added. Typical usage includes combining a mode (query, update, delete or add) with an item type as well as a possible constraint/limit (-l switch) that limits the items the items affected as well as an optional statement (-t switch) that is applied to the affected items.

Hopefully this utility will be helpful in the following ways:

  • It will be a useful automation tool for mappers
  • It will provide developers an easy way of prototyping things that can be done to maps.
  • For those curious it provides a way of understanding the layout of Sauerbraten maps that written in a language (Python) that is easier to understand than C++.

Install

Unlike cube-map sauer-map is now divided into two parts in order to make code reuse easier.

  • sauer-map This is the command line utility which should be placed in the path.
  • sauermap.py This is the module on which sauer-map depends. It should be placed in the "site-python" directory of your Python install.

Get the latest version here

License

sauer-map is open source software. sauer-map is covered by the GPL license and sauermap.py is covered by the LGPL license, which is like the GPL license except that it allows proprietary software to link against it.

Examples

Header

Query the header for a given map.
sauer-map -qs tartech.ogz

Query all the map titles for all the maps in the current directory.
sauer-map -s -t 'print "%20s  %57s" % (.file_name[:-4], .maptitle)' *.ogz

Entities

Query all of the entities with headers (-v).
sauer-map -v -qe tartech.ogz

Delete all the entities.
sauer-map -de -w nmp10.ogz

Delete all quads.
sauer-map -de -l '.type == "quad"' -w metl3.ogz

Same as above, but output to a separate file instead of changing the original
file.
sauer-map -de -l '.type == "quad"' -r metl3-noquad.ogz -w metl3.ogz

Replace all quads with yellow armour for a given map.
sauer-map -ue -l '.type == "quad"' -t '.type = "yellowarmour"' -w curvedm.ogz

Place a red light at each quad like there is in curvedm
sauer-map -ae -l '.type == "quad"' -t '.type = "light"; .attr1, .attr2, .attr3, .attr4 = 96, 300, 50, 50' -w metl3.ogz

Shift all entities up by 10.
sauer-map -ue -t '.z += 10' -w nmp10.ogz

Make a SP map out of a MP map by mapping all player starts other than a
particular one (idx == 7 in this example) to respawn points.
sauer-map -ue -l '(.type == "playerstart") and (.idx != 7)' -t '.type = "respawnpoint"' -w nmp10.ogz

Cubes

Delete all cubes who's lower corner has a Z-coordinate above 1200.
sauer-map -dc -l '.lower_corner[2] > 1200' -w nmp10.ogz

Set the edges of all cubes to 07 to better see where the cubes are, and what the relatively detailed parts of the map are.
sauer-map -uc -t 'self.edges = "\x70" * 12' -w metl3.ogz

Lightmaps

Delete all lightmaps and fixup references to lightmaps so that they have
ambient lighting.
sauer-map -dm -w thetowers.ogz

Export all lightmaps as 512x512 PNG images so that they can be examined.
The entities are also saved as an image.
sauer-map -o image_dir roughinery.ogz

Import the lightmaps from 512x512 PNG image files after possible making
changes to the images.
sauer-map -i image_dir roughinery.ogz