How to create themes for Lasers!

So you'd like to design your own theme for Lasers!, eh? Well, you've come to the right place. This page will walk you through how to construct a theme step-by-step.

Unfortunately, I haven't quite finished the full walk-through yet, but the instructions here should get you started. If you have any questions, you can email me.

Lasers! uses a compiled theme file consisting of info, graphics, sounds, and some control flags. The process of designing a custom theme involves three steps: 1) designing the graphics, 2) enter the filenames and information into themeBuilder, and 3) compile the theme for use.

Designing the Graphics
You can use any paint program you would like to create your graphics. I generally use Gimp , but I have also dabbled a bit with some 3D rendering programs like Blender. In the end, you need to generate PNG (*.png), XPM (*.xpm), or bitmap (*.bmp) formatted bitmaps of equal size. The QT libraries do support an alpha channel, so you can generate some fairly elaborate effects. Personally I prefer to use PNG.
Lasers! supports animation with your graphics. To do this, render each frame of the animation individually. Give each frame the same base name, and use a 4-digit number (starting at 0000) in the name to indicate a frame number (ie Ball0000.png, Ball0001.png, Ball0002.png,...). There is currently a limit of 32 frames per animation, but that may change in the future. When you compile the graphics, Lasers! will automatically figure out how many frames are in the animation and load them all.
I generally start with an existing set and then modify graphics one bitmap (or animation) at a time. The default graphics set works well for this purpose, and each graphics set here comes with the config file and the raw bitmaps to generate the compiled graphics file.

Entering the Filename Information
The themeBuilder utility program that comes with Lasers! provides a simple means of associating certain graphics with specific objects. The utility is fairly self- explanatory, but more detailed directions on its use will be included in the full theme walk-through (still being written).
Each item in the tree view needs to have an item associated with it before the theme can successfully be compiled. Graphics items can be previewed by selecting the item in the tree view. Double-clicking an item will open an appropriate selection dialog.
If you are using an animated graphic for an item, you need to indicate where the frame number occurs in the filename. This is accomplished by substituting a "%1" in the filename where the 4-digit frame number should occur. For example, if I had an animation with frame bitmaps named Ball0000.png, Ball0001.png, Ball0002.png, etc., I would type in "Ball%1.png" for the item name.

Compiling the Theme
Compiling the graphics is the easiest step of the process. Once all objects have been associated with a graphics file (or files), you simply click on the "Build Theme" button on the themeBuilder dialog. Alternatively, you can select "Theme->Build" from the menu bar. ThemeBuilder will then attempt to import all the graphics and compile them into a single theme file for use. If any errors occur, themeBuilder will notify you of the problem. Otherwise, you'll get a success message when themeBuilder finishes.
A note on compilation:
Lasers! looks for themes in the /usr/share/games/lasers/themes/ directory by default. Compiling your new theme into this directory will make life simpler later.

Using the New Theme
If your compile was successful, then you are now ready to use your new theme. Start a new game (or load an old one) from inside Lasers!. Then select "Options->Load Theme" from the menu bar. An open dialog will pop up, prompting you to locate the theme to load. Select your newly built theme file, and click on "Open". You new theme should load and you should see the results of your labors. Enjoy!

Look for a more detailed walk-through to come in the future.


Lasers! Home
Copyright (c) 2002 by Sean P. Mahnken . All rights reserved.
This page was last modified on Friday April 30, 2004
This site is hosted by sourceforge.net
SourceForge Logo