Changing The Default Palette of Duke3D v2   v1-01-2000  Release 2  © RTCM Usurper

 

Introduction | Creating a new palette | Importing it via editart | Fixing the palette.dat | Credits

 


Introduction
 

If you are making a TC or other advanced build engine project involving graphics, you may wish to alter the default game palette. You will first have to construct a new palette to import via editart. I'll explain how to do this with Paint Shop Pro 5 and 6 (probably works with other versions as well).

 


1. Creating a new palette  (Paint Shop Pro or OpenGL Buildtouch 2.1)
 

The game uses a 256 color palette. Each individual color is made up of three numbers. These three numbers are itís r/g/b values. They tell how much red, green, and blue is mixed to create the color. Each value can range from 0 (least amount, darkest) to 63 (greatest amount, lightest). Windows palette files usually range from 0 to 255. You can either make your palette in a windows program such as Paint Shop Pro 6 or you can make it in James Ferry’s OpenGL BuildTouch 2.1 program.

Keep in mind that if you want the colors to shade properly, a bright blue will need darker blues to fade to before fading to black.

Paint Shop Pro 5/6 (from scratch):

  1. Create a new image.
  2. Select colors menu.
  3. Choose “edit palette”
  4. Double click each square and adjust its rgb settings, keeping in mind that each number should be a multiple of 4. 0, 4, 8, 12, 16, 20, etc.
  5. Click “OK”
  6. Select colors menu.
  7. Choose “save palette” (you’ll need it for making your own art or converting other art later)
  8. Save your image (you’ll need it later to change the palette.dat file with editart)

Paint Shop Pro 5/6 (modifying regular palette):

  1. Take a screen capture of an art tile using editart (see Usurper’s Editart Guide 1.5 In The Usurper Section.)
  2. Open the screenshot in PSP
  3. Select colors menu.
  4. Select “edit palette”
  5. Double click each square that you want to change and edit their rgb settings, keeping in mind that each number must be a multiple of 4. 0, 4, 8, 12, 16, 20, etc.
  6. Click “OK”
  7. Select colors menu.
  8. Choose “save palette” (you’ll need it for making your own art or converting other art later)
  9. Save your image. (you’ll need it later to change the palette.dat file with editart)

OpenGL BuildTouch 2.1

  1. Back up your original palette.dat file first.
  2. Open the program. Select the palette menu.
  3. Select open and choose palette. Find your palette.dat file and open it.
  4. Select open and choose lookup table. Find your lookup.dat file and open it.
  5. Select the palette menu and choose “switch to palette window.”
  6. The top palette is your default palette. The middle bars are your selection bars. The block at the right (selection block) end of the selection bars shows your currently selected color. The block at the left end (rgb block) shows the setting of each of the three values used to create the color: red, green, and blue. The bottom palette is either an alternate palette or a shade table, depending upon what is currently selected. You won’t need to use the bottom palette to change the default palette.
  7. You can change a color on the default palette by either dragging a color from another part of the palette onto it, or by dragging a color from the selection block on it.
  8. You can drag colors from the palette to the selection box for alteration.
  9. You can change the color in the selection block by either clicking on points in the selection bars to set the rgb value, or you can set the color numerically by right-clicking on the rgb block and inputting numbers into the popup menu. Numbers range from 0-63.
  10. When you’ve finished making your adjustments, select the palette menu and choose replace palette. Make sure the default box is checked (you can use this to replace any of the game palettes) and click “OK”.
  11. Select the palette menu, choose save, then choose palette. This method bypasses the use of editart.

 


2. Importing it via editart
 

If you created your palette in a windows program such as PSP, make sure you’ve saved an image with the new palette in non-interlaced gif 89a format. Open editart and select a blank tile. Size the tile, then press u to import the image that contains the new palette. **IMPORTANT NOTE The image that you select must not be in another duke directory. If so, it could cause unusual things to happen, changing the palette of the directory the image is in rather than the desired directory.** Select the image from the list and press enter. The image will appear with a white box around it. Now, instead of pressing 'enter', press 'P'. A message will appear asking if you want to make this the new build palette. Press 'Y'. You may have to wait a few moments for editart to finish writing the new palette.dat file. Press enter to finish importing the image.

 


3. Fixing the palette.dat file  (transpal.exe and Opengl BuildTouch 2.1)
 

The palette.dat file contains more than just the palette. It also contains the number of shade tables, the shade table information, and transparency information. This information isn't set up automatically when you change the palette, nor does it use the old information by default. There's a program called transpal.exe that can fix the file, assuming you know what the figures to input and the right keys to press are.

The command line parameters for transpal are:

Transpal [number of shade tables] [translucency number] [r] [g] [b] (rgb values are optional)

There are usually 32 shade tables in the palette.dat file. Originally, there were going to be 64, but the number was dropped to 32 for the sake of slower machines. I don’t recommend using any number but 32, as some odd bugs have crept up in my tests. Also, you would be forced to re-shade any map you have already started with the original 32-shade-table palette.

The translucency number ranges from 0-256. Were it set on 0, the first translucency setting would be totally invisible, and the second would be solid. If it is set to 256, the first translucency setting would be solid, and the second would be invisible. 160 and 170 are the example values, which appear similar to the standard values.

The RGB values are optional. I don’t recommend using them. The default values look fine. Feel free to experiment though.

Once you’ve typed the correct command line information, hit enter. You’ll see colors streak across the screen. There are three key commands for transpal that you can now use.

Esc: exit without saving
Enter: save shade tables and translucency tables
Space: save ONLY the translucency tables.

You’ll probably want to just hit enter and save both.

According to Silverman, some teams wanted to use another program to write the shade table information, hence the reason for the space command. The reason for this is likely to create full-bright colors. You may have noticed full-bright colors in the default palette. The last 16 colors are not affected by shading in any way. This is because the shade tables were modified to prevent this. You can modify the shade tables to add full-bright colors to your palette using OpenGL BuildTouch 2.1. I must warn you that it is a very tedious process due to the number of shade tables.

  1. Open the program. Select the palette menu, open, and palette. Select and open your new palette.dat file.
  2. Select the palette menu, open, and lookup tables. Select and open your lookup.dat file.
  3. Select the window menu and choose switch to palette window.
  4. Select the palette menu and choose browse lookup tables. The lookup palette selection menu will appear.
  5. Click on the box in the bottom left that says Shading (1-320) (should place a checkmark in it). .Enter a value for the shade table you wish to edit and click “apply” and “OK”.
  6. For any colors you want to remain at maximum brightness, simply drag the color from its original place in the default palette to the same position in the shade table at the bottom of the screen.
  7. Once you have finished doing this for that shade table, choose “replace lookup” from the palette menu. Then click “OK”. After you have done this for each shade table, choose “save” from the palette menu and select “lookup table”.

 


Credits
 

© 2000 Matthew Palmer

An R.T.C.M. Document

Thanks go to:

Ken Silverman for his valuable information on the palette.dat structure, transpal.exe and its keys, and editart keys as listed in the build docs (not to mention creating a great game engine and the utils for it).

TerminX for his initial help with my palette conversion.

James Ferry for his information and assistance, and for creating OpenGL BuildTouch 2.1, which makes palette editing a lot easier.