The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: Twurckle on February 24, 2008, 11:06:34 am



Title: graphic specifications
Post by: Twurckle on February 24, 2008, 11:06:34 am
I was thinking about creating some art for the game (new planet surface creatures) as a resource for modders and was wondering about the graphic format etc.

I assume the game can only handle 256 colors?
I could not find information on the graphic format used by the game. can I save them as animated gifs? if so what color palette should I use, I assume I somehow have to use the same colors as the game itself?




Title: Re: graphic specifications
Post by: Novus on February 24, 2008, 01:48:32 pm
I assume the game can only handle 256 colors?
Some of the 3DO graphics have higher colour depth and UQM generally uses whichever of the PC or 3DO graphics has higher quality (and in some cases where they are different, both are available). In order to allow this, UQM supports up to 24-bit colour.

Quote
I could not find information on the graphic format used by the game. can I save them as animated gifs? if so what color palette should I use, I assume I somehow have to use the same colors as the game itself?
It's all in the doc directory of the source tree. For example, doc/devel/aniformat (http://sc2.svn.sourceforge.net/viewvc/sc2/trunk/sc2/doc/devel/aniformat?view=markup) explains the animation format (sprites, dialogue animations, and so on); basically it's a bunch of PNGs and a text file that lists the PNG files and their position on screen relative to the position of the object the images represent. For example, the Roto-Dendron is in content/ipanims/lifea.ani (http://sc2.svn.sourceforge.net/viewvc/sc2/trunk/sc2/content/ipanims/lifea.ani?view=markup).

There seems to be a lot of hard-coding of animation lengths, so you probably want to stick to 4 frames. Look at src/sc2code/planets/lander.c (http://sc2.svn.sourceforge.net/viewvc/sc2/trunk/sc2/src/sc2code/planets/lander.c?view=markup) for how the life forms' behaviour is defined.


Title: Re: graphic specifications
Post by: Michael Martin on February 24, 2008, 01:58:43 pm
And Novus beats me to the punch, and even links all the same files I was going to.

That said, looking through lander.c it looks like everything is being done with IncFrameIndex, which will cycle through animation frames regardless of how many there are.  It should be safe to use any number of frames.  Test it before going nuts, though, of course.


Title: Re: graphic specifications
Post by: Novus on February 24, 2008, 05:11:29 pm
There's some stuff later on in object_animation that looks like it could be trouble:

Code:
246: frame_index = GetFrameIndex (pPrim->Object.Stamp.frame) + 1;
...
310: else if (!(frame_index & 3) && ElementPtr->hit_points)
If I'm reading this right, frame_index rolls through 1, 2, 3 and 4 for a 4-frame animation, so you need at least 4 frames before the condition on line 310 is true, i.e. a life-form with less frames won't move properly.


Title: Re: graphic specifications
Post by: Twurckle on February 24, 2008, 06:50:31 pm
Thanks for the replies, it's good to hear that the game does accept images with higher color depth.
I have no coding experience whatsoever, but I've been toying with the idea of learning to program for a while.
I don't expect to submit any usefull code soon, but i'd at least like to better understand how it works, and learn to read code.
What would be a good place to start?


Title: Re: graphic specifications
Post by: Novus on February 25, 2008, 07:36:56 pm
There's some stuff later on in object_animation that looks like it could be trouble:

Code:
246: frame_index = GetFrameIndex (pPrim->Object.Stamp.frame) + 1;
...
310: else if (!(frame_index & 3) && ElementPtr->hit_points)
If I'm reading this right, frame_index rolls through 1, 2, 3 and 4 for a 4-frame animation, so you need at least 4 frames before the condition on line 310 is true, i.e. a life-form with less frames won't move properly.
Yep, I tried it out on the lunar bulldozers. If they have less than 4 frames, they freeze.