Game Development Community

Different GUI for each mission?

by DarkProfit · in Torque Game Engine · 06/09/2005 (11:01 am) · 11 replies

For example reasons I am just going to use the SDK exmples.

Ok lets say I want 1 game that has the fps and racing in it.

would i need to combine both into 1 directorr ie: missions etc.

or could i leave them in there normal directorys ie: fps/racing under example
and if so how would you jump between the 2 ?

Keep in mind i just bought the sdk and I am still playing around
with the scripts and what they can do etc. (nice engine btw).

Any thoughts or ideas?

#1
06/09/2005 (11:19 am)
Just copying the files from one dir to the other will not give you instant access to fps and racing to the player.

Basically you will have to find what scripts offer the fps elements and the vehicle elements, combine the functionality in new scripts and add more functionality that will allow a player to control a character or a vehicle.

I couldn't tell you exactly how to combine both but what I suggest is first define what kind of gameplay you want and then find out what elements of that gameplay you need to combine.
#2
06/09/2005 (11:23 am)
Thats pretty much what i thought, thanks for the fast reply :)

Have you played around with having different GUI's in different missions at all?
Doesn't look like it can be defined looks like 1 gui for all missions etc.
#3
06/09/2005 (11:26 am)
The way your thinking of the GUI is a bit off... the 3D view you see the game in is a gui element in itself ... called the "PlayGui". The rest is just different gui "controls" overlayed over it, you can switch out whatever gui elements you want :)

if you hit "F10" you can see all the elements, you can remove and switch out whatever you like... you can overlay more Guis over it if you like or take out parts, this can all be done dynamically in the game fairly easily

canvas.pushDialog(guiName);

will "push" a gui over the present one

canvas.popDialog(guiname);

will "pop" the gui off of the screen display

you can also .add(guiName) gui elements to present guis.
#4
06/09/2005 (11:30 am)
So can I have 1 Mission have health bars on bottom left and in 2 mission have them in the upper right?

The reason I am asking this is because my game involves 2 types of game types one is fps
but some missions are cars etc. and when in the cars one you have a speed gui etc. where
in the fps you would not have a speed gauge.

How can I switch between the 2 different gui interfaces?
based on mission. or mission type rather.

"edit after your edit lol"
I know about the F10 etc. and have the GUI stuff working IE: in the FPS i have the
health/energy in the upperright etc. "btw left=right and top=bottom whats with that?"
(on the positioning that is).

But if I load up a new mission it will have all the same gui as the last mission
hence where i am having the problem.

btw thanks for all the replies most engine forums dont get this type of feedback.
#5
06/09/2005 (12:24 pm)
Knowbody have a solution?
#6
06/09/2005 (12:29 pm)
You will just have to track which state your gameplay is current in, and take down the gui controls for the other mission type, and push the controls for the current mission type. As Matt suggested, you can use the canvas.pushDialog and canvas.popDialog for these actions.
#7
06/09/2005 (12:31 pm)
Dang would be easier just to load a different folder but apparently that isnt possiable.
Guess I will have to do it the way it was suggested.
#8
06/09/2005 (1:01 pm)
It's really not that difficult. You write one function "swapGuis" that turns off the first set of gui's, and turns on the second. 1 line of script for each gui to turn off, and one line of script for each to turn on.

--and that's only needed if you want seamless transition of gui's. You could simply throw away the old mission completely, have it load a new mission, and use a different gui file for the second mission, but the total work would be about the same--and the first technique gives you instant switching, so they could jump into your vehicle and next tick have all the guis changed over.
#9
06/09/2005 (1:07 pm)
Anytype of example code? I do get what everyone is talking about but just bought the engine
and have only had about a day to play with it.

So if i am getting all this right
i have lets say 2 gui's
on one mission i load up or show gui1 and in the other mission i hide and show gui2?

if that is the case what would be the example to show/hide a gui?

thanks for the help btw
#10
06/09/2005 (1:40 pm)
Just look at the stock scripts in any of the starter.xxx directories. There are quite a few gui's that pop in and out (options dialog, server dialogs, etc.) based on keypresses, or other states of the game.

At this point in your Torque experience level, you will gain a huge advantage by simply picking a topic (like this one), running through one or more of the demo's to see if it's used, and then tracking down where the code is to see how they do it.

In more than a year of Torque, I can't really think of any specific type of functionality that I wanted to implement that didn't have a similar implementation somewhere in the code or scripts--it was just a matter of finding it, and adapting it!
#11
06/09/2005 (1:50 pm)
Kewl thx