Game Development Community

Got moving platform working..sort of. Need help!

by Mark Harmon · in Torque Game Engine · 11/08/2003 (10:10 am) · 50 replies

I took the code from HEAD and started messing with it to get elevators, moving platform and doors working using the pathedInterior class. I've got the exporting and importing fine and I can make the pathedInterior move along the waypoints.

My current test dif has a platform that moves along a path shaped like a triangle with three waypoints. I did this to test horizontal, vertical and diagonal movement.

. wp2
         
         
     wp0 .     . wp1

The problem I am having is that the player won't move smoothly with the platform . The player will sometimes move smoothly while moving horizontally.
#21
11/19/2003 (8:42 am)
Mark -- I'm just curious, a while ago I saw a post from someone who was trying to make a moving oceangoing ship in torque, which players could walk around on. Would your pathedInterior modifications work for this? Can the interior object potentially rotate about its own axis or would that cause problems? (i.e. tip back and forth while moving toward a waypoint?)

Thanks for the great work!!
#22
11/19/2003 (1:35 pm)
Chris: I haven't tested anything like that. I guess if the ship's path was predefined it would work.
#23
11/25/2003 (4:42 pm)
Hey Mark -- What is the status of your doors/platforms? I've finally got
mine working and was thinking about making a resource until I found this
thread. I haven't tracked changes or anything so I would have to
recreate it off of a fresh copy of head. In other words, if you are
further along the creation process, I'd gladly defer to you...
#24
11/25/2003 (6:07 pm)
Maybe you could both release a resource?

Please, someone?
#25
11/25/2003 (11:14 pm)
I'm fixing bugs. Need to add sound and get rotation supported.
I am also waiting for Tim Gift to get back to me on some potential problems in HEAD. I was going to submit this to be put in CVS after that is resolved.

Aside from fixing bugs I am also adding a couple of new entities to the map2dif exporter and changing some others. Working on switches, ai nodes and fixed up the path node exporting.
#26
11/26/2003 (4:56 am)
Great!

Im looking extremely forward to it, and i bet alot of others are too!
How much longer do you think it will be?
#27
11/26/2003 (7:52 pm)
I'm waiting for HEAD to be fixed. I submitted a patch. No word back from Garage Games yet. The VC7 project files are a little messed up.

A resource would be way to huge as there are over 500 lines of instructions to make the changes. I stopped updating my text file that I was keeping to make a resource. I decided to make a patch and try to get the code put into HEAD. We will see what happens.
#28
11/27/2003 (4:55 pm)
I guess thats a better option, and should really be in HEAD anyway.
Thanks for working on it too, im sure alot of people appreciate it!

How exactly have you got them working?
As in, how would they be put in to the game, is it all based in difs, how did you implement them, are there any extra steps to take in implementing platforms/doors?
What sort of doors are working?
Do they rotate?

*shines light into Marks eyes*
#29
11/28/2003 (9:18 am)
I've got them working through the PathedInterior class. They are usable as doors, elevators, trains, traps...
The rotation issues are being worked out right now, so when I am done they will be able to rotate. The sounds are configurable through the PathedInterior's datablock. You can specify starting, moving and stopping sounds.

I use Hammer to model interiors. I fixed up the map2dif exporter to support entities needed for path followers, paths and triggers.

PathedInterior is an entity you use to create the object that is going to move. It has some properties that let you assign triggers, paths, and a datablock.

InteriorTrigger is used to create triggers for the PathedInterior. It has a datablock, an enter_node and an exit_node. These let you assign target path positions for entering and exiting the trigger area. There are also special values which enable toggling for elevators.

PathNode entities are used to create the path the interior follows. The path nodes can be chained to together to form a sequence. The position of the first path node is used as the centroid of the PathedInterior entity. The nodes also can specify smoothing type and the number of milliseconds it takes to get to the next node. To make a standard rotating door you would have two path nodes in the same position, each rotated differently.

