2
\$\begingroup\$

I'm looking to make a multi-player platforming game using UDK. I'm currently doing feasibility research, to make sure I will reasonably be able to do all of the technical things I want to do. The first major hurdle I've come across without being able to find as answer, are one-way platforms.

That is to say, platforms through which a player can jump up, but not fall through (unless they choose to). These are commonly seen in games like Mario, Kirby and Smash Bros.

Does anyone know how such a system would work within UDK? I can think of solutions that might work for single-player, but not multi.

\$\endgroup\$
4
  • \$\begingroup\$ will the levels be static, or dynamic? \$\endgroup\$
    – gardian06
    May 28, 2012 at 4:18
  • \$\begingroup\$ The intention is for the levels to be dynamic, so moving platforms. \$\endgroup\$ May 28, 2012 at 4:25
  • \$\begingroup\$ I think we are using 2 different meanings of dynamic. I meant as in these platforms will not exist in the level until needed/run time created. I sense that you mean movable both are forms of dynamic, and after re-evaluating your problem space I see that the distinction of static, or dynamic is not needed. \$\endgroup\$
    – gardian06
    May 28, 2012 at 12:07
  • \$\begingroup\$ This question is very similar, it's just XNA instead of UDK: gamedev.stackexchange.com/questions/29593/…. \$\endgroup\$ May 28, 2012 at 17:14

3 Answers 3

2
\$\begingroup\$

From what I remember from UnrealScript before 3.x this would be possible but would require a custom player controller/player pawn and/or possibly a a custom Volume.

Basically when the player initiates commandDrop, a trace can be performed to see if the player is on the custom moving entity. If it is, add the player to a non-collision list in the Volume. I believe the Volumes (which can be used as a moving entity) have a collision override. Basically, if an object collides with the volume, check to see if that object is on the non-collision list. If so, ignore the collision. If not, collide as per-usual.

You might be able to avoid the non-collision list entirely though and just call a function in the Volume when you get the reference to it from the Trace in commandDrop.

It has been awhile since I've touched UnrealScript though but from what I do remember, this is very possible.

Another solution would be to use the trace in the commandDrop function of the player controller and find the height/width of the colliding volume. You could then change the players location to just below the volume. For visuals, you'd have to set a maximum height for the Volume though, but if it was small enough, the small player stutter probably wouldn't be noticeable. You could also add a drop effect to make it unnoticeable. Like for example, an effect similar to Captain Falcon's "Falcon Punch" in the Super Smash Bros series.

\$\endgroup\$
3
  • \$\begingroup\$ Can anyone give me any more info on this "non-collision list"? it sounds perfect, but I'm having trouble tracking down what it is actually called. \$\endgroup\$ Jun 6, 2012 at 6:13
  • \$\begingroup\$ The non-collision list I mentioned is actually a variable that you would store in your custom Volume class. When the player initiates commandDrop, the player would be added to the list. This list could then be used in the collision methods to determine whether or not to ignore the collision (as opposed to shutting of collision to the entire volume which would cause all players on it to drop). I don't remember if you can choose to ignore the collisions though, as I haven't touched UScript in ages. \$\endgroup\$
    – user631
    Jun 6, 2012 at 21:35
  • \$\begingroup\$ Okie doke, then the next question becomes: Does anyone know how to selectively ignore collisions per actor? \$\endgroup\$ Jun 6, 2012 at 22:11
1
\$\begingroup\$

If you could give these platforms a physics volume (not sure if this is exactly correct) that can detect the components of the collision vector looking for a positive z component (seeing as positive z is up in UDK by default) then allow that player to pass throw.

On the falling through on commandX you would have to be able to relay a message containing the command (or a bool), and the "player" to the volume, and then basically turn off collision for that player for 1-2 seconds.

I am unsure on absolute implementation of these features.

\$\endgroup\$
2
  • \$\begingroup\$ What I meant by the singleplayer/multiplayer comment was that, it can't be something like "make the platform not a collide with anything under X condition", because that could, for example, make everyone standing on the platform fall through it when somebody else goes to jump up through it \$\endgroup\$ May 28, 2012 at 4:24
  • \$\begingroup\$ I was unclear in my mind on the problem space, but think I understand now. please see edit. for implementation I would suggest going to the UDK forums, and asking in the Programming section to see if this is absolutely feasible. \$\endgroup\$
    – gardian06
    May 28, 2012 at 12:01
1
\$\begingroup\$

The way to implement this in a general sense with a "real physics engine" is to add an OnInitialCollision handler that sets an IgnoreCollision flag on the pair of objects if the player hits the platform from below or the sides.

If the player wants to drop through platforms, set a flag on him and always ignore the platform collisions if the flag is set. You can set the flag so log as the player is pushing down, set it when pushing down and clearing it next frame, or whatever other behavior you want.

I don't know if UDK supports this. I tried to Google some info for you, but came up empty handed. There is a Touch event in UDK, but I couldn't find out if that can be used for collision filtering or not.

You may have to toggle collision layers instead of filtering specific collision pairs. Toggle the player, rather than the platforms, to keep things working in multiplayer. You will need to avoid a few specific level design possibilities with this approach, such as having two platforms close enough together that the player could touch both. That probably isn't something you want anyway, but it's worth being aware of.

\$\endgroup\$
1
  • \$\begingroup\$ It seems that UDK's default behavior is to auto-generate a convex hull, or to let you model a 'collision volume'. By default, it's assumed that no object can enter such a volume, so in short no one-way interpenetration. Since it's a simple math problem (disabling collision handling for distance >0 XOR <0 from such a plane) you'd need a workaround method to gather player position, platform normal and collision point. \$\endgroup\$
    – Darkwings
    May 30, 2012 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .