640 likes | 798 Views
Sega 500. A Near TC for the GUI. Jeff “Ezeikeil” Giles jgiles@artschool.com http://gamestudies.cdis.org/~jgiles. So far. We’ve covered the core ins and outs of the GUI system in UT2003. Changed the Menus. Got functionality. Today.
E N D
Sega 500 A Near TC for the GUI Jeff “Ezeikeil” Giles jgiles@artschool.com http://gamestudies.cdis.org/~jgiles
So far • We’ve covered the core ins and outs of the GUI system in UT2003. • Changed the Menus. • Got functionality .
Today • The presentation is going to be a little light on the graphic site of things since the GUI doesn’t like to have it’s picture taken. • Also, I’m going focus on the functionality of the new stuff. Not really look at the specifics of previously seen GUI items.
The Plan • We’re going to overhaul the front end of UT2003 so that it doesn’t look or behave like anything even resembling UT. • Also, we’re going to make it run exclusively on a specific map, with a specific game type and mutator.
The Plan • How our menu’s will relate: Intro Movie Splash Main Options Play Config Menu
Getting started • Our main menu is simply going to be a new background, text box and a button “begin” which takes us to the options screen. class EzeMainMenu extends GUIPage;
Main Menu • The first big change is that we loaded some custom textures for the menus • One for the background, one for the button. #exec texture IMPORT name=MAINMENU FILE=Textures\MainMenu.bmp #exec texture IMPORT name=BEGIN FILE=Textures\Begin.bmp
Main Menu //begin button Image=material'BEGIN' ImageStyle=ISTY_Scaled ImageColor=(R=255,G=255,B=0,A=255) ImageRenderStyle=MSTY_Translucent Onclick=ButtonClick bFocusOnWatch=true bAcceptsInput=true bMouseOverSound=true OnClickSound=CS_Up <SNIP!> //This menu's defaults Background=Material'MAINMENU' WinWidth=1.0 WinHeight=1.0 WinTop=0.0 WinLeft=0.0 bAllowedAsLast=true BackgroundRStyle=MSTY_Additive
Main Menu • Adding some functionality • We need something to happen when our button is clicked…e.g. something for the delegate to point to.
Main Menu • This simply causes a menu to open if the controller in index 2 is the caller. function bool ButtonClick(GUIComponent Sender) { //jump to next menu if ( Sender==Controls[2] ) Controller.OpenMenu("eze.EzeGameConfig"); return true; }
Main Menu • We also trap the keyboard so the if escape is pressed, we can back out of the game. function bool MyKeyEvent(out byte Key,out byte State,float delta) { if(Key == 0x1B && state == 1) // Escape pressed { return true; } else return false; }
Main Menu • And just for fun, we add a scroll box to the screen which is initialized here… var GUIScrollTextBox scrollbox; function InitComponent(GUIController MyController, GUIComponent MyOwner) { super.InitComponent(MyController, MyOwner); scrollbox=GUIScrollTextBox(Controls[3]); scrollbox.SetContent("Boo-ya!|Opening a can of whoop-ass",); }
Main Menu • And declared pretty much like any other button Begin Object Class=GUIScrollTextBox Name=PlayerScroll WinWidth=0.472071 WinHeight=0.109878 WinLeft=0.493632 WinTop=0.831000 CharDelay=0.0025 EOLDelay=0.5 bNeverFocus=true End Object Controls(3)=GUIScrollTextBox'PlayerScroll'
Options menu • Right, we’ve told our menu to open another menu, time to create that one. class EzeMainMenu extends GUIPage;
Options menu • Most of the contents of this page are pretty much the same, so no point in talking about them. • Really, the buttons have different pictures and locations, that’s about it…
Options menu • The newness really lies in the functionality of the ButtonClick function.
Options menu function bool ButtonClick(GUIComponent Sender) { //Open Mutator menu if ( Sender==Controls[3] ) Controller.OpenMenu("eze.EzeBounceConfig"); //Begin Game if ( Sender==Controls[1] ) { Console(Controller.Master.Console).DelayedConsoleCommand("open DM- Antalus?Mutator=eze.adrenalinbounce?numbots=4"); Controller.CloseAll(false); } return true; }
Options menu • So waz going down? • This simply opens a menu, just like we said a second ago. //Open Mutator menu if ( Sender==Controls[3] ) Controller.OpenMenu("eze.EzeBounceConfig");
Options menu • But this is a bit different • Nut Shell?...It opens our level and closes the menu… //Begin Game if ( Sender==Controls[1] ) { Console(Controller.Master.Console).DelayedConsoleCommand("open DM- Antalus?Mutator=eze.adrenalinbounce?numbots=4"); Controller.CloseAll(false);
Options menu • DelayedConsoleCommand accepts a string which is parsed buy the ‘?’ is used to determine how the game runs. "open DM-Antalus?Mutator=eze.adrenalinbounce?numbots=4"); • Which map to open, use a mutator and the number of bots.
Using our menu • So, how to we get UT to use OUR menu? • Not hard, but it does take another file and a mod to the UT2003.ini
Using our menu • Here’s the whole file • Simply specify which menu class to use… class EzeGames extends GameEngine; defaultproperties { MainMenuClass="Eze.EzeMainMenu" }
Using our menu • And now in the UT2003.ini we make a change to this line. [Engine.Engine] <SNIP!> GameEngine=Engine.GameEngine
Using our menu • Replace with this • So if you run from a map it show up. • Yet the is a problem… [Engine.Engine] <SNIP!> GameEngine=Eze.EzeGames
Using our menu • Our menu doesn’t show up on the 1st run. • No matter what Here’s why…
Using our menu • Well, this is actually a level. A scripted sequence to be exact, which is running a unrealgame.cinematicgame. • If we open it (NvidiaLogo.ut2) up in the editor we’ll find a AIScript tag. • Once opened, here’s what you’ll find.
Using our menu • Under the AIScript tab
Using our menu • This causes a specific menu to open when the script is done. • Here’s my preferred solution: • Make a copy of this level. I called mine EzeIntro.ut2
Using our menu • And in this copy, point the script at our menu class.
Using our menu • Lastly, in the UT2003.ini. We tell UT to use OUR map too. [URL] Protocol=unreal ProtocolDescription=Unreal Protocol Name=Player Map=Index.ut2 LocalMap=EzeIntro.ut2
Using our menu • And, yeah. You can totally customize the intro map if you like.
Using our menu • Great! Your menu’s are now in place. • Time to waste hours of our lives figuring out where to place the buttons & stuff by yutzing with the X and Y coordinates… There has to be a better way…
a better way… • Yeah…there is… • Here’s an snipit from an online forum by a fella named Dr.Sin… • You’ll need to be running the debug *.u’s for this by the way.
a better way… • Just move you current *.u’s (the retail build) into a temp folder and dump the debugs into the system folder. (if your at school, you should be good to go)
a better way… • First things first… all mod authors please do the following: • In UT2003.ini look for the header [XInterface.GUIController] • Add this to the section: bModAuthor=true
a better way… • This will unlock the GUI placement and debug code. Once there, at any GUI page you can do the following.. • Press CTRL-ALT-D to enter design mode. <Design mod???>
a better way… • Hold CTRL and click on any control on the page. The GUI will highlight (from the outermost inward as you click) the different controls under the cursor. <Dude…gota try this>
a better way… • >OH….my god….debug info….for which menu the mouse is over….my god!< <Dude…it gets better>
a better way… • CTRL+Cursors move the controlCTRL+ -/= size YCTRL+ +/- size X • Holding ALT will size/move 5x faster. • Holding ALT will also allow you to move the control via the mouse.
a better way… >>> GASP!!! <<< • Wait, there’s more. • Press CTRL-C to copy the dimensions & position of the control to the clipboard.
a better way… • Yes…you can cut and paste your screen coordinates. WinWidth=0.300000 WinHeight=0.236250 WinLeft=0.024882 WinTop=0.589333
a better way… • And…yes…there is a god >>>Thud!....passes out from shock and dismay…<<<
a better way… • What Dr.Sin says about the GUI… “Makes designing menus much easier.”
Actually, he says a bit more… • A GUIPage is the main menu container that holds other menu components. • It's what the controller tracks on the top most level. To make a new menu, create a new page and start adding GUIComponents to it.
Actually, he says a bit more… • The GUIComponents get defined in the default props and need to be assigned in order to the Controls[x] array.
BTW • Word has is, Dr.Sin is someone at Epic.
Lastly… • Time to deal with the splash screen.
And that loading screen… • Dealing with this fella is actually really easy once we get the EzeMainMenu in place…because, this file also specifies the loading page to use . • Just add yours… LoadingClass="Eze.EzeLoading"
And that loading screen… • But there is one slightly odd thing…The loading screen is derived from a vignette…and there isn’t a since doc in the code explaining what a vignette is in the context of UT Figures don’t it?