Moving Objects Players can Ride on, code inside.
by Cinder Games · in Torque Game Engine · 07/03/2006 (3:35 am) · 105 replies
This is a continuation of this thread....
www.garagegames.com/mg/forums/result.thread.php?qt=44667
for pictures....
www.garagegames.com/blogs/11127/10822
Alright everyone, here's some files you can add to add this spiffy feature.
This zip file contains all the needed files to convert your STOCK 1.4 torque.
I do not have the time to do a "resource" right now, so i just threw all the files i modified in a directory tree.
Save this zip in your base torque folder....
C:\Torque or whatever you are using.
Extract the zip where it is and it should overright all the correct files.
You will need to add pathshape.cc and pathshape.h to your Project as well.
Included in a replacement stronghold.mis file. it should put you on the dock when you load it up. the pathshape object is "docked" there. simple fall onto it to begin the ride.
There is currently one small limitation. As of now the moving platform is only affecting the POSTION of the player, and not rotations or anything. I was having a hell of a time trying to get the matrix.mul stuff working. That'll be updated later to fix.
Please post any comments/suggestions/questions.
If something doesn't work, let me know cause i didn't test to make sure all the files were put in the archive :p
I should state this is based on a resource by Anthony Lovell
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9093
MANY of the functions in sceneobject.cc, he wrote are including in this, however not all of them. I found use in some of his code, but decided to go a different way in many other places
The Zip::
ramensama.dyndns.org:8000/temp/torque.zip
PS, i'd like to mirror this since i'm hosting it off my computer. If you can mirror this, please let me know.
www.garagegames.com/mg/forums/result.thread.php?qt=44667
for pictures....
www.garagegames.com/blogs/11127/10822
Alright everyone, here's some files you can add to add this spiffy feature.
This zip file contains all the needed files to convert your STOCK 1.4 torque.
I do not have the time to do a "resource" right now, so i just threw all the files i modified in a directory tree.
Save this zip in your base torque folder....
C:\Torque or whatever you are using.
Extract the zip where it is and it should overright all the correct files.
You will need to add pathshape.cc and pathshape.h to your Project as well.
Included in a replacement stronghold.mis file. it should put you on the dock when you load it up. the pathshape object is "docked" there. simple fall onto it to begin the ride.
There is currently one small limitation. As of now the moving platform is only affecting the POSTION of the player, and not rotations or anything. I was having a hell of a time trying to get the matrix.mul stuff working. That'll be updated later to fix.
Please post any comments/suggestions/questions.
If something doesn't work, let me know cause i didn't test to make sure all the files were put in the archive :p
I should state this is based on a resource by Anthony Lovell
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9093
MANY of the functions in sceneobject.cc, he wrote are including in this, however not all of them. I found use in some of his code, but decided to go a different way in many other places
The Zip::
ramensama.dyndns.org:8000/temp/torque.zip
PS, i'd like to mirror this since i'm hosting it off my computer. If you can mirror this, please let me know.
#42
Lately i've been playing with mounting objects to the player, i can attach items and shapebases to the player and have him ride around on a moving platform. Items are giving me trouble when they are set to be non static though. it's strange.
07/12/2006 (2:55 pm)
I've been brainstorming, and i think i'll be able to be able to get much more done with much less code changes, by modifying just gameprocess.cc and sceneobject.cc. But this will be something for a little later.Lately i've been playing with mounting objects to the player, i can attach items and shapebases to the player and have him ride around on a moving platform. Items are giving me trouble when they are set to be non static though. it's strange.
#43
Imagine a totally dynamic level. I mean moving, twisting, etc.
Picture walking thru the inside of a body or something, with walls moving, passages moving on their own, a totally animated DTS level, or pieces of DTS objects linked together, whatever.
Using some of the code i got planned, a level like this will be possible.
How bout a suspension bridge? that could easily be done too, as you walk out farther, it dips, sways, etc.
YOu can't just animate a big DTS object. that won't work, the player will just fall thru it when it moves. but my code will seek out the nearest nodes in an parented DTS object, and use that as a reference point in which to move the player. To me it sounds cool.
:)
07/12/2006 (3:08 pm)
Oh, also to give people an idea of what my next incarnation could doImagine a totally dynamic level. I mean moving, twisting, etc.
Picture walking thru the inside of a body or something, with walls moving, passages moving on their own, a totally animated DTS level, or pieces of DTS objects linked together, whatever.
Using some of the code i got planned, a level like this will be possible.
How bout a suspension bridge? that could easily be done too, as you walk out farther, it dips, sways, etc.
YOu can't just animate a big DTS object. that won't work, the player will just fall thru it when it moves. but my code will seek out the nearest nodes in an parented DTS object, and use that as a reference point in which to move the player. To me it sounds cool.
:)
#44
07/12/2006 (5:38 pm)
Wow, that does sound nice!
#45
No Isssues, No Problems!
I cant wait for the next version to come out.
Keep it up Ramen.!!!!
@Ramen, forget about my earlier question, I was going about something the wrong way.
Im constructing a control system for the shape path, thats all. I intend to hook it all
up to a gui control so as the player collides the gui pops up with, up and up down stop start buttons
which will control the shape along its path. I have a good chunk working the way I want. Still more to go though.
I couldnt do any of this without your code.
Currently your pathPlayerShape(thats what im calling it) will already allow for animation
of hallways and passages that the player as he/she walks or jumps on would be triggered and
loop animation started.Based on what I know so far. Its that twisting motion you talk about thats
interesting.
I think your onto something when your desribe the idea of a suspension bridge.
Because that hanging/swaying motion is a very real feeling that transfers to a human
in real life, and would add so much realism to a game.
I have already been playing with GIANT DTS Shapes(many screens big), and it gives the engine a bit of a hard time.
Im going to run test mysyelf this week on huge open boxes(my version of a space cargo ship for now) and see
what exactly the limits are.
You know how markers describe the path?
Couldnt another set of varibles describing xyz rotation be placed in each marker?
Then that information would get passed on to the player.
I think this could be a way to get a swinging motion to happen.
Great code Ramen, watching this thread to see what happens next!.
-Surge
07/13/2006 (5:35 am)
Anyone having troubles with this code, I just want you to know that I have a heavily modified version of tlk 1.4x and Ramen Samas code works amazing first time out. No Isssues, No Problems!
I cant wait for the next version to come out.
Keep it up Ramen.!!!!
@Ramen, forget about my earlier question, I was going about something the wrong way.
Im constructing a control system for the shape path, thats all. I intend to hook it all
up to a gui control so as the player collides the gui pops up with, up and up down stop start buttons
which will control the shape along its path. I have a good chunk working the way I want. Still more to go though.
I couldnt do any of this without your code.
Currently your pathPlayerShape(thats what im calling it) will already allow for animation
of hallways and passages that the player as he/she walks or jumps on would be triggered and
loop animation started.Based on what I know so far. Its that twisting motion you talk about thats
interesting.
I think your onto something when your desribe the idea of a suspension bridge.
Because that hanging/swaying motion is a very real feeling that transfers to a human
in real life, and would add so much realism to a game.
I have already been playing with GIANT DTS Shapes(many screens big), and it gives the engine a bit of a hard time.
Im going to run test mysyelf this week on huge open boxes(my version of a space cargo ship for now) and see
what exactly the limits are.
You know how markers describe the path?
Couldnt another set of varibles describing xyz rotation be placed in each marker?
Then that information would get passed on to the player.
I think this could be a way to get a swinging motion to happen.
Great code Ramen, watching this thread to see what happens next!.
-Surge
#46
Alright, i understand what you mean by adding another set of variables.. but i'm sorta confused as to what you mean by passed onto the player. Maybe you could expand on what you mean?
07/13/2006 (3:18 pm)
Quote:You know how markers describe the path?
Couldnt another set of varibles describing xyz rotation be placed in each marker?
Then that information would get passed on to the player.
I think this could be a way to get a swinging motion to happen.
Alright, i understand what you mean by adding another set of variables.. but i'm sorta confused as to what you mean by passed onto the player. Maybe you could expand on what you mean?
#47
and the player was attached to the shape. This calcualtion always keeps the platform level.
My thought yesterday was that if you could put XYZ ROTATION in the marker information that it
could be transferrred to the player as well?
I was kind of feeding off your idea of a completley flexible swinging and swaying world.
-Surge
07/14/2006 (5:22 am)
Sorry Ramen, I thought the marker's placment was used to calculate the next position for the shape,and the player was attached to the shape. This calcualtion always keeps the platform level.
My thought yesterday was that if you could put XYZ ROTATION in the marker information that it
could be transferrred to the player as well?
I was kind of feeding off your idea of a completley flexible swinging and swaying world.
-Surge
#48
I finally got the platform code integrated into my game level. Ramen, you are a genious. The platform works so well I thought I was dreaming... after pinching myself numerous times, I realized that it wasn't the beer seeing things... I was looking at a true miracle: Moving, ridable platforms. I now will bow down to y.... naw, that's taking it a little too far.
- Jason
08/17/2006 (10:02 am)
Ramen,I finally got the platform code integrated into my game level. Ramen, you are a genious. The platform works so well I thought I was dreaming... after pinching myself numerous times, I realized that it wasn't the beer seeing things... I was looking at a true miracle: Moving, ridable platforms. I now will bow down to y.... naw, that's taking it a little too far.
- Jason
#49
It's mostly just dynamic parenting stuff. Like attaching objects to players nodes and stuff. Not sure how many people even need somethign like this. but i'll probably get back to it soon.
08/17/2006 (2:35 pm)
Well just so you know. i have temporarily stopped working on the "next" evolution of this code so i could actually get some work done on my game. :)It's mostly just dynamic parenting stuff. Like attaching objects to players nodes and stuff. Not sure how many people even need somethign like this. but i'll probably get back to it soon.
#50
I'm having this problem: Installed the zip, added the pathshape files to my project, nuked all my DSOs, and it wasn't working (platform not showing up). Re-rebuilt the game, renuked the DSOs, replayed a few times, and for no reason I can figure out, running the mission with torqueDemo _DEBUG.exe started working like a charm! However when I try the normal .exe I still get these in my console:
starter.fps/server/scripts/pathshape.cs (0): Unable to instantiate non-conobject class PathShapeData.
starter.fps/data/missions/stronghold.mis (0): Unable to instantiate non-conobject class PathShape.
So, running via DEBUG works great, normal .exe doesn't recognize pathShape. I'm new at this and may be missing a basic step ...
-Joe
08/21/2006 (11:49 am)
Thanks for this Ramen! I recently bought 1.4 and was despairing of the lack of movers -- esp. since I'm no coder. "a totally dynamic level. I mean moving, twisting, etc." -- that is exactly what I'd love to make!I'm having this problem: Installed the zip, added the pathshape files to my project, nuked all my DSOs, and it wasn't working (platform not showing up). Re-rebuilt the game, renuked the DSOs, replayed a few times, and for no reason I can figure out, running the mission with torqueDemo _DEBUG.exe started working like a charm! However when I try the normal .exe I still get these in my console:
starter.fps/server/scripts/pathshape.cs (0): Unable to instantiate non-conobject class PathShapeData.
starter.fps/data/missions/stronghold.mis (0): Unable to instantiate non-conobject class PathShape.
So, running via DEBUG works great, normal .exe doesn't recognize pathShape. I'm new at this and may be missing a basic step ...
-Joe
#51
08/21/2006 (2:27 pm)
OK, "problem" solved, I didn't realize the DEBUG .exe is the only one that gets built by my vc2k5 project! :P
#52
08/21/2006 (2:32 pm)
Glad you got it working.
#53
A little project I set for myself was enabling pathshape placement within the mission editor. Using these instructions I managed to create a placeable mission object that gets all the important info into the .mis file.
The only problem is that when I place a pathshape, its "position" is always 0 0 700, and this cannot be changed within the editor. (This initial position appears to be set inside pathShape.cc: 'mat.setPosition(Point3F(0,0,700));' )
I can just edit the .mis file to correct the position, so this is no big deal. Just a bee in my bonnet. I've searched the site and experimented all day to no avail.
My question: is there a way to enable positioning of pathShapes within the mission editor? Or is this an inherent limitation / deep mathy problem?
Gracias,
-Joe
p.s. my addition to objectBuilderGui.gui:
09/14/2006 (5:26 pm)
Semi-off-topic question from a beginner, apologies in advance if this is mis-placed.A little project I set for myself was enabling pathshape placement within the mission editor. Using these instructions I managed to create a placeable mission object that gets all the important info into the .mis file.
The only problem is that when I place a pathshape, its "position" is always 0 0 700, and this cannot be changed within the editor. (This initial position appears to be set inside pathShape.cc: 'mat.setPosition(Point3F(0,0,700));' )
I can just edit the .mis file to correct the position, so this is no big deal. Just a bee in my bonnet. I've searched the site and experimented all day to no avail.
My question: is there a way to enable positioning of pathShapes within the mission editor? Or is this an inherent limitation / deep mathy problem?
Gracias,
-Joe
p.s. my addition to objectBuilderGui.gui:
function ObjectBuilderGui::buildJoePlatform(%this)
{
%this.className = "PathShape";
%this.addField("dataBlock", "TypeDataBlock", "Data Block", "PathShapeData LoopingShape");
%this.addField("speed", "TypeInt", "Speed", "10");
%this.addField("loopNode", "TypeInt", "Loop Node", "2");
%this.addField("Path", "TypeString", "Path", "pathname");
%this.process();
}
#54
10/09/2006 (12:42 pm)
Should the pathedshape apper under Shapes in the worldeditor ??
#55
Thank you for your resource. This is really what I needed. But unfortunately, I have a problem.
If my player try to ride the pathShape when it is not moving, he can ride on it.
But when the shape begins to move, my players position is not updated. He slides and falls down as the shape moves.
I believe I included every code you supplied into my project. I don't know why this happens.
I modified the player.cc and .h for player's new position for swim, walk, crouch. Can it be the
matter?
Hope you'll still monitoring this thread.
Edit
In LoopingShape::onCollision(), I had to add this code.
Hongjin
10/19/2006 (12:15 am)
Ramen,Thank you for your resource. This is really what I needed. But unfortunately, I have a problem.
If my player try to ride the pathShape when it is not moving, he can ride on it.
But when the shape begins to move, my players position is not updated. He slides and falls down as the shape moves.
I believe I included every code you supplied into my project. I don't know why this happens.
I modified the player.cc and .h for player's new position for swim, walk, crouch. Can it be the
matter?
Hope you'll still monitoring this thread.
Edit
In LoopingShape::onCollision(), I had to add this code.
%col.attachToParent(%obj);Now, it works great.
Hongjin
#56
10/19/2006 (3:04 pm)
Alright. Glad you caught that one.
#57
After a few minutes (my leveldesigner say 4-6 minutes) my platforms moving from the path to 0,0,0-position.
But in the editor is the path and platforms still in the same place. If the player go from the platform, he teleport to the right place, but if he is on the platform, he see the platform on the wrong 0,0,0-position.
In the editor modus you can see the objects (platform and player) on the wrong position, but cant chose the objects.. if you chose the object from the Mission-List, it is still in right place and moves along the path, but you see the object staying at the 0,0,0-position.
Any idea about it?
10/23/2006 (4:27 am)
I have a problem with this ressource...After a few minutes (my leveldesigner say 4-6 minutes) my platforms moving from the path to 0,0,0-position.
But in the editor is the path and platforms still in the same place. If the player go from the platform, he teleport to the right place, but if he is on the platform, he see the platform on the wrong 0,0,0-position.
In the editor modus you can see the objects (platform and player) on the wrong position, but cant chose the objects.. if you chose the object from the Mission-List, it is still in right place and moves along the path, but you see the object staying at the 0,0,0-position.
Any idea about it?
#58
10/23/2006 (5:11 am)
Yeah, that's an issue with the pathshape resource unfortunately. The pathshape object can only really reside on a position along a path. I don't know enough about it to fix that resource.
#59
I have unzipped the file to my torq directory it over writes the appropriate files. Now you say to add the pathshape.cc and pathshape.h to the project. Where ??
Im unsure if I put them in a folder or try to put them in the vc++2005 project ?? Thus far I am not seeing a platform and I get the
starter.fps/data/missions/stronghold.mis (0): Unable to instantiate non-conobject class PathShape.
error in the console/
Please keep in mind Im completely new to c++ so I really dont have much of an Idea of what goes where. Could you please tell me where to put these files and how to get it working in a VERY simple manner ?
Im not sure If I have to build the project or what. So please tell me if at any stage I will have to compile through visual c++ etc... Ive tried that BTW and it fails if I do it after Ive added the zip files.
Ive been scripting a bit in torque but Im afraid my lack of c++ knowledge is making me miss something quite simple here and I just cannot figure it out.
Right now Im sitting with a clean TGE install , clean build of the demo through the VC++2005, Ive unzipped the files to the torque folder what do I do from here ? Ive not put the 2 above mentioned files anywhere manually.
Thanks in advance
RageO
10/30/2006 (12:45 pm)
I am completely new to torque so sorry if this is a silly post. I am trying to figure out how too install this and get it to work. I have unzipped the file to my torq directory it over writes the appropriate files. Now you say to add the pathshape.cc and pathshape.h to the project. Where ??
Im unsure if I put them in a folder or try to put them in the vc++2005 project ?? Thus far I am not seeing a platform and I get the
starter.fps/data/missions/stronghold.mis (0): Unable to instantiate non-conobject class PathShape.
error in the console/
Please keep in mind Im completely new to c++ so I really dont have much of an Idea of what goes where. Could you please tell me where to put these files and how to get it working in a VERY simple manner ?
Im not sure If I have to build the project or what. So please tell me if at any stage I will have to compile through visual c++ etc... Ive tried that BTW and it fails if I do it after Ive added the zip files.
Ive been scripting a bit in torque but Im afraid my lack of c++ knowledge is making me miss something quite simple here and I just cannot figure it out.
Right now Im sitting with a clean TGE install , clean build of the demo through the VC++2005, Ive unzipped the files to the torque folder what do I do from here ? Ive not put the 2 above mentioned files anywhere manually.
Thanks in advance
RageO
#60
I guess the rotations are slightly important for most people uses, I cant wait till you get it working.
May main thing for something like this is the players shouldn't even notice that they are on a moving platform.
They should feel as if they are just on the terrain, including camera and object rotations. For my needs that is.
Great job, im sure lots of people will find this usefull!
10/30/2006 (1:05 pm)
Can it handle a more complex DIFF than just a platform? Like a fully enclosed area? What about if they jump?I guess the rotations are slightly important for most people uses, I cant wait till you get it working.
May main thing for something like this is the players shouldn't even notice that they are on a moving platform.
They should feel as if they are just on the terrain, including camera and object rotations. For my needs that is.
Great job, im sure lots of people will find this usefull!
Torque Owner Roland Orr
Roland Dynamics
Like i said, i will try winmerge and see how that goes.