Platforms Players can Ride Version 1.1
by Cinder Games · in Torque Game Engine · 01/27/2007 (4:34 pm) · 268 replies
Platforms Players can Ride Version 1.2!!!!!!
with Dynamic object Attachment
###################################
##This post has been edited and updated 2/13/07 ##
##################################

Here's the new and improved files you'd need.
Version 1.2
subvoicestudios.com/~ramensama/torque1.5.2.zip
1.7.2008
What's new? There are several new features and improvements.
1) Removed or reduced jitter caused by multiple players on a platform
2) Support for new items on platforms. Now Items, Shapes, lights, particle emitters, and possibly others!
3) Object to object Attachment. Players can now attach Items, shapes, etc to them. Even the attached objects can attach more objects to themselves!
4) Reduced the number of code changes.... a little.
This must be extracted in the base torque directory where it's installed...
c:/torque
or whatever. it's designed to simply overwrite a stock install of torque.
Afterwards you must add pathshape.cc and pathshape.h to your project in visual studio or whatever.

To attach an object, you must use this syntax:
ParentObject.attachChild(ChildObject);
So if you want to attach an item to the player, move the player towards the object, press F11 to get the object ID. Press ~ and type in $player.attachchild(ObjectID);
The item is now attached to the player.
$player.detachchild(ObjectID); is how to remove the object.
Ancient Versions of the code can be found here.
These are version 1.1, not the newest version and probably have bugs that the newer code does not.
Here's a link to the new updated code. It's for torque 1.4...
subvoicestudios.com/~ramensama/torque.zip
And for Torque 1.5
subvoicestudios.com/~ramensama/torque1.5.zip
with Dynamic object Attachment
###################################
##This post has been edited and updated 2/13/07 ##
##################################

Here's the new and improved files you'd need.
Version 1.2
subvoicestudios.com/~ramensama/torque1.5.2.zip
1.7.2008
What's new? There are several new features and improvements.
1) Removed or reduced jitter caused by multiple players on a platform
2) Support for new items on platforms. Now Items, Shapes, lights, particle emitters, and possibly others!
3) Object to object Attachment. Players can now attach Items, shapes, etc to them. Even the attached objects can attach more objects to themselves!
4) Reduced the number of code changes.... a little.
This must be extracted in the base torque directory where it's installed...
c:/torque
or whatever. it's designed to simply overwrite a stock install of torque.
Afterwards you must add pathshape.cc and pathshape.h to your project in visual studio or whatever.