After I fix the rotation, I am going to add another entity that will allow usable switches (like a door switch located in different room). This will include me adding animated textures to interiors.
#30
11/28/2003 (6:04 pm)
*cheers*

Thanks, thats exactly what i wanted to hear!
*dribbles*

But seriously, what you just described allows for some pretty cool stuff to be done, and not just door/elev/movingplats.

Im guessing the interiorTrigger will be what you could use as a base for switches and such.
The rotation, could that be done with start/stop nodes?
Maybe fixed degree of rotation? (im not at all aware of what the issues are, but hey)

The other thing, can you have a moving platform ontop of another?
Or what about assigning, say rotation and pathed to a brush, so that it can rotate and move towards something (like player, think pendulums)

Animated textures would be damned good.
As well as water, which could go well with the animated textures.
Breakable walls? Could you do that?
Breakable and hideable, hiding might be like forcefields i guess.
Particle nodes perhaps.
Umm.. env maps are already in arnt they?

Alright, thats about the only other interior/entity functions i can think of, most of its been done with the quake engines, and Quake2 has some good examples about, maybe have a poke through its entitys(entrails) and a squiz at the source wouldnt hurt either i guess, good learning tool (just dont get us into an SCO vs IBM case).

*grins* That made my day, thanks Mark!
#31
11/28/2003 (7:21 pm)
Hey Mark,
I did an update on badguy's rotational doors to generalize them for a rotated parent. Lemme know if it could be of any help.

-Pascal
#32
11/29/2003 (1:16 pm)
Pascal: Thanks for the offer, see below.

Anyone: I have made some changes to the PathedInterior exporting/importing. In HEAD, the PathedInterior's surfaces are exported like other surfaces in the interior. The brushes are made so that their center is 0,0,0 in the level editor. That way each surface doesn't need a transform. That's a problem for the PathedInterior object due to the fact that it should be treated as a shape that has it's own transform. The PathedInterior needs a centroid relative to itself, not the rest of the interior.

I made many changes to the code so that if the PathedInterior has a path, the first waypoint is made to be the PathedInterior's center. This works fine and removes the need for an ORIGIN texture brush. I parse all path_nodes prior to parsing other entities. Then when I parse the PathedInterior I attatch the waypoints before I parse it's structural brushes. That way I can pass an offset to the parseBrush function. The problem is that I don't know the math to adjust the textures. The texture UVs are based on the position of the surface. There is a plane equation involved. I don't know how to take my Point3F offset and apply to the texture.
#33
11/29/2003 (1:19 pm)
.....
#34
11/29/2003 (2:45 pm)
I'll ask Why remove the Origin feature?
I can see complexities from creating complex doors without it.

imagine multi plane rotation and transform.
#35
11/29/2003 (3:17 pm)
Can you give me an example? It's simple to modify the code to use the origin brush if it's there. I just don't see any reason for it. I could be wrong.

I guess I should have mentioned that I added a pitch, yaw and roll attribute to the path node entity. It makes it possible to rotate nodes. So to make a door rotate just put a few nodes in the same position with different angles. The center of rotation is the first node. So if the node is place at the edge of the door it will rotate on that edge. Likewise if the node is 5 meters away from the door, the door will rotate in an arc around that point.
#36
11/30/2003 (12:30 am)
Ok I figured out the problem with the textures. I had to brush up on my math a little. It was also a great help trying to explain the problem to my wife using the top of our espresso maker as (0,0,0) and a piece of paper to represent a plane. Well, that and 3dsmax to further help me visualize the problem.
#37
12/14/2003 (2:16 pm)
Mark: Is there any chance of getting a hold of your code as our team could really do with the moving platform stuff you've implemented.
#38
12/14/2003 (3:23 pm)
I am still working out a few lingering bugs. I also have to add a Quark for Torque data file. Then I will zip it all up and add it as a resource.

Excpect something within a week or so.
#39
12/14/2003 (5:57 pm)
Cool, I'll watch this space for a report =)
#40
12/21/2003 (5:40 pm)
Ok, progress?

Should probably submit it to HEAD as a patch.