|
Understanding and Using Karma Collision in Your Map
Created August 2004
Updated 09-20-04
Karma collision is what happens when a dying player collides with another item, normally a static mesh. This gives a realistic interaction when a player didn't shoot fast enough or play smart enough! : ) This tutorial will discuss different ways to enable an item to block karma.
Enabling Karma
To enable an item that supports Karma collision, open the item's properties and go to the Collision section. Set bCollideActors and bBlockKarma to True. The following items can support Karma collision: Most static meshes from the game, blocking volumes, and collision hulls. Custom static meshes made in a 3D modeling program can support Karma collision if particular boxes are added to the static mesh (this tutorial will not cover adding these boxes to this type of static mesh). Custom static meshes made in the editor can also support karma collision, but it has limitations. Subtracted and Additive brushes block karma by default and changing the values in the Collision section of their properties is not needed.
Static Meshes from the Game
Most of the static meshes that come with the game provide support to block karma. Some of them are enabled by default, some aren't. As mentioned before, set bCollideActors and bBlockKarma to True to enable Karma. To see if that items supports karma, locate the Show floors ? icon, which is a P on the top tool bar. To the right of that on the blank area, right click and select View, then Show Karma Primitives. If you enabled Karma on a static mesh and it supports it, you will see a bright green box around the static mesh. This is the box or boxes that will block the player when they die.
If you enabled Karma and you don't see that box, it doesn't support it. Be sure to disable it or you will get an error message when you build the map. If you forget, a Map Check window will appear listing which static meshes don't support Karma. The list will display which Actor and a Message that reads, bBlockKarma set to true without a KPhysicsProps. To quickly disable Karma, select the static mesh actor in the window and press the Goto Actor button. This will bring you to that static mesh. Change the Karma settings and press the Refresh button in the Map Check window. This should remove that static mesh from this window. If you have many of the exact same static mesh, you can always select one of them, then right click and select Select, then select Matching Static Meshes. This way you can change the Karma settings for all of them at the same time.
Custom Static Meshes Made in the Editor
By default, custom static meshes made in the editor don't have built in Karma boxes. The static mesh browser will allow you to create one box for the entire static mesh (you can't control how big the box is). In some cases, straight walls and columns, this works perfectly. In other cases, stair ways, it doesn't work well. To create this karma box, select the static mesh in your custom static mesh package. First select the Edit menu, then select Create Karma collision from bounding box. Once you do this the smallest box that will cover all of your static mesh will be created.
To see this box, select the View menu, then select Show Karma Primitives. You will see a bright green box surrounding the entire static mesh. Be sure to save your static mesh package to save the changes you just made. In addition, never, ever, ever change anything in a stock or custom static mesh made by another modder. Doing so will cause a version mismatch when you play that map with other players. You still need to enable Karma in the Collision properties of the static mesh in your map. This box just allows Karma to be used.
This is an example when this will work perfectly. This is a column I made (see below) in the editor. The Karma box fits perfectly around the column. I can use the built in Karma box instead of using a Blocking Volume (which will be covered later in the tutorial).

This is an example when this really won't work. This was a stair case I made (see below) in the editor. The Karma box fits around the entire stair case. If you were standing at the bottom of the stairs, outside of the box and died, the player would bounce off the face of the green box, which isn't realistic. If you were on the middle landing, inside of the green box and died, the player would be "floating in mid air" after they died. Again, not very realistic.

Finding a balance with Static Meshes Made in the Editor
With static meshes made in the editor, you are going to have to find the best way to make it and find a balance with the built-in limitations. If the player, more specifically, the computer player can see any part of the static mesh, the engine will render the entire static mesh. If there is a great chance that when the computer player sees a static mesh, they will see most of it, make it as one static mesh. If there is a good chance they the player will see sections of it a time (example: a long wall that goes in different directions), it might be best to make it as separate pieces.
With the above idea in mind, you also have to figure the best way to block karma. In the case of the column I showed, having the built in Karma box worked perfectly. The stair case though, had problems using the same built in Karma box. You can also use collision hulls and blocking volumes to assist in blocking Karma.
Using the stair case as an example, I would build it in the following manner. Since there is a great chance that the player will see most of the stair case at a given time, I will create the entire stair case as 1 static mesh. I would use collision hulls to provide a smooth transition up the inclined stairs and use it to block Karma. I would then create a blocking volume that is the same size as the middle landing. I would set this so it wouldn't block the player or actors, but Karma only. If you set it to block players, there is a good change the player will walk on the blocking volume instead of the static mesh, and no footstep sounds could be heard.
Using Collision Hulls to Block Karma
Collision Hulls are normally used to provide an invisible ramp that will provide a smooth surface to walk on when going up stairs. Click here to learn how to create you own custom Collision Hulls. Then select bCollideActors and bBlockKarma to True in the Collision properties.
Using Blocking Volume to Block Karma
Blocking Volumes can be used to block Karma when a stock static mesh doesn't provide a Karma box. In addition, when a custom static mesh made in the editor can't use the built Karma box, like in our stair case. Click here to learn more about what a blocking volume is. Set the blocking volumes collision properties as follows, bBlockActors and bBlockPlayers to False and bBlockKarma, bCollideActors, m_bBulletsGoThrough, bPawnGoThrough, and m_bSeeThrough to True.
Summary
*It's reasonable to have the big objects in your map block Karma. You don't have to go overboard and have every static mesh block Karma. Not only is this impractical, it can cause fps lag in the game. When ever the engine has to make a Karma calculation it uses some of the computer's resources. Find a balance between having too many things block Karma (thus causing unnecessary fps lag) and having nothing block karma (thus having an unrealistic funereal for the dead player).
*Never create a collision hull or blocking volume in the exact shape of the static mesh. There is a way to easily do this, but there are serious problems that can occur. Complex shaped collision hulls and blocking volumes can cause fps lag (even when Karma is not occurring) and they tend to increase the size of your map file size by great amounts. I had 4 wooden stairs that were similar to the stairs inside the warehouse of Import-Export. I created a collision hull in the same shape and soon realized it was a mistake. Not only did it cause noticeable fps lag, it added 6mb to the map file size. So I deleted them!!!
*You can also enable karma for all static meshes in your map that have built in Karma support. In the Editor, select the Tools menu, the select Karma Tools. A box will appear that will give you two options. Add bBlockKarma to every StaticMesh with Karma primitives will add enable karma for all static meshes that have built in karma support. Remove bBlockKarma from every StaticMesh without Karma primivites will disable karma for any static mesh that does not have built in karma support.
You should have a good understanding of what Karma is and how to make sure it happens in your map, when it needs to happen.
Written by cwv_Odedge
|