Demo Edit Tutorial: Jumping on a moving truck


Balshor

 

Posted

Seeing how I've never actually made a CoH movie, I thought I'd start getting my feet wet by demo-editing together some action shots. Since I'm basically teaching myself as I go along, I also thought that I'd share the process with you all, in the hopes that you find something educational or at least interesting in my fiddling-around.

My first action shot is pretty simple: a hero, running beside a moving truck, takes a leap and lands on top. The demo will last about 5 seconds.

Here's what you need to follow along:
<ul type="square">[*]A copy of my demo editor. There's a new version up (0.8.14) that corrects a bug in one of the wizards that we'll be using later on, so grab a new copy even if you already have it. Note that you need to have Java 1.6 or higher installed to use it. (If you don't have it, you can get Java from www.java.com.) [*]A basic understanding of demos. The goal here is to talk about how to put the pieces of a demo together, not what each individual line in the demo does. So, I'm going to assume that you understand how to read POS coordinates, what CAM refers to, and what a MOV command does. If you don't know how to read a demo, I recommend reading one of the guides stickied in this forum.[*]Knowing how to use the following commands in-game: /loc, /demorecord, and /demostop.[*]A calculator (or not, if you're confident of your arithmetic prowess)[*]Something to take notes on.[/list]If you want to follow along exactly, you can get the various demos I recorded (including the final demo, truckjump1.cohdemo) here.

That's it. The instructions for making that begin in the next post....


 

Posted

So, the first thing we need to do is gather the information we need in order to write this demo. It consists of the following:
<ul type="square">[*] A truck driving down a street[*] A hero running alongside the truck[*] The hero jumping up onto the truck[/list]So, we need to figure out the NPC model for a truck, a good straight stretch of road, and the MOV commands for a hero running and jumping. We'll also need a costume for the hero, but that will come automatically with the rest of the stuff.

Run around Atlas Park until you see a truck driving around. Take a quick demo:
<font class="small">Code:[/color]<hr /><pre>/demorecord truck1
/demostop</pre><hr />
We'll read the NPC info out of this in a bit. (This is truck1.cohdemo from the link in the first post).

