Mission Title Screen while Loading

From The DarkMod Wiki
Jump to navigationJump to search

written by Fidcal

Introduction

This is how to get your own graphic title screen to display while loading your Dark Mod mission. With optionally added text and loading progress bar.


Creating Your Title Picture

First create your title picture in 1024 x 768 tga format. If you have no knowledge of how to create your own image files then a simple way is to take a screenshot while playing your mission. If you enter the command screenshot in the Darkmod console then it dumps the current view to the darkmod\screenshots folder. Or you can bind that command to a key then just hit the key in game, eg, bind "F5" "screenshot" or add it to your Darkmod.cfg (it may already be defined.) (Screenshot is currently bound to "F12" in modern TDM releases).

The picture should now be stretched to 1024 x 1024 to be compatible with older graphics cards (Doom 3 reduces it back in-game.) This is the only problem for the novice screen maker so you might need help or get a paint program that will do this for you.

I believe an alternative is instead to add an alpha channel transparency panel of 1024 x 256 at the bottom of your original 1024 x 768 screenshot to give the screen the overall size of 1024 x 1024.

Whichever method you use to create your picture you can either create the title in the image with a paint program or optionally text can be displayed on top of it while loading the mission.

Save the picture with any name (eg, mission_start.tga) in any suitable subfolder, eg, guis/assets/splash (create if necessary) within either the darkmod folder or in your pk4 file.

Preparing the gui File

A plain text gui file is used to display the picture while loading your mission.

Open your plain text editor and save a blank file with the exact same name as your map file but ending in gui instead of map, eg,

mymapname.gui

and save it in the folder (create if needed)....

darkmod\guis\map
or....
base\guis\map

NOTE: the spellings. It must be guis not gui and it must be map NOT maps. Don't put it in the main maps folder nor in guis/assets/maps.


Creating the gui File

Copy and paste the following into the gui file you just prepared and resave it. I'll explain after how you customise it for yourself...


windowDef Desktop
{
	rect	0,0,640,480

	windowDef TitlePicture
	{
		rect	0,0,640,480
		visible	1
		background	"guis/assets/splash/mission_start.tga"
	}
 
	windowDef MissionText
	{
	 	rect         20, 10, 594, 70
			bordersize   1
 			bordercolor  1, 1, 1, 0.5
		backcolor    1, 0, 0, 0.5
		text         "MISSION TITLE"
		textscale    1.25
		font         "fonts/medusa"
		textalign    1
		forecolor    1,1,0,0.75
	}
 
	windowDef ProgressBarText
	{
		rect	232,444,180,18
		text         "MISSION LOADING"
		textscale    .25
		font         "fonts/medusa"
		textalign    1
		forecolor    1,1,0,1
	}

	windowDef ProgressBarBorder
	{
		rect	232,460,180,10
 		bordersize   1
		bordercolor  1, 1, 0, 0.35
	}

	windowDef ProgressBarInitialize
	{
		rect	230,457,( "gui::map_loading" * 175 ),16

		windowDef LoadingFill
		{
			rect	0,0,256,16
			background	"guis/assets/splash/load"
		}
	}

	windowDef Action
	{
		rect	0,0,0,0
		visible	1

		onTime 50
                {
			set "FlareBox::rect" "17 0 54 21" ;
		}

		onTime 100
                {
			set "FlareBox::rect" "37 0 54 21" ;
		}

		onTime 150
                 {
			set "FlareBox::rect" "57 0 54 21" ;
		}

		onTime 200
                 {
			set "FlareBox::rect" "67 0 54 21" ;
		}

		onTime 250
                 {
			set "FlareBox::rect" "81 0 54 21" ;
		}

		onTime 300
                {
			set "FlareBox::rect" "100 0 54 21" ;
		}
	}
}

Customising the gui File

In your plain text editor you will see that the gui file is made up of sections enclosed in curly brackets each beginning with a header: windowDef name.


Definitions

Positions and sizes are usually x,y,w,h where x,y are the top left screen position in pixels. w,h are the width and height

Colours are defined r,g,b,a being the amount of red, green, blue components and degree of transparency, each in the range 0 to 1. So 1 1 1 1 would give bright white with no transparency; 0 0 0 0.5 would be black with half transparency; 0 1 0 1 would be green etc. Experiment.


Picture Path and Name

The first one to look at is headed windowDef TitlePicture so make sure the path and image file name is the same as yours. Change and resave if not.....


	windowDef TitlePicture
	{
		rect	0,0,640,480
		visible	1
		background	"guis/assets/splash/mission_start.tga"
	}

Don't change the rect 0,0,640,480 even though your image is bigger. Doom 3 automatically scales everything.


Text Title Header

The next section is windowDef MissionText. If you don't want this, eg, your mission title screen already has a header then delete the whole of the following section. You must delete everything shown below and nothing more - the header and everything down to and including the closing curly bracket then resave and continue to the next section...

	windowDef MissionText
	{
	 	rect         20, 10, 594, 70
 			bordersize   1
		bordercolor  1, 1, 1, 0.5
		backcolor    1, 0, 0, 0.5
		text         "MISSION TITLE"
		textscale    1.25
		font         "fonts/medusa"
		textalign    1
		forecolor    1,1,0,0.75
	}

But if you do want the text title heading then this is how to modify it. (note you could also copy and paste it below itself then rename the header to any different name of your choice and modify that for some other text if needed on another part of the screen.)

  • rect x,y,w,h - This is a blank rectangle that the text must fit in. see #Definitions
  • bordersize N is the thickness of an optional border round the rectangle - delete that line if not wanted.
  • bordercolor r,g,b,a is the border colour. See #Definitions
  • backcolor r,g,b,a - See #Definitions a color to fill the background of the rectangle. Can be used without a border. Delete if not wanted.
  • text - here you should type in your mission name or whatever text you want.
  • textscale - adjust the font size to taste and to fit the screen
  • font - use any font you like in the darkmod/fonts folder. There are Doom 3 ones of course but not Dark Mod style.
  • textalign 1 - this centres the text
  • forecolor r,g,b,a - See #Definitions the text colour.

Clearly if your text does not fit the rectangle then you need to adjust the rectangle size, position, and perhaps the font size in textscale.

Adding Random Text

You can add random quotes, tips, etc to your loading screen, to give players something to read while they wait for the map to load. See Loading Screen Text.

The Progress Bar

If you don't want a progress bar then you need to delete all the remaining sections leaving only the final closing curly bracket of the main windowDef Desktop. Just make sure all your curly brackets are in pairs of opening and closing and no odd ones on their own.

If you want to modify the progress bar then you're probably knowledgeable enough already to figure it out. The text displayed uses the same principle as the title header. The progress bar border uses the same method as the title header too but without text. If you want to move it elsewhere on the screen then change the x,y 230,457 in ProgressBarInitialize.


Try it out!

If all is well you need only load your mission in the usual way with map at the console or via the Dark Mod menus and the title page should display while it is loading. If it fails to show then check carefully each stage above and particularly...

  • Is your map file the exact same name as the gui?
  • Are the paths exactly correct?
  • Is the picture in tga format?