上QQ阅读APP看书,第一时间看更新
Kismet debugging
If you are using a UDK version from June 2011 onwards, when you are using Kismet to create events and actions to enliven the actors in the scene, you can track the nodes that are being used (or not used) and also check some statistics for how frequently nodes are firing. There is a lengthy chapter on Kismet operations in Chapter 4, Got Your Wires Crossed? This recipe is not a Kismet lesson, just a procedure for enabling the Kismet debugging tool using an existing scene.
Getting ready
Load the scene from the provided content: Packt_01_BreakPoints_START.UDK.
How to do it...
- This map is set to UTGame for its Game Type, so when you Play in Editor (PIE) [ ] you will have a HUD and you can use weapons. The level has a rocket launcher weapon pickup placed near the PlayerStart, and you can shoot it at a platform to allow you to create a set of stairs.
- The Kismet for the scene is contained in a sub-sequence BlockAB. Its functionality is covered in Chapter 4, Got Your Wires Crossed? in the recipe Allowing the player to pick up, carry, and place an object. For now, we just want to get the Breakpoints used to check the Kismet is working.
- First off, press the Enable Kismet Debugging icon [ ], which is located in the top icon row of the main editor next to the PIE icon as shown here:
- Open Kismet [ ], and expand the list in the Sequences window, then click on the Sub-Sequence labeled BlockAB.
- Right-click on the first event in the sequence and choose Set Breakpoint. Repeat this with all the other events in the sequence. Events are easy to spot, since they have a hexagon shape, and red outlines (that turn yellow when selected).
- Use the Search tool, which is the Magnifying glass icon [ ] in the top row of Kismet icons, and set the Search Type to Object. In the Search For list you'll be able to access a roll-down list and choose Destroy. Click Search, and click on the item that is found in the Results panel. Right-click on the action that is focused, and choose Set Breakpoint for this too. You should now have six breakpoints.
- In the editor, press F8. Immediately after the PIE window shows, you'll be paused and shown Kismet again. This is because the first breakpoint is on the Level Loaded event, which fires when the session begins. The icon for breakpoints that have been tripped shows with an arrow over their red dot [ ]. At the top of the Kismet debugging window there is a Play icon (Alt + F8). Press this, and you'll resume playing. And you'll get a pause again to show the Player Spawned event has fired. Again, press Play.
- The next Breakpoint will likely occur after you pick up the rocket launcher and fire a rocket at the platform on the ground. Looking at the Kismet debugger you can see some statistics showing above each involved node, the time it was last activated and the number of times it has activated.
- Rather than pressing Play this time, select the event labeled KActor_2 Take Damage, right-click on the icon on its right-hand side called Run to Next Action. Choose Selected and the game will let you play up till the point when the Trigger involved takes damage from the rocket. The statistics above the node will show for the Take Damage event the current level of damage to the involved Trigger. You may see many nodes stepping through as they fire one after the other. This is where you can track the order or correctness of your Kismet sequence.
- If you are playing and you want to check the Kismet debugger without waiting for a Breakpoint to occur, press Shift + F1. It prevents the cursor being locked to the PIE session. This is useful if you have the debugger open and accidentally set focus on the game again, while it's still paused. That will happen if you jump from one application in Windows to another then back to PIE. You still have to resume playback by pressing the Play icon [ ] in the debugger.
- After this point, pressing Play again from Kismet, you may notice that there is a kind of strange, continual pausing every time you hit Play. This is because one of the events involves a Trigger attached directly to the player, which is triggered by the player continually. So, while the Kismet is showing, look for and select the event Trigger_0 Touch and right-click on it and choose Clear Breakpoint.
- Unless you shoot the platform continually, the next Breakpoint to fire will be when you place the carried platform in the space for it against the wall. The event is called Trigger_3 Touch. It's inside the Check Block Int comment box. Directly after that event, the game should pause and show the debugging window again because the platform is removed immediately from the scene by the Destroy action on which we set a Breakpoint earlier.