Next, running and jumping MOVs. Start a demo, run a bit, then jump (preferably fairly high, but it doesn't really matter).
<font class="small">Code:[/color]<hr /><pre>/demorecord runjump
(( run and jump a bit ))
/demostop
</pre><hr />
I actually forgot to get the running MOVs when I did this, so I had two demos: jump.cohdemo and rundemo.cohdemo.

We'll need another piece of information that's a little trickier: we need to know how tall that truck is. The easiest way to do this is to find a parked truck somewhere and jump on it. (There's one in a parking lot in the NE corner of Atlas Park.) Use /loc to get your coordinates at the top and at the bottom. Remember that CoH coordinates are ( EastWest, UpDown, NorthSouth ). So, take the difference in the middle coordinates at the top and bottom, and that's the height of the truck (11.7).

Now let's find a good place for our scene to take place. I used a section of the road that runs over the lake in Atlas Park, but anywhere will do. We'll get a few more locations by standing in the road and using /loc again. We need:
<ul type="square">[*] Where the truck starts[*] Where the truck ends[*] Where the hero starts[/list]I put the truck in the east-most lane of the road, starting at coordinates (1176.8, 41.5, -287.4) and ending at coordinates (1176.8, 41.5, -1134.1). The hero will start at (1228.7, 41.5, -287.4). Note that once I picked the first point, I changed the numbers in the others a bit so everything lines up nice and straight -- this isn't terribly important, but it will make things a little easier later on.

Finally, I'm going to grab a quick demo just to have something to start with. In particular, this will give me a fixed camera so I can deal with the action before figuring out how I want the camera to behave. So, I'm going to stand somewhat near the "finish line", zoom into first person, and face the "start line". Again, we do a quick
<font class="small">Code:[/color]<hr /><pre>/demorecord camera
/demostop</pre><hr />
Again, if you want mine, it's camera.cohdemo at the link in the first post.

That's all the information we need in-game. Now to analyze the demos we took....


 

Posted

The first order of business is to figure out the truck's NPC model and the MOV commands for running and jumping. We'll start with the truck's NPC model.

Load truck1.cohdemo in the editor. We're looking for a particular NPC command, so hit "Add Filter" in the lower right and enter "NPC" (without the quotes) in the command box. Hit okay, and we should have only the NPC lines visible in the center of the window. Scrolling down, there's a "Car_Truck3" at reference 680 that looks promising. (There are a number of different truck models, so feel free to use a different one if you like.)

Next we want the MOV commands for running and jumping. Load up your running/jumping demo. This time, we're looking for the player's MOV commands. Again, we'll create a filter to help. Open the "Add Filter" dialog again and click on the "References" button. Type in your character's name (Balshor, if you're using my demos) to find the correct reference number. Then type "MOV" as the command (again, no quotes) and hit "Add". You should now see a short list of MOV commands for your character.

The names should be fairly self-explanatory. What we want is:

RUNPRE (to make a character run)
C_JUMPPRE (to start a jump)
C_JUMPAPEX (for when you hit the top of a jump)
C_JUMPPOST (for when you land)

Don't ask me what the "C_" prefix is for -- I don't know, and it doesn't really matter. That's all the information we need out of these demos, so feel free to close them. On to the editting!


 

Posted

Open "camera.cohdemo" in the editor. We're going to add two new characters, so we need to find a couple of unused reference numbers. Looking at the list on the left, I picked 100 for the truck and 101 for the jumper...it doesn't really matter, though, as long as you use unused numbers.

The truck is easiest. Start by selecting the first line below the CAM lines and hitting the "Insert Command" button twice -- you should see two "NUL" commands appear. (We could add these almost anywhere, except at the very top, as demos need to begin with Version, Map, and Time commands.) Select the first and, in the "Command Information" box on the right, enter the following:

Time: 1
Reference: 100
Command: NEW
Arguments:
(ie, leave the arguments empty)

Hit "Commit".

Now select the second command and enter the following:

Time: 1
Reference: 100
Command: NPC
Arguments: Car_Truck3

This will create a new truck in the demo.

Add two more lines immediately below (or above...again, it doesn't really matter, as long as it's below the first three lines) and put the following:

T: 1
R: 101
C: NEW
A: Jumper
(Jumper is the name of the hero who's going to jump. Feel free to call him something more creative. If you dare.)

T: 1
R: 101
C: NPC
A: Jumper

Now, there isn't really an NPC model called Jumper -- this is just a placeholder for importing the actual costume we'll be using. Head up to the "Wizards" button and select the "Costume Import/Export Wizard". Both the source and the destination demo will be the current one (camera.cohdemo). We want to export the costume from the player's hero and import it onto the new "Jumper" we just created. The process should be fairly straightforward:
<ul type="square">[*]Pick camera.cohdemo as the source.[*]Scroll down until you see your hero. It's reference 1372 in my demo, and it should have a [P] next to the number to indicate that it's the player. Pick that as the source.[*]Pick the first NEW command. Occasionally, there's more than one, but there shouldn't be for the player character.[*]Pick camera.cohdemo for the destination.[*]Select reference 101.[*]Pick the first (and only) NEW command.[/list]Voila! Your hero's costume has now been copied to "Jumper".

Set-up is complete, now on to movement....


 

Posted

The final demo will last 5 seconds. We'll target 30fps, which works out to one frame about every 33 ms. A quick division shows us that 5 seconds equals about 152 frames. We'll need this to use the interpolation wizards in this section.

The truck is the easiest. Hit the wizards button again and choose the "Interpolation Wizard". Since the truck is travelling in a line, we want linear interpolation. Enter the following information:

Start time: 1
Time per step: 33
Number of steps: 152
Reference: 100
Start POS: 1176.9 41.5 -287.4
End POS: 1176.8 41.5 -1134.1

Unselect the "Create PYR" (we'll deal with PYR later), and hit Finish. You should have a new demo with a list of 152 POS commands in it. Head back to "camera.cohdemo" and use the "Import Commands" button to copy this list into the main demo. Hit "Resort" to put everything in chronological order -- you'll want to do this every time you import new commands.

We now need to add PYR commands. Since the truck is moving straight north, we could do this manually, but I took the easy way out and used another wizard. This time, select "Generate PYR relative to POS", select the demo and the truck, and just use the default settings on the last page of the wizard. This will automatically face the object in the direction that it's moving, which is overkill for something moving in a straight line but very nice when movement is more complicated.

That's it for the truck! You can save the demo and load it in CoH at this point (using either the built-in launcher or whatever you normally use to view demos) and you should have a truck driving towards you down the street.


 

Posted

Now let's add some movement for the Jumper. We'll start by having the jumper just running parallel to the truck, then add in the jump and landing. You can just repeat the entire process from above, or you can switch back over to the list you generated in the last step and use the "offset POS" button to just shift the whole thing over a bit. (The correct offset to use would be [51.9,0,0].) Either way, you should be able to get the hero running next to the truck, starting at (1228.7, 41.5, -287.4) and ending at (1228.7, 41.5, -1134.1).

I decided that my hero would jump at time 1189 and land at time 2971, which is 54 frames later. His maximum height would be 75, which is a little more than 30 feet (75-41.5=33.5) above the road. (These were all just arbitrary decisions on my part.) We need to figure out where the hero starts the jump and where he ends the jump. Add a filter for POS commands for the jumper. (Reference 101, "POS" as the command.) We scroll down the list until we find time 1189, and we find that the jumper is located at (1228.7, 41.5, -487.4). Clear the filters and add one for the truck's POS. Scrolling down the list to time 2971, we find that the truck is located at (1176.8, 41.5, -787.4). Remember that the truck is 11.7 feet tall, so we add 11.7 to the Z (middle) coordinate to get that the jumper lands at (1176.8, 53.2, -787.4).

Open the interpolation wizard again -- this time we want "Parabolic". The start time is 1189, 33 ms per step, and 54 steps total. Enter the start, end, and max height, and hit finish. Again, we should get a new demo with the appropriate POS commands.

Before we import these into the original demo, we need to clear out the jumper's unneeded POS commands. Clear all filters (if you have any) and add the following:

T: 1189-50000
R: 101
C: POS
A:

This will display all POS commands after 1189 (until 50,000, which is way past the end of our demo). Hit "Delete All" to get rid of them. You can now import the jump into this demo, just as we did before. Remember to resort the demo!

The last step is to make the jumper move along with the truck. This is just another straight-line interpolation, starting where the jump ended (1176.8, 53.2, -787.4) and finishing 11.7 feet above where the truck finishes (1176.8, 53.2, -1134.1). We compute the number of steps by subtracting the start time (2971) from the end time (5017) and dividing by the step time (33) to get 62 steps. Use the linear interpolation wizard to make a new demo of POS commands, import them into the first demo, and resort.

Finally, we can either keep the hero facing forward the entire time or use the "Generate PYR relative to POS" wizard to make him face in the direction of travel. I just left him facing north.

Next, we'll add in the MOV commands....


 

Posted

The jumper has four different steps: running, jumping up, falling down, and landed. These correspond to the MOV commands RUNPRE, C_JUMPPRE, C_JUMPAPEX, and C_JUMPPOST. The first, second, and last ones of these are easiest: they go at times 1, 1189, and 2971. Scroll down to the POS command at each of these times (use a filter for reference 101 to make it a bit easier), insert a new command, and edit it to have the appropriate time, reference, command, and argument:

1 101 MOV RUNPRE
1189 101 MOV C_JUMPPRE
2971 101 MOV C_JUMPPOST

To find the apex of the jump, scroll through the list of POS commands for the jumper. (Again, use filters to make your life easier.) We're looking at the middle coordinate to find the largest, which should be about 75 -- this occurs at time 2179.

2179 101 MOV_C_JUMPAPEX

We should now have a demo of the jumper running parallel to the truck and jumping on top of it.

Let's do some slightly fancier camerawork -- we'll position the camera slightly above and to the right of the truck and make it track the jumper. We're going to re-use the truck's POS commands to do this.

Create a filter for the truck's POS commands (Reference 100 and Command POS). Hit "Export Commands" to move these to a new demo. In this new demo, select "Change All" to change the reference to -1 (which is CAM, in my editor). Now use "Translate POS" to offset all of the POS commands at once. We'll use an offset of (-5, 15, -30), which will put the camera 5 feet to the right of the truck, 15 feet in the air, and 30 feet in front of the truck. Head back over to the original demo, delete all the CAM commands (create a filter for CAM commands, then "Delete All"), and import the new CAM commands in. (Don't forget to resort!)

Next, use the "Generate PYR relative to POS" wizard again. This time, we want to make PYR commands for the camera. On the last page of the wizard, change "Orient according to movement path" to "Orient on another reference". Pick our jumper, and make sure both "Use CAM coordinates for yaw" and "Delete existing PYR commands" are selected at the bottom of the window. Hit finish.

There's one final thing to do: we need to move the game's focus to the jumper to make sure that everything is being rendered. Find the "Player" command and change the reference from the hero you used to record the original demo (1372, in my case) to the jumper (101). I moved this command to directly above the NEW command for the jumper -- I'm not sure if it's necessary, but that's where it is in game-created demos.

Now, we watch the demo! In my case, there was a small gap visible underneath the jumper's feet after he landed, probably because I used a slightly different truck model than the one I measured the height of. I corrected this with the "Translate POS" button: filter for the jumper's POS commands (ref 101, cmd POS), hit "Translate POS", offset by (0,0,-10), redo the "Generate PYR relative to POS" to make the camera point at his new location, and he now appears to be standing solidly on the truck. Note that this is a perspective trick, as I moved him closer to the camera instead of down -- this is so I don't have to be exact about how far down I move him.

And that's my first from-scratch demo! If you have any questions about the process or if the explanation is unclear at some point, feel free to ask below. If you want some homework, you should be able to use this process to get a shot of a /dev blaster leaping from a building onto a moving Rikti dropship, planting a time bomb on the top, and jumping away before it explodes....


 

Posted

Nice job Balshor! (Oooo, parabola....)


 

Posted

Found your tutorial very helpful - got a question though as a newb to Demo editing. I can get my edited characters to walk around even in the right PYR witch I found difficult at first but now my new problem is getting the CAM to follow my main chacter and not over shoot or lagg behind. I give both the same start and end POS along with liner time and number. Probably not the place to ask but after two days of using all my free time trying to come up with a solution my head hurts :P help please


 

Posted

Can you post exactly what numbers you're using to generate the POS commands? Alternatively, can you post the demo you're having trouble with? (If you need a quick place to host the demo, you can upload to www.mediafire.com without registering.)


 

Posted

I think I figured it out, once I included PYR in all movement everything seemed to work. I still went ahead and uploaded both the old and new version of my first demo (test of course). Can you say walks on water :P

2 files - 1 works - 1 does not


 

Posted

Yeah, movement needs to have both POS and PYR to work. This is especially true for the camera, since PYR determines which direction you're looking.


 

Posted

Sorry the link in my last post here was broke: here it is again.

New Link