To attach an object, you must use this syntax:
ParentObject.attachChild(ChildObject);
So if you want to attach an item to the player, move the player towards the object, press F11 to get the object ID. Press ~ and type in $player.attachchild(ObjectID);
The item is now attached to the player.
$player.detachchild(ObjectID); is how to remove the object.
Ancient Versions of the code can be found here.
These are version 1.1, not the newest version and probably have bugs that the newer code does not.
Here's a link to the new updated code. It's for torque 1.4...
subvoicestudios.com/~ramensama/torque.zip
And for Torque 1.5
subvoicestudios.com/~ramensama/torque1.5.zip
#122
11/10/2007 (10:43 am)
Any suggestions?
#123
Once you get your schedules working you can schedule any type of delayed event you want.
11/10/2007 (5:17 pm)
I think you're using schedule wrong. Try:schedule(1000, %obj, "setState(\"forward\")"); // or %obj.schedule(1000, "setState(\"forward\")");When your current schedule runs (which is iffy due to the command not being in quotes) %obj will be an invalid variable.
Once you get your schedules working you can schedule any type of delayed event you want.
#124
%obj.schedule(5000, "setState(\"forward\")");
%obj.schedule(5000, "followpath(%obj.Path)");
The shape doesnt move but it I do this:
%obj.schedule(5000, "followpath(%obj.Path)");
%obj.followpath(%obj.Path);
The shape will move to the next point every time I collide with it. I am not entirely sure how to keep it going when you collide with it after 5 seconds.
Any ideas?
11/10/2007 (5:47 pm)
Thanks Brian. It seems that when I do this:%obj.schedule(5000, "setState(\"forward\")");
%obj.schedule(5000, "followpath(%obj.Path)");
The shape doesnt move but it I do this:
%obj.schedule(5000, "followpath(%obj.Path)");
%obj.followpath(%obj.Path);
The shape will move to the next point every time I collide with it. I am not entirely sure how to keep it going when you collide with it after 5 seconds.
Any ideas?
#125
So if I understand you, you want to collide with the object, then wait 5 seconds before moving? Besides annoying the player (5 seconds is a bit long except in certain circumstances) you need to add the schedule event into the collision code. In the original instruction where you call setState you instead call the schedule command.
The shape SHOULD keep going but incase it isnt try calling followPath like this: %obj.followPath(%path, -1);
11/10/2007 (11:18 pm)
Well you certainly don't want to schedule your follow path call. Tell the object which path to follow and then tell it when to start moving forward.So if I understand you, you want to collide with the object, then wait 5 seconds before moving? Besides annoying the player (5 seconds is a bit long except in certain circumstances) you need to add the schedule event into the collision code. In the original instruction where you call setState you instead call the schedule command.
The shape SHOULD keep going but incase it isnt try calling followPath like this: %obj.followPath(%path, -1);
#126
Any suggestions on what would improve what there is now? My new routines will be improved to support greater flexibility on where the player can attach. I'm going to try a per poly attachment, if that don't work i'll try mounting to the closest nodes.
I am hoping to be able to get some stuff like arrows that "stick" in the players... should be fun. But that's for starters.
01/04/2008 (3:14 pm)
Ok guys, i'm going to focus this weekend on expanding this "resource" I think i've enough time to do some way cool stuff with it.Any suggestions on what would improve what there is now? My new routines will be improved to support greater flexibility on where the player can attach. I'm going to try a per poly attachment, if that don't work i'll try mounting to the closest nodes.
I am hoping to be able to get some stuff like arrows that "stick" in the players... should be fun. But that's for starters.
#127
My wishlist is on different tracks but FWIW:
1) integrated collision so that players can respond sensibly when platforms hit them
2) platforms that can tilt/rotate in any dimension without causing cam jitter (has been a prob for me anyway)
3) uhh that's it I guess
01/04/2008 (8:42 pm)
Awesome! Can't wait to see where you take it Ramen-sama.My wishlist is on different tracks but FWIW:
1) integrated collision so that players can respond sensibly when platforms hit them
2) platforms that can tilt/rotate in any dimension without causing cam jitter (has been a prob for me anyway)
3) uhh that's it I guess
#128
If I ever get time I'd like to post the changes I made to get object attachment working well for me.
01/05/2008 (6:14 am)
I got all the jitters out for my test case but it was a major overhaul.If I ever get time I'd like to post the changes I made to get object attachment working well for me.
#129
eg. When a player is viewing another player riding a platform. The player which isn't locally controlled appeared to jitter.
Gabriel
01/05/2008 (7:05 am)
I believe there was some mention of jitter on secondary clients. eg. When a player is viewing another player riding a platform. The player which isn't locally controlled appeared to jitter.
Gabriel
#130
I cured most of it by adding "setMaskBits(PositionMask);" at the very end of processTick for pathShape. Still a problem if the pathshape rolls or pitches, but I'm good on yaw now, which is good enough.
Brian if you ever get the chance to post your work I'll certainly be interested.
01/05/2008 (8:41 am)
Yeah, my jitter is a peculiar case too. I'm playing single player, in 3rd person, and mounting a pathshape to an animating object. When the object animated (moving the mount node, platform & player) I was getting freaky jitter.I cured most of it by adding "setMaskBits(PositionMask);" at the very end of processTick for pathShape. Still a problem if the pathshape rolls or pitches, but I'm good on yaw now, which is good enough.
Brian if you ever get the chance to post your work I'll certainly be interested.
#131
01/05/2008 (11:55 pm)
OK, after hours upon hours of failiures, i seem to be making progress. I got a player, an AI Player, an item, and a static shape riding the platform with apparently no jitters. I'm a little worried about the AI Player, though his position doesn't jitter, it seems liek the animation is sorta choppy with him. Is that normal?
#132
Particularly, IIRC the player's state delta gets out of sync with the transform updates.
Also, I had to rework things so that each object updates itself based on its parent rather than each object updating all of its children. I found this made more sense (to me).
Here is an outline of my interpolateTick for my Player class and how it works:
The parent call to interpolateTick calls this method:
I also implemented in GameBase a new method that acts as the entry to processTick. I needed to add some code before every processTick call but I also need to maintain backwards compatability. To do this I made a new method named gbProcessTick that is called by GameProcess instead of processTick directly. Here is what that does:
Those two bits of code are the key pieces to getting everything working right (at least for me).
01/06/2008 (1:43 am)
There were problems with the way transforms were being summed in the original resource (obtainable above). In particular for players. It probably affects the AI players as well.Particularly, IIRC the player's state delta gets out of sync with the transform updates.
Also, I had to rework things so that each object updates itself based on its parent rather than each object updating all of its children. I found this made more sense (to me).
Here is an outline of my interpolateTick for my Player class and how it works:
void Player::interpolateTick(F32 dt)
{
if (mControlObject)
mControlObject->interpolateTick(dt);
// Client side interpolation
Parent::interpolateTick(dt);
if(dt != 0.0f)
{
Point3F pos = delta.posVec * dt;
Point3F rot = delta.rotVec * dt;
[b]// If we are parented, the parent call will update our render position
// based on our parent, all we need to do is add our own delta to this[/b]
if (bool(getParent())) {
pos += getRenderPosition();
Point3F vec;
getRenderTransform().getColumn(1, &vec);
rot.z += -mAtan(-vec.x, vec.y);
} else {
pos += delta.pos;
rot += delta.rot;
}
mHead = delta.head + delta.headVec * dt;
setRenderPosition(pos,rot,dt);
...
}
else
{
mHead = delta.head;
setRenderPosition(delta.pos, delta.rot, 0);
}
...
}The parent call to interpolateTick calls this method:
void GameBase::interpolateTick(F32 delta)
{
mLastDelta = delta;
updateParentedRender();
}I also implemented in GameBase a new method that acts as the entry to processTick. I needed to add some code before every processTick call but I also need to maintain backwards compatability. To do this I made a new method named gbProcessTick that is called by GameProcess instead of processTick directly. Here is what that does:
void GameBase::gbProcessTick(const Move* move)
{
const Move *movePtr = move;
mLastDelta = 0;
updateParentedTransform();
// Game Base provides the method 'preprocessMove' but it never
// gets used. I don't know what is was ever for, but if you've got a use...
// Uncomment this to add it in...
// Move myMove = (movePtr) ? *movePtr : NullMove;
// preprocessMove(&myMove);
// movePtr = &myMove;
processTick(movePtr);
mLastXform = getTransform();
}Those two bits of code are the key pieces to getting everything working right (at least for me).
#133
@Ramen, I don't have any insight re AI anims, but it's great to hear about your progress
Us non-coders would be sunk without the likes of you two
01/06/2008 (7:27 pm)
@Brian, thanks for the code, look fwd to trying it out@Ramen, I don't have any insight re AI anims, but it's great to hear about your progress
Us non-coders would be sunk without the likes of you two
#134
www.garagegames.com/blogs/11127/14110
Blog with my most recent activity there with a nifty video.
01/06/2008 (7:30 pm)
I'm going to try to have a new codebase ready tonight. I've redone quite a bit, there's an issue with item rotation i don't think i understand, so i'll release it as it is and maybe someone can figure it out.www.garagegames.com/blogs/11127/14110
Blog with my most recent activity there with a nifty video.
#135
I've added a new zip file with 1.5.2 files. This version number is now 1.2. Not sure if i should have just created a new thread so questions about different versions don't start to conflict. For now, this will work. Please try it out and let me know what bugs are found.
01/06/2008 (10:58 pm)
NEW CODE ADDED TO TOP OF PAGE!!!!!!!!!!!!!!!!I've added a new zip file with 1.5.2 files. This version number is now 1.2. Not sure if i should have just created a new thread so questions about different versions don't start to conflict. For now, this will work. Please try it out and let me know what bugs are found.
#136
01/09/2008 (12:02 am)
Updated the Zip. i accidentally included my version of shapebase.cc in that zip. no file changes to shapebase.cc are required for this resource, so if you already downloaded it... you can redownload it, or make sure you don'nt overwrite your original file. If you already did, you can just remove the last two functions at the very end of the file.
#137
But.... it seems to have broken the player actually riding the platform.
See a 2 mb wmv video here
01/10/2008 (12:42 pm)
Ok. Got this to compile without error. :)But.... it seems to have broken the player actually riding the platform.
See a 2 mb wmv video here
#140
01/15/2008 (5:25 pm)
No other comments? :p
Torque Owner Adam Beer
Ignition Games
How would I do this?
Thanks.