Entropy Skybox Tutorial
From LagoonWiki
This tutorial tells how to change the Galaga/Entropy/Ogre3D skybox. It assumes you have already made your artwork.
Installing your Skybox Art into the Game Engine
The procedure is as follows:
- Start from the entropy/ directory where the engine is installed.
- Create a directory to hold new skyboxes:
mkdir galaga/data/skyboxes/
- Create a directory to hold your specific skybox:
mkdir galaga/data/skyboxes/<skyboxname>
where <skyboxname> is the name of your choice. It is case sensitive. (On UNIX systems people tend to use all-lowercase unless there is a good reason not to.) It cannot have any spaces; use underscores or dashes if you want to separate it into words.
- Copy your artwork into the directory.
- You need six JPEG files of the form skyboxname_<suffix>.jpg, where the suffixes are up, dn, lf, rt, fr, bk.
- User convert to convert your GIMP source files into JPEG images.
- The engine will stretch your artwork to the size it needs, so small images will look ugly due to the stretch. Try 512x512 or larger for starts.
- If your artwork has layers in the source file, you will need to merge them or else convert will create a numbered JPEG for each layer. (This should be easy to do by passing The GIMP a script from the command line. See notes on GIMP scripts below.)
- In the entropy/ directory, modify resources.cfg to load your skybox data when the engine starts.
- Comment out the line that adds the "bluesky" skybox, and replace it with a similar line that will find yours instead. Be sure to use the correct path, which is not the same as the one you just commented out. (The path is relative to the entropy/ directory where you start the engine.)
- In the data/common/ogre/ directory, modify common.material to describe your skybox.
- Just clone the "BlueSky" section, and change the name of the cloned section and the name of the JPEG file mentioned in the body of the section.
- The new name of the JPEG will be your skybox name without the suffixes — the engine will find your files by adding the suffixes when it tries to load them.
- In core/ogre/, modify ogreApplication.cc to tell the Scene Manager to load your skybox instead of "BlueSky".
- Comment out the line that loads "BlueSky", and add a line that loads yours instead.
- While still in that directory, type make to recompile this part of the engine.
- Back in the top-level entropy/ directory, test the program to make sure your skybox is visible.
Making it Easily Repeatable
Once you have it working, you should do:
- Put copies of the three files you modified somewhere in your own directory tree, so you will have them if you need to build Entropy on a different machine.
- Write a shell script that will create the directories and copy all the files over, so that you will not have to do it by hand every time you change something.
GIMP Scripts
You can invoke The GIMP in batch mode with -b followed by a Scheme-like script. You probably want to use -i as well, to keep it from poping up the GUI. Here's a trivial example to illustrate the basic command-line syntax:
gimp -ib "(gimp-quit 0)"
Since that is a command you could issue from the prompt, you can also use it within a shell script, e.g. to flatten a layered image while copying files from your own directory into the game engine's directory.
You can browse a list of procedures supported by the scripting language by starting The GIMP normally, then on the main panel (where you choose between brush, pencil, bucket, etc.) pick the menu option Xtns –> Procedure Browser. The browser will pop up and you can scroll through all the supported procedures. The following will be useful for converting a multi-layer XCF image to a flat JPEG:
gimp-xcf-load gimp-image-flatten file-jpeg-save
When you highlight one in the procedure browser, the right-hand side of the window will show a list of the expected arguments. Unfortunately it does not include any examples of use, but you may be able to find examples on the web using your favorite search engine.
