The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 13, 2024, 07:24:57 am
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  Creating star system without planets
« previous next »
Pages: 1 [2] Print
Author Topic: Creating star system without planets  (Read 4549 times)
fossil
Core Team
Frungy champion
*****
Offline Offline

Gender: Male
Posts: 94



View Profile
Re: Creating star system without planets
« Reply #15 on: December 06, 2009, 08:39:23 pm »

Planting the normal hyperspace graphics into the Orzspace leaves and ugly red glow around the graphics. A most efficient way of eliminating this would of course to define in something like orzspace.ani that the graphics in orz space use a different color table.
...
Where in the .ct files it is defined which number it is?

Actually, you do not need to create an orzspace.ani. Instead, you can just create a new palette for hyperstars.ani to use, a palette that carefully replaces those Hyperspace red hues with whichever hues your Orzspace uses (blue?). You can put this palette into your orzspace.ct. This is best demonstrated with this actual example (but do read the doc meep-eep mentioned and also see my post above about the starting and ending colormap index). It can be confusing: colortable vs. colormap, but we do not have better names for them. A colormap is a 256-color palette, and a colortable is a file containing colormaps.

So on to the example:
* ambient.ani uses colormap 53
* hyperstars.ani uses colormap 54
* hyperspace.ct defines colormap 53, but not 54, because hyperstars.ani is only ever used in Hyperspace (Quasispace uses quasispace.ani instead). IIRC, colormap 54 is defined by base/uqm.ct, which also defines most colormaps used in the game, especially the ones that never change.
* quasispace.ct also defines colormap 53, but you already know that because you made your own orzspace.ct
* the assumption is that you want to use hyperstars.ani in Orzspace and not create a brand new one

How do I know they define colormap 53? Open one of these .ct files in a hex editor and follow the layout with doc/devel/strtab. At offset 0x10 you will find the beginning of the first (and only, in this case) colortable entry. The first two bytes of this entry are the starting and ending colormap indices, which are both 0x35 (or 53 in decimal). What follows is the colormap, 256 * 3 = 768 bytes. Note the size of this entry at offset 0x0c: it is 0x00000302, or 770 in decimal = 2 + 768.

So what you may want to do is make your orzspace.ct define both colormaps 53 and 54. In that case, you leave the starting colormap index 53, make the ending index 54, insert the new colormap 54 at the end of the entry (or in this case, append to the end of the file), and change the size of the entry to account for an added colormap (2 + 768 + 768).
When this new orzspace.ct is loaded and activated with SetColorMap(), it will replace colormaps 53 and 54, and your hyperstars will be drawn using the palette you defined. While the legacy name does not suggest so, SetColorMap() can replace more than one colormap.

There is just one catch.  Grin  Once you load and set orzspace.ct, colormap 54 will be forever replaced in the game. So when you go back to Hyperspace, the stars will have an ugly blue glow around them Tongue This will happen because, of course, hyperspace.ct does not define colormap 54, but you already know how to fix that. You will just have to fish colomap 54 out of base/uqm.ct.
EDIT: You could also simply save the palette from hyperstars-000.png into an .act file, and that will become colormap 54 for hyperspace.ct. But I do not guarantee that the PNG palette is exactly the same as colormap 54 in uqm.ct. Most of the PNG palettes in UQM graphics are there just so a human could see what a graphic is. Such palettes are not used in the game, and instead the colormaps define the colors, as you probably realized already.

Also, when editing the .png files with photoshop, the 4 kB files always bloat into 50kB+ files after saving.
Make sure that PS does not convert these PNGs to 24-bit color. Some versions of GIMP, for example, are known to clobber the palette, rearrange it randomly, etc., and that can make these PNGs unusable by UQM.
« Last Edit: December 06, 2009, 08:53:21 pm by fossil » Logged
superbutcherx
*Many bubbles*
***
Offline Offline

Posts: 116



View Profile
Re: Creating star system without planets
« Reply #16 on: December 09, 2009, 08:41:42 am »

Thanks for the comprehensive example and SW tips, you guys are full of good advice!

So far I've used a separate orzspace.ani since I've got some new graphics in the orz space in addition to some of the hyperspace gfx. The way I've done the colors for them is to simply switch off the colormap specifying number in the .ani file, forcing the PNG's own palette to be used.
This is OK for single frames, but with animations of multiple frames I think I'll go for the way you described in the example.

My ultimate dream is to make a real sequel out of this thing eventually, but then again, that might never happen... So as the first step I'm taking the route someone (Angelfish?) suggested in another topic: Make it a small add-on for the original UQM. This shouldn't take too long and it would also let you guys see what I've been able to accomplish!
Logged
Pages: 1 [2] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!