Trying a few new things...
by Jason Gossiaux · in Torque Game Engine · 10/20/2007 (6:40 am) · 5 replies
Howdy everyone!
So I picked up TGE about a week ago, bought all the recommended books and have read them, and have completed many of the online tutorials and walkthroughs. So far, so good. I figured I'd post what I am hoping to do, followed by my progress over time so this can serve as a resource for others. Well, that and if people can nudge me in the right direction it'll help a lot :P
My goal is to make a FPS/RTS hybrid.
Mouse is mouselook until the player hits 'b', then it changes to mouseselect mode (think I've seen how to do this already).
The GUI will contain build buttons that open up build dialogues (accessible in mouseselect mode of couse) from which you can select things to build.
Clicking a selection closes the GUI element and replaces the mouse with a semi transparent represenation of the .DIF model associated with that build selection. It is locked to the ground from a central-point, and moves along the ground as the player moves the mouse to and fro.
Holding ALT and moving the mouse will rotate the building.
Left clicking will attempt to place the shape on the ground. A quick 4 corners check will determine if it will fit (check for colission with DTS, DIF and Terrain), and if so it will just appear and the player's mouse will go back to being a mouse. Otherwise it'll beep at you.
Once placed you can select the building while in mouse select mode (seen how to do this already).
Using a second set of GUI menus the player can alter the terrain so they could flatten an area before placing a building. (seen no reference to this anywhere).
This will all work in multiplayer mode.
I have my work cut out for me. I figure it will take a good amount of engine changes (which is fine). Now to figure it all out. Wish me luck!
So I picked up TGE about a week ago, bought all the recommended books and have read them, and have completed many of the online tutorials and walkthroughs. So far, so good. I figured I'd post what I am hoping to do, followed by my progress over time so this can serve as a resource for others. Well, that and if people can nudge me in the right direction it'll help a lot :P
My goal is to make a FPS/RTS hybrid.
Mouse is mouselook until the player hits 'b', then it changes to mouseselect mode (think I've seen how to do this already).
The GUI will contain build buttons that open up build dialogues (accessible in mouseselect mode of couse) from which you can select things to build.
Clicking a selection closes the GUI element and replaces the mouse with a semi transparent represenation of the .DIF model associated with that build selection. It is locked to the ground from a central-point, and moves along the ground as the player moves the mouse to and fro.
Holding ALT and moving the mouse will rotate the building.
Left clicking will attempt to place the shape on the ground. A quick 4 corners check will determine if it will fit (check for colission with DTS, DIF and Terrain), and if so it will just appear and the player's mouse will go back to being a mouse. Otherwise it'll beep at you.
Once placed you can select the building while in mouse select mode (seen how to do this already).
Using a second set of GUI menus the player can alter the terrain so they could flatten an area before placing a building. (seen no reference to this anywhere).
This will all work in multiplayer mode.
I have my work cut out for me. I figure it will take a good amount of engine changes (which is fine). Now to figure it all out. Wish me luck!
About the author
#2
the typemask for interiors is "$TypeMasks::InteriorObjectType".
10/20/2007 (1:17 pm)
Try expanding the search types to include interiors:// Search for anything that is selectable below are some examples
%searchMasks = $TypeMasks::PlayerObjectType | $TypeMasks::CorpseObjectType |
$TypeMasks::ItemObjectType | $TypeMasks::TriggerObjectType;the typemask for interiors is "$TypeMasks::InteriorObjectType".
#3
// Search for anything that is selectable below are some examples
%searchMasks =
$TypeMasks::StaticObjectType | $TypeMasks::EnvironmentObjectType | $TypeMasks::TerrainObjectType |
$TypeMasks::InteriorObjectType | $TypeMasks::WaterObjectType | $TypeMasks::TriggerObjectType |
$TypeMasks::MarkerObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::GameBaseObjectType |
$TypeMasks::ShapeBaseObjectType | $TypeMasks::CameraObjectType | $TypeMasks::StaticShapeObjectType |
$TypeMasks::PlayerObjectType | $TypeMasks::ItemObjectType | $TypeMasks::VehicleObjectType |
$TypeMasks::VehicleBlockerObjectType | $TypeMasks::ProjectileObjectType | $TypeMasks::ExplosionObjectType |
$TypeMasks::CorpseObjectType | $TypeMasks::DebrisObjectType | $TypeMasks::PhysicalZoneObjectType |
$TypeMasks::StaticTSObjectType | $TypeMasks::GuiControlObjectType | $TypeMasks::StaticRenderedObjectType |
$TypeMasks::DamagableItemObjectType ;
Echo strings and stepping through the debugger lead me to believe the code is working in its entirety. But I don't think DIFs have bounding boxes in the same way shapes do, so I'll need some other way to flag the Dif model as selected. Maybe a glow... or something hovering over the Dif model will get the job done. Guess I'll see :P
10/20/2007 (3:56 pm)
I was actually already doing that with this :// Search for anything that is selectable below are some examples
%searchMasks =
$TypeMasks::StaticObjectType | $TypeMasks::EnvironmentObjectType | $TypeMasks::TerrainObjectType |
$TypeMasks::InteriorObjectType | $TypeMasks::WaterObjectType | $TypeMasks::TriggerObjectType |
$TypeMasks::MarkerObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::GameBaseObjectType |
$TypeMasks::ShapeBaseObjectType | $TypeMasks::CameraObjectType | $TypeMasks::StaticShapeObjectType |
$TypeMasks::PlayerObjectType | $TypeMasks::ItemObjectType | $TypeMasks::VehicleObjectType |
$TypeMasks::VehicleBlockerObjectType | $TypeMasks::ProjectileObjectType | $TypeMasks::ExplosionObjectType |
$TypeMasks::CorpseObjectType | $TypeMasks::DebrisObjectType | $TypeMasks::PhysicalZoneObjectType |
$TypeMasks::StaticTSObjectType | $TypeMasks::GuiControlObjectType | $TypeMasks::StaticRenderedObjectType |
$TypeMasks::DamagableItemObjectType ;
Echo strings and stepping through the debugger lead me to believe the code is working in its entirety. But I don't think DIFs have bounding boxes in the same way shapes do, so I'll need some other way to flag the Dif model as selected. Maybe a glow... or something hovering over the Dif model will get the job done. Guess I'll see :P
#4
10/21/2007 (3:30 am)
Hm - i haven't used this resource, so it may be that you'll need to dig in to the engine a bit, but it should be pretty minimal. ie, the mission editor draws bounding boxes around DIFs, so you know the code to do that is in there somewhere. It might be a matter of modifying the InteriorInstance class to recognize the "selected" flag during render or somesuch.
#5
10/22/2007 (6:00 pm)
I've been digging around the interiorRender.cc file, but can't seem to find where the bounding box gets drawn. I guess it must be done in an entirely different way, because searching on darn near every keyword I can think of fails to locate anything. Any help would be appreciated.
Torque Owner Jason Gossiaux
Indie Dev
Are there more advanced tutorials anywhere that deal with the other ideas I have above? My problem really just seems to be a lack of documentation and good examples. The two 3D game programming all in one books are more oriented for FPS than RTS/RPG style games, which limits their usefulness. Thanks!