Adding Images On-Screen |
Quake2 Demo Editing Tutorial |
Original Tutorial by Geburah |
Updated 3/99 by Overman |
At long last, it's time for the tutorial that answers the (far and away) most frequently asked question I have received here at ZS: "How do I use images for my demo titles?" The procedure itself has quite a few steps that need to be followed, but once you are familiar with those steps, it will become second nature. So here we go.
Creating and Preparing the Images
Unfortunately, I cannot tell you how to create good looking images - I'm no artist. However, I can walk you through the simple procedure for converting your images to the Quake 2 palette, which is a necessary step to get them to display properly on your screen.
For the purposes of this tutorial, we are going to be working with Paint Shop Pro 5.0. Advanced graphic artists tend to prefer Adobe Photoshop... and therefore it's my assumption that most Photoshop users are already familiar with how this can be accomplished with that program. PSP has a shareware evaluation version, is a worthwhile investment for working on web graphics and many types of Quake 2 images, and tends to be more intuitive for beginners.
From the q2palette.zip (included), there are the following files: q2palette.pal, which should be extracted to your Paint Shop Pro\Palettes directory, and colormap.pcx, which is an image representing the actual palette for your reference.
Now open an image of your choice in Paint Shop Pro. Select Colors - Load Palette (or CTRL-O) and select q2pallette from the dialog box. If this is not an available choice, make sure that you installed the palette file to the correct directory. You will notice an immediate change in the appearance of the image. As you can see, the Quake2 palette can bring about a different look to your images... it's something you'll have to develop a "feel" for. Depending on the color scheme, some images will convert fairly well, but some images will not do so well. Some artists prefer to create their images from scratch, choosing their colors from the palette available in colormap.pcx, but if you are going to import images from elsewhere, this is one of the factors you will have to weigh in.
Now you must save the image in the proper format... this is VERY important. Choose File - Save As... (or F12), then in the Save As Type box, select Zsoft Paint Bruch (*.pcx). Then press Options, and make sure Version 5 is selected. Having done that, name it what you like, and the .pcx extension will be applied automatically. Click Save to complete the procedure.
NOTE: There is a particular color in the palette (R: 159, G: 91, B: 82 - palette index #255) that is used for transparency. You will want to avoid this color in your image creation... unless, of course, you want that part of the image to be transparent.
Placing the Images
Now we are going to add some sample images into a Quake 2 demo, this time into a demo of your choosing.
Included in this .zip archive are the following image files: blank.pcx, keygrip2.pcx, phase2.pcx, and teamspleen.pcx. All of the images are 256x192. Quake2 supports several image sizes, but we are going to use these dimensions for the purposes of this tutorial, primarily because they are easy to manage in the Keygrip2 3D Preview window. Blank.pcx is one solid color, the Q2 transparency color, and will be used to keep the screen clean when other images are not needed. Keygrip2.pcx is the logo for the tool of the same name; phase2.pcx is the logo for Clan Phase2, from the famed CTF Movie; and teamspleen.pcx is the logo for the former movie-making team of that name. Make sure all these images are placed in Quake2\baseq2\pics\ - you may need to create this directory if it does not yet exist. If you are adding the images to a demo from another mod, be sure to use the pics directory for that mod instead.
Now, open your demo in Keygrip2. Next, select View - Image List. Click the Folder icon in the top left of the Image List, and add each of the images to the list. Add them in order, one at a time (blank, keygrip2, phase2, teamspleen).
Now, minimize the Image List (we'll need it later). Open the now-familiar Demo Information, make sure Server Version is set to 34, and then select Statusbar from the list of configstrings on the left. Now press the "-" button to delete the Statusbar, and use the same procedure to delete the configstrings that follow that are labelled Unknown.
The Statusbar configstring contains all the formatting information for on-screen images and data, using certain shorthand notation and formulas. We are going to simplify and customize the Statusbar string so it displays the images of our choice centered in the screen, regardless of our screen resolution.
What's that you say? Oh no! We've just deleted the Statusbar! Not a problem, that was on purpose, in order to show you the following. If you know the index number of a configstring, you can add it to the list by using the "+" button. Simply set the Index number to 5 (always the index for the Statusbar), clear the Value text box, and press "+". Voila! Now you have a blank Statusbar message, and we can add our own custom setup to it. [For future reference, you should always delete Unknown configstrings when implementing custom images, but you do not have to delete Statusbar (5)... you can simply modify it if you prefer.]
In the Value text box for Statusbar (5), insert the following string (without the quotes):
"yv 8 xv 32 pic 0 "
The trailing space at the end is very important. This string contains the proper formatting notation for centering images of the dimensions 256x192. In the next tutorial, you will learn why this works, and how to center images of other sizes.
Click OK to apply your changes. Go ahead and open the Demo Server window and Connect to the 3D Preview. You should notice a small health icon (perhaps another icon) on the screen, up and left of center. The "pic 0 " part of the Statusbar value is pointing to an image value somewhere. Now we take steps to make sure it points to the image(s) we want on screen.
Open the Find/Replace dialog (Edit - Find) and set the following options:
Find Type: Replace
Message Type: Playerinfo
Check Parameters
In Replace Params, scroll down until you see Stats - 0
Now, open your Image List, and take note of the index number of blank.pcx, and place that number in Replace Params -- Stats - 0. In case you hadn't guessed, Stats - 0 in the playerinfo messages is where "pic 0 " is pointing to an image number, and now we are going to give it a new image number to point to.
Click Find First to begin, and when prompted, press All to insert the blank image throughout your demo. Examine the 3D Preview window again (play the demo if you like), and you will notice the screen is nice and clean. Now we can insert the other images where we like. First, select the blocks 50-100 on the filmstrip. Since we know that 10 blocks = 1 second, we will be displaying this image for 5 seconds (50 blocks). Now return to the Find Dialog, and change the number in Stats - 0 to the Image index for keygrip2.pcx (consult your Image list if you need to). This time, make sure Search on Selected Range is checked, so the image will only be inserted into the blocks you have selected. Find First, All... that was quick. Next, follow this same procedure to insert the next image (phase2) into blocks 120-170. When that is done, insert the final image (teamspleen) into blocks 200-250. And that is that!
Watch the results in the 3D Preview, or better yet, save the demo under a new name, close Keygrip2, and watch the demo in Quake2. Try watching it at different screen resolutions, the images will still be centered. Neat, huh?
Using the above procedure, you can insert your own 256x192 images into your own demos however you like. I'd recommend keeping that blank.pcx image handy, as you will use it most every time, and it also makes a great template / background for adding text over a transparent background (using Paint Shop Pro).
If you are interested in learning about more complicated use of images in this way, then check out the next tutorial in the series, where we delve deep into some more advanced knowledge on this topic. However, if your needs are simple, the information here is more than sufficient to create your own custom titles and credits. Centerprint be gone!
Special thanks to Geburah of the former Team Spleen, who first shared this discovery with the rest of the Quake2 movie community.