Game Development Community

Implementing movers in Torque - moving platforms

by Tony Oakden · in Torque Game Engine · 03/22/2005 (8:01 pm) · 21 replies

I'd like to implement moving platforms in my game. Basically I need platforms which move along a path, will push the player out of the way if they touch the player and will carry the player along with them if the player is standing on them. I don't expect this to be particularly easy but it's fairly essential for my game design so I will probably start work on it next week.

Has anyone else attempted this?

I'm thinking of starting with the player class and treating the platform as a special form of player under AI control. Then I'm guessing I'll need a new collision mask for a "mover" class of player which I can detect during the collision code in player. My plan is that if a player collides with a mover I will be able to detect it, get the movement vector for the mover and use some nifty linear algebra to work out the resultant vector for the player based on a coeficient of friction between player and mover. I'm going to assume the mover has infinite mass for a first pass and set up the levels so the player can never get squashed.

This sounds feasible to me but does anyone see any major problems? It would be nice to have a generic solution so I can have platforms moving in any direction and speed and know that the player (or AI) can jump, walk or run about on them whilst they move.

I'm thinking though that I will have to prevent the player from dropping items on the platform as that will get too damn complicated.

regards,

Tony Oakden
Page «Previous 1 2
#1
03/23/2005 (5:40 am)
Topic: Newbie Question - Moving Interiors in Torque?

Specifically the post by Matthew Fairfax - He had a nice video that showed a platform and the Orc jumping on and off of it and flying around, but the video link isn't working for me. Anyway in that thread Matthew Fairfax stated:
Quote:
I am hoping that I can get this solid enough in time for 1.4

So maybe this sort of functionality will be in 1.4, but I wouldn't hold that as a promise.

Also in the thread linked above there are links to another thread where someone got a flying hut working. In either case there wasn't any code posted, so it is possible, but there is no publically available working code.
#2
03/23/2005 (6:47 am)
I couldn't honestly remember if that video was publically released or not Dan, so I didn't answer this thread yesterday, but so you know Tony, he's right: Matt Fairfax has everything that you've talked about already implemented, using .dif's in fact--and it's really nice!
#3
03/23/2005 (7:15 am)
Well, if I needed moving platforms NOW, I'd take the pathShape resource and modify it and the player collision, to allow players to ride platforms.

That way it would be possible to get the platforms to cast real-time shadows on the scenery, something that interiors will not do, unless you have stencil shadows working.

The changes to get the player to ride a platform should be easy, in theory. When the player enters in contact with a run surface, check if it's a platformShape type, and if so, add the platform velocity to the player's final speed, right boefore updating the pos.

I say in theory because I've been getting my feet wet with some collision detection and response quirks in Torque, that are pissing me off lately and makes things not work as planned.
#4
04/15/2005 (5:51 am)
Just wanted to chime in here... ;-)

I need to do this kind of thing too. I want the player to be able to jump onto various "platforms" (that can be moving), open doors, etc., and I was thinking of somehow using moveable Interior pieces. From what I've read in the other threads, it doesn't sound like that's a solution (moving pieces of DIFs around) that anyone is considering, so I'm guessing it's not feasible, or it's too ugly to even consider, etc.

Then I was thinking of having each moving "platform" or door be it's own separate DIF and somehow sticking these "pieces" into another Interior in just the right location (that'd be tedious), and then using the "moving interior" type of solution, but in all the other threads I've found on that subject, I haven't seen any fleshed-out solutions (and links are broken, etc.).

I'd like to keep the platforms/doors/whatever as DIF geometry because they could be lightmapped to match the Interior's lighting theoretically, but then again, when they move, they'll likely leave a shadow where it shouldn't be, or the lighting on the moved piece will look odd in it's new position, etc. On the other hand, using a Shape type of object could be handy too, since they're easy to move around, but then they don't cast shadows either (is there an option to turn on to make shapes cast shadows?), and they won't be lightmapped to match an Interior where they're located (but is there a way to enable vertex lighting for them?).

Anyone else have any thoughts on this subject? It's such a basic feature of an "action-oriented" FPS/RPG that I'm suprised that this is not all worked out yet.

How is this kind of thing handled with Unreal and other engines? My daughter and I have been playing the Harry Potter games, and the Unreal engine they use seems to handle the "moving platforms" issue very well... but it looks like the pieces are just statically lightmapped (to me) but the lighting is carefully adjusted to not be too "dramatic" in areas with moving stuff...

Thanks,

Ed
#5
04/15/2005 (7:39 am)
DIF's inside DIF's can lead to zoning nightmares.
#6
04/15/2005 (7:52 am)
If it were me, I would just make an AI controlled vehicle look like a platform, that the player can mount but not control, have the vehicle travel a path and then unmount the player at his destination.

