Skip to content
kripken edited this page Aug 31, 2012 · 4 revisions

Running your own maps

Tip: It's useful to check that your map works in a native build first, to make sure there are no obvious problems with missing files or incorrect cfg settings.

We want to make it easier to quickly package existing Cube 2 maps, without building the project etc. If you're interested to help us with that, see this issue.

Method 1: Rebuild the project

If you don't mind rebuilding the project and its source code, this can be the easiest way.

To do this, you need to get Emscripten and its dependencies - see the Emscripten tutorial for details.

Then look at cube2/src/web/Makefile. The makefile currently packages 3 maps, called low, medium and high, note how it lists all the relevant dependency files for each. You can modify it to include your own map. Then just build BananaBread by doing make in cube2/src/web

Note that if you just change the maps but not the code, you don't need to recompile the code each time. You can comment out the calls to emcc that generate JS (the two lines with -O2 in them in the Makefile).

Method 2: Package a map with the demo

This method can be easier if you don't want to install all of LLVM and so forth (which is a dependency of Emscripten).

  • Get the emscripten source code from github. You just need a small amount of Python from it, though, don't worry - you won't be running the emcc compiler.
  • Get the BananaBread demo archive by clicking on "Download the Source" on the demo page.
  • Unpack the demo archive into the cube2 directory in the BananaBread code from github (which you should check out). The demo archive provides the JS source files so you don't need to build them.
  • You can now manually package your map. The simplest way is to directly replace one of the three current maps in the demo. First, find our which files you need for your map - you must specify the map cfg, ogz, all the texture packs, and so forth - note that it must include the basic textures and so forth needed by the engine, see cube2/src/web/Makefile. Then run a command like python $(EMSCRIPTEN)/tools/file_packager.py low.data --preload $(FILES) --pre-run > game/preload_low.js where $(EMSCRIPTEN) is the path to emscripten, $(FILES) are all the files you need. You then need to edit game/setup_low.js so it runs your map instead of the current default (colos).
  • You should now be able to load the low map, which will be your map. See the instructions in our main README file for running the demo locally, and run the first map.

Creating new maps

See the Sauerbraten docs for mapping.

Clone this wiki locally