Game Development Community

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 ##
##################################

subvoicestudios.com/~ramensama/TorqueDynamicAttachment.jpg

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.

img292.imageshack.us/img292/9507/addexistingxy9.gif

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
#241
06/23/2008 (10:12 am)
Umm, yeah that's the idea. I've changed the the code so that the ray cast now can detect an AIPlayer instead of a PathShape. And BTW, if the "if" clause is faulty, then it wouldn't even print out the " error("i'm on a Platform! ID:" SPC %col); " line, right? But in my case, the error is shown to the console yet the player can't attach. And AFAIK, attachChild is a method in the SceneObject class so AIPlayer should've been able to attach a child also because it is derived from it. So I think there's another factor, which is currently unknown to me, that make the attachChild method failed to do its job. BTW forgot to mention that it didn't always happen. Most of the times the player can attach to a platform, but on a few occasions it couldn't.
#242
06/23/2008 (11:45 am)
[uselessComment]If you're trying to attach AIPlayers, why did you say Players? O_o[/uselessComment]
#243
06/23/2008 (6:38 pm)
Well, what I'm trying to say was I want to attach my control object (which class is Player) to a moving platform (which is an AIPlayer). It worked occasionally but some of the times it didn't (dunno why). The reason I use AIPlayer as the platform instead of PathShape is because I also needed the physics (FYI, the platform is floating above a waterblock so I need to simulate the platform's movement along with the wave from the waterblock to make it realistic). So instead of copying the whole block of physics code to PathShape, why not change the this one instead? Hope that will make it clear for you. :D
#244
08/27/2008 (1:44 pm)
Just to let you guys know, we ported this to TGEA 1.7 and it works well, there is a slight jerkiness when inside the monorail, but I don't think its the resource being ported over to TGEA, I think it's something to do with the camera when looking at the player and it's slightly outside of the monorail and so it flickers a bit while it's moving.
#245
08/27/2008 (3:15 pm)
Does this mean we will see that monorail content pack coming soon? Do you have the old working TGE code that can be put up or is the difference minimal?
#246
08/28/2008 (4:42 am)
Hi Edward .. maybe :) depends on game sales and how many content art packs we would sell to justify game originality, or a publishing deal stopping us from selling it as a pack. But if we did sell it as a pack, we'll make sure that everyone who has been involved in it, whether it be based on an original resource/artist/programmer is mentioned for their involvement in the project and what modifications/code changes are required to get the pack to work. I'll be contacting game publishers soon, just to see what kind of deal we can get on the table before making any decissions on the pack. On the code.. there were quite a few modifications/enhancements based on this resource to get it to work in TGEA as it was a totaly re-write from TGE, but exactly what they were I don't know, without checking with my programmer on that who is under an NDA. The monorail car had quite a few variants before we could make the collision detection on the model air-tight so you did not fall out of the sides/front, and we're solving the animated door issue by using a switching mechanism by placing two clear dts blocks with collision that are mounted and rotate to prevent a player from falling out of the animated doors, as I don't think we can use polysoup for that as it's a different class?
#247
09/23/2008 (9:38 am)
Today i excluded Ramen's code and the error occured again.
Turned out that my integration on TGEA 1.0.3 is working stable, the problem was caused by an error of my modification over the player class.
I need to apologize to Ramen, my fault.
#248
01/27/2009 (11:17 am)
Hi,
I have added this resource into my 1.5.2 version of Torque. I took the
1.5.2 zip file from the top. All was compiling without an error. I put
a pathshape into my level and was trying to move the player on the shape.
Nothing happens when I jump with may player on the shape. In the console
i got the message :

A collsion with a loopingshape has occurred
/server/scripts/pathshape.cs (31): Unknown command getState.

What I am making wrong, can please anybody help me...

#249
01/27/2009 (11:22 am)
Looks like it's not compiled properly, try clean and build again. But first check your game.cs file and see if you are executing the pathshape.cs
#250
01/27/2009 (12:22 pm)
I am trying all the day to find out whats wrong.
Pathshape is executed in game.cs , I tried two times a clean build
and I can watch the compiler when he touch the new pathshape.cc file.
All is compiling without any error, I have no idea what to make.
#251
01/27/2009 (12:24 pm)
email me your console log file helpdesk (at) something2play (dot) com, also include your game.cs file there may be a typo in there.
#252
01/27/2009 (3:08 pm)
perhaps you are using a different pathshape file then the one i included?
#253
01/27/2009 (3:10 pm)
Ramen

I couldn't see anything wrong with game.cs or the gamelog.. Michael is using VC6, so not sure if that is the problem.
#254
01/27/2009 (3:17 pm)
I'll try a clean install and see what happens, though, this is probably a localized issue.

Does it work fine with the default stronghold level i included?
#255
01/27/2009 (3:28 pm)
Dunno. working fine here. tested with a clean install.
#256
01/28/2009 (5:29 am)
So I tried your stronghold level, I took the necassary files into my
game and started the mission. It's working with your level !!
So it's not the compilation of my engine, nor the way I am using your
files. But what I am doing wrong in my level ?? I was looking in your
stronhold level, to copy exactly the path you make. No way, the loop
shape isn't moving in my level. All I get in the console is:

A collsion with a loopingshape has occurred
rammelsberg/server/scripts/pathshape.cs (28): Unknown command getState.
Object (3117) StaticShape -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject

Any idea ??
#257
01/28/2009 (6:13 am)
the mistake is when you put the loop shape with the mission editor into the level the
shape gets the name staticShape and not PathShape !!!!!

new Path(PathShapePath1) {
canSaveDynamicFields = "1";
isLooping = "1";

new PathShape() { <========= to change from staticShape to PathShape
canSaveDynamicFields = "1";
position = "0.4688 -178.269 100.406";
rotation = "1 0 0 0";
scale = "5 5 5";
dataBlock = "LoopingShape";
receiveSunLight = "1";
receiveLMLighting = "1";
useAdaptiveSelfIllumination = "0";
useCustomAmbientLighting = "0";
customAmbientSelfIllumination = "0";
customAmbientLighting = "0 0 0 1";
useLightingOcclusion = "1";
speed = "10";
Path = "PathShapePath1";
onGroup = "Default Value";
loopNode = "6";
};

Now it's working well.....
#258
01/28/2009 (6:33 am)
glad to help out :) Good luck with your project Michael
#259
01/28/2009 (9:10 am)
Thank you Julian, nice to know that there is someone who wants to
help in this big world of Torque :)
#260
01/28/2009 (9:16 am)
No problem Michael. I've had help from people on here, and with some time spare between projects, so just returning the favour :) Would be good to see a video or screenshot of your project using this awesome resource.