Don't know nothin about doors though :(
#7
04/15/2005 (8:12 am)
You could also just derive something from SceneObject (or use Melv's fxRenderObject to get started), that has a pointer to a TSShape, and just manually take care of the object transforms every tick..

You'd get more possibilities shape wise, none of the zoning problems, and tweakable realtime shadows
#8
04/15/2005 (8:48 am)
Hey thats a pretty cool idea too, I just worry about adding extra overhead to handle something like an object transform every tick, I don't know about you but my poor code base is already feeling a little bloated *burp!* excuse me :)
#9
04/15/2005 (10:27 am)
Guys, this is already written, and awaiting final polish before release into TGE 1.4. Matt Fairfax has even shown a movie of it.
#10
04/15/2005 (10:31 am)
What is it that is already written? A way to do doors, platforms, elevators, etc.?
#11
04/15/2005 (10:36 am)
Maybe I should look a little closer at my 1.4 source. I've been avoiding it so far since I didn't want to fold in my 1.3 changes until it was complete and the structure somewhat solidified.
#12
04/15/2005 (10:49 am)
By the way, is there a thread to watch for info about the upcoming TGE 1.4 release?
#13
04/15/2005 (12:33 pm)
Along the same lines, what kinds of things are you guys doing for animation with players actually jumping onto platforms, etc.? For example, if I run my character at a platform that is moving, and jump, then I come up a little short and want to have the character "climb up" onto the platform... could this be accomplished with some scripting that goes something like:

If a player collision occurs with the platform, then switch to an animation (players does a "hand grab at waist level with a leg-up" sort of thing), and somehow computer where the player needs to be raised to be "on top" of the collided surface.

I think the "collided surface" part would be tricky... is there anyway to determine the placement of say, the top surface of the platform (or the arbitrary plane of a DIF, etc.)?

I was thinking that one might cheat by putting an entity or marker or something on surfaces where a player might need to jump on, and then using that as a reference for where to reposition the player during the "leg-up" animation. But that might potentially require a lot of extra level-editing, and I'm not even sure if you can use map "entities" in this way...

Any thoughts?

Thanks,

Ed
#14
04/15/2005 (12:52 pm)
I posted my solution for a platformer I was playing with a while back. Basically, I created invisible objects (DTS) that I would put at edges to allow players to "climb up" onto things when triggered. Doing it this way, I had to make sure that my climbing animation and my "move the player to the right place" scripts were working in tandem and consistent among a variety of heights. To do this, I simply had two heights and determined it by whether the player had to jump to activate the trigger (versus just climbing). It was an extremely simple solution to a complex problem. It worked well in the context of what I was doing, but I also wasn't trying to remake Prince of Persia's collision system. I did this with static objects (like grabbing a ledge in Tomb Radier), so I'm not sure how applicable it would be to do to a moving platform.
#15
04/22/2005 (10:54 am)
@Stephen: I'm still not sure what it is that you're saying is already implemented in TGE 1.4...? It's sound very positive... but I don't want to wait around for the wrong thing... ;-)

@David: That's sounds very workable. Care to elaborate? Did you have to use the World Editor to add area triggers everywhere the player would potentially be landing and need some "climb up" help? How did you implement the "move the player to the right place"... just give the player an "impulse" to bump him up while the "climb up" anim was playing?

Thanks!

Ed
#16
04/22/2005 (10:56 am)
@David: Where did you post the solution?
#17
04/22/2005 (11:02 am)
Also, the original problem post was about "moving" platforms that the player could jump onto and "ride" on. Maybe that was what Stephen was referring to when he said "it's already done in 1.4"...

I'm still trying to figure out what the best way would be to actually handle the "moving platforms" themselves (DTS or DIF, how to solve the lighting issues, etc.). For example, if I want the player to push a button on the wall, and then have a slab slip out from a wall of that's part of a DIF, and then the player can jump up on it to access some area they couldn't jump to before...
#18
05/02/2005 (5:19 pm)
Hello, sorry for my bad English...
It is possible to use doors and ascenceurs with torque,
but also of the round shapes with 16 faces with quark.
After having to use 3DGS during 2ans, I work now with torque on a play which uses doors, but also of other objects and images animated. It is possible to much better do with Torque.
I would post soon examples.
Torque is a good engine!
#19
05/02/2005 (6:29 pm)
Hi Verhoeven,

I'm anxious to see your technique!

Thanks,

Ed
#20
05/03/2005 (5:52 am)
Http://www.garagegames.com/mg/forums/result.thread.php?qt=29646
Page «Previous 1 2