C++ Modifications
by Andy Stubbs · in Torque Game Engine · 01/14/2007 (1:42 pm) · 8 replies
Hello people. I know this has no doubt been asked a thousand and one times (a search tells all) - But i can not find a difinative answer to the question regarding simple FPS features not found in Torque which one would expect.
I know the Door feature is not included, as the engines original purpose (Tribes2) did not need it. However, one would expect since its been asked for again, and again since Torque v12 - that this would have been added by now (not moded).
I should start by saying, i am not a C++ coder, in the scence, i am unable to sift through code, edit and change. Im using Torque because i can add resources to the C++, and the rest is TorqueScript, which is simplified.
Now, i have tryed added numorus different methods of Doors, Lifts, Cut Scenes, Advanced lighting etc etc from the Resources. All have work a treat, until it comes to Doors and Lifts - Then, i get a headache.
Im assuming, when you make your .map file, then run the map2diff, the Properties assisned to Polys, Cubes etc are stored in the .dif file? If this is correct, is it not possable to make a C++ change to the main code to check this on the Interior object?
In case i've lost you guys. I mean, in 3D World Studio, Quark, Hammer etc. You can create a poly which will be your door, lift etc. Then, assign a property to the poly. For example (name=Door) and an additional on for its direction, Example (dir=1). 1 could be Open Left, 2 could be Open Up etc.
Then have a C++ change, do detect this. If a collision happens, then the aciton would be carried out. The size of the poly is stored in the dif? - then just move that poly left, up etc by the size.
Im sorry if this has been discussed before. As im not a C++ coder, im just assuming its an easy mod to the code. I would use the normal mods availible. But there too long winded. Creating the door polys, setting triggers, Start nodes end nodes. Telling the start node to go to the end node. Telling the door it belongs to the trigger :o. It just seems easier if the C++ code new the size of the poly, and if its attribute was to be a door, then to just move that if your within its distance. If you know what i mean.
If this has been discussed, im sorry. I got lost in the 1000's of Door/Lift posts. All pointing to the same 2 resources.
I know the Door feature is not included, as the engines original purpose (Tribes2) did not need it. However, one would expect since its been asked for again, and again since Torque v12 - that this would have been added by now (not moded).
I should start by saying, i am not a C++ coder, in the scence, i am unable to sift through code, edit and change. Im using Torque because i can add resources to the C++, and the rest is TorqueScript, which is simplified.
Now, i have tryed added numorus different methods of Doors, Lifts, Cut Scenes, Advanced lighting etc etc from the Resources. All have work a treat, until it comes to Doors and Lifts - Then, i get a headache.
Im assuming, when you make your .map file, then run the map2diff, the Properties assisned to Polys, Cubes etc are stored in the .dif file? If this is correct, is it not possable to make a C++ change to the main code to check this on the Interior object?
In case i've lost you guys. I mean, in 3D World Studio, Quark, Hammer etc. You can create a poly which will be your door, lift etc. Then, assign a property to the poly. For example (name=Door) and an additional on for its direction, Example (dir=1). 1 could be Open Left, 2 could be Open Up etc.
Then have a C++ change, do detect this. If a collision happens, then the aciton would be carried out. The size of the poly is stored in the dif? - then just move that poly left, up etc by the size.
Im sorry if this has been discussed before. As im not a C++ coder, im just assuming its an easy mod to the code. I would use the normal mods availible. But there too long winded. Creating the door polys, setting triggers, Start nodes end nodes. Telling the start node to go to the end node. Telling the door it belongs to the trigger :o. It just seems easier if the C++ code new the size of the poly, and if its attribute was to be a door, then to just move that if your within its distance. If you know what i mean.
If this has been discussed, im sorry. I got lost in the 1000's of Door/Lift posts. All pointing to the same 2 resources.
#2
01/16/2007 (8:17 am)
Back when I was sifting trough resources, I tried many of those. In the end though, I went with a scripted solution with a StaticShape that animates when a player comes close to it, and disables collision. Then when the player has left the vicinity, it animates again to appear closing and then the collision is reenabled.
#3
Seriously, though. If you want pathed interiors, use the pathed interior resource. It is not perfect, but it is a workable solution. But if it were a trivial change, it would have been done (and most likely added if it did not impact other areas of the engine; kind of like the Advanced Camera resource).
Since it is not necessarily a trivial change, I would recommend contracting a C++ coder with Torque experience to get it up and running in your game. I have been hoping for some time that it would be reliably be added and tested with Matthew Fairfax on the team, but he's kind of a busy guy!
You could also use DTS objects, though you will have to have a convenient way to convert map data (map23ds, or the upcoming Constructor's LWO exporter) to a format that modeling packages can read to get your scale correct.
This is one of those situations, though, where it has been made easy for artists and modders, though the backend codework is more complex than "add a trigger in an editor and viola!". I remember how confusing people thought creating tracks in Quake 2 and Half-Life was. Creating them was so fundamentally simple in comparison to making them work in code...and Quake 2 was designed with them in mind.
EDIT:
@ Stefan
That's the solution I've used for almost every prototype I've worked on that had doors. It is a simple solution and gives the same impression to the player.
01/16/2007 (8:26 am)
Use Quake/2/3 if you want architected in-engine pathed CSG geometry.Seriously, though. If you want pathed interiors, use the pathed interior resource. It is not perfect, but it is a workable solution. But if it were a trivial change, it would have been done (and most likely added if it did not impact other areas of the engine; kind of like the Advanced Camera resource).
Since it is not necessarily a trivial change, I would recommend contracting a C++ coder with Torque experience to get it up and running in your game. I have been hoping for some time that it would be reliably be added and tested with Matthew Fairfax on the team, but he's kind of a busy guy!
You could also use DTS objects, though you will have to have a convenient way to convert map data (map23ds, or the upcoming Constructor's LWO exporter) to a format that modeling packages can read to get your scale correct.
This is one of those situations, though, where it has been made easy for artists and modders, though the backend codework is more complex than "add a trigger in an editor and viola!". I remember how confusing people thought creating tracks in Quake 2 and Half-Life was. Creating them was so fundamentally simple in comparison to making them work in code...and Quake 2 was designed with them in mind.
EDIT:
@ Stefan
That's the solution I've used for almost every prototype I've worked on that had doors. It is a simple solution and gives the same impression to the player.
#4
I like the scripted door object resources that I find on this site. This allows me to have more control over the object and its properties (such as animation, rotation, and health/destroyable).
However, there is one small problem. When I create my interiors, I leave a hole or portal wherever I will have an interactive door. If I have a mental institution with 25 doors, that means I need to hand place 25 doorObjects. If I have to move the entire interior, then I need to move all the doors with it.
I like the idea of flagging a polygon (be it a portal or an invisible poly). When the interior is loaded, maybe having a custom routine look for that flagged poly and automatically place one of the door objects. I think this would be the overall best solution.
No more hand placing doors, and the doors that are placed still have that great script functionality.
01/16/2007 (8:28 am)
@Andy - I've read your post a few times to try and figure out a happy middle ground. I like the scripted door object resources that I find on this site. This allows me to have more control over the object and its properties (such as animation, rotation, and health/destroyable).
However, there is one small problem. When I create my interiors, I leave a hole or portal wherever I will have an interactive door. If I have a mental institution with 25 doors, that means I need to hand place 25 doorObjects. If I have to move the entire interior, then I need to move all the doors with it.
I like the idea of flagging a polygon (be it a portal or an invisible poly). When the interior is loaded, maybe having a custom routine look for that flagged poly and automatically place one of the door objects. I think this would be the overall best solution.
No more hand placing doors, and the doors that are placed still have that great script functionality.
#5
As for lifts, there was one done about 4 or 5 months ago that was called something along the lines of "movable dts platforms you can stand on!", or something like that. That was the name of the thread it originated in, and I'm pretty sure a resource was created from it. I did play around with this one some and it seems like the best bet for lifts. Unfortunately I didn't bookmark and I'm having trouble digging it up. Perhaps someone knows the thread/resource I'm talking about and has a link for it handy.
01/16/2007 (8:30 am)
Recently someone created a new door resource, I believe it was called Door Object, which I'm told is the best implementation of doors yet. I haven't used it myself but I've seen it in action and have been told it's rather easy to work with.As for lifts, there was one done about 4 or 5 months ago that was called something along the lines of "movable dts platforms you can stand on!", or something like that. That was the name of the thread it originated in, and I'm pretty sure a resource was created from it. I did play around with this one some and it seems like the best bet for lifts. Unfortunately I didn't bookmark and I'm having trouble digging it up. Perhaps someone knows the thread/resource I'm talking about and has a link for it handy.
#6
Personally I love the door object resource.
I've tried many resources talking about doors and it was by far the best one I've ever used.
01/16/2007 (8:33 am)
Quote:Recently someone created a new door resource, I believe it was called Door Object, which I'm told is the best implementation of doors yet. I haven't used it myself but I've seen it in action and have been told it's rather easy to work with.
Personally I love the door object resource.
I've tried many resources talking about doors and it was by far the best one I've ever used.
#7
Good thing I have everything bookmarked!
This is Ramen's code for a moving DTS shape.
Its amazing and works really well.
http://www.garagegames.com/mg/forums/result.thread.php?qt=47074
----
As for doors, I set up my door in 3dsmax, with an Open, close, and Nothing animation.
Set triggers outside of it, and as the character passes the trigger, the door is animated
and presto!
01/16/2007 (9:27 am)
@ Scott,Good thing I have everything bookmarked!
This is Ramen's code for a moving DTS shape.
Its amazing and works really well.
http://www.garagegames.com/mg/forums/result.thread.php?qt=47074
----
As for doors, I set up my door in 3dsmax, with an Open, close, and Nothing animation.
Set triggers outside of it, and as the character passes the trigger, the door is animated
and presto!
Torque Owner Nick Wagner
Here's how i *think* you'd need to go about it:
1. Create a door.dts in your 3d application of choice complete with "door open" , "door close" animations, and a collision box.
2. Create a Door datablock or class in torquescript.
Make it so that when the player collides with the door object it plays that datablock's door.open animation.
Since datablocks are basiclly classes ( i *think* ) you should be able to just create this once and then you can reference this datablock for all your new doors.