Demo File Format FAQ




Demo File Format FAQ

Demo files are remarkably easy to read, yet I still have many questions about them. Consequently, this FAQ file still has much work to be done on it. Still, I believe I can save a lot of future demo editors some time by imparting what I’ve learned dinking around with the .cohdemo files.

Each line of a demo file has the following format: Timing, Object ID, Command, and Data.

Timing is easy, that’s just how much time has passed (in milliseconds?) since the last command. Many will start with 0, particularly at the start of a demo, indicating the command should happen immediately.

Object ID is also easy, it is simply a number the demo uses to identify each object in the demo. Each object is initialized with a NEW command to indicate what it is. Object numbers can be re-used so just because object 35 is a Reaper at the start of your demo doesn’t mean it is at the end of your demo. There is one special object called “CAM” to indicate changes in the camera’s point of view.

Commands and data tell CoH what is actually being done…..


Version – this has always been version 2 as long as I’ve been watching. If this ever changes, watch out. This whole FAQ file could become a waste of bits! I’ve never tried changing this number.

Map – the map that’s being used for the demo. Again, I’ve never fiddled with this. Changing it would probably result in most of the action happening inside walls. Note that using an elevator does not change maps! It just moves you far enough away that the areas you have already explored are off the edge of your map display in the game.

Time – how many hours past midnight the demo starts at. This is pretty irrelevant for indoor missions but you can change this to switch the action from night to day on an outdoor mission. Set it to 18 or 19 for a sunset, for instance.

POS – the object has changed to this new absolute position on the map. Changing it puts the object in a different position. The second number is the Z coordinate. One unit looks to be about one foot.

PYR – (pitch yaw roll) the object has changed orientation. Numbers range from positive to negative pi. The first number describes how much the object is leaning forward/backward, the second describes how the object is turned right/left, and the third describes how the object has tilted (so 0,0,1.5 would put the object on its right side). These are almost always “0,number,0.”

NEW – makes a new object of the given type. These commands are followed by other commands describing the properties of the object. Objects can be anything that isn’t static including MOBs, doors, players, and some lingering spell effects like rains. (Mission objective objects currently do not appear in demos.) For NPCs, the New command gives the NPC’s name.

DEL – destroys the object. The object number can then be re-used.

MOV – what animation the object is currently doing. Not all objects have all animations. For instance, you can’t make a door do a FEAR_A move. If you try to make an object do something for which there is no animation, your demo will give you a message box saying so then continue after you click OK. I believe all objects do have a READY move.

SEQ – I haven’t fiddled with this but I believe some objects (like computers) go through a sequence of animations. This starts that sequence and the game engine takes it from there.

CHAT – Tells who said what. Several system messages are included here, too, like who defeated a MOB and people joining the team. (Object numbers for the latter can be quite huge!) I think the first number after the chat is what channel is being used and the second is whether a player or the game itself made the chat.

Float/floatdmg – little numbers or words above an object. The first number is the object number and the second is a string of what will be there. Float shows specific messages like FloatMiss for a miss and FloatRecharging when you try to use a power that isn’t ready yet. Unfortunately, these don’t appear in demo playback right now. Floatdmg is used to float a number over the character. If you give it a positive number then the game will put a minus on the front and float it up as a red number. If you give it a negative number, it will get rid of the minus sign and float it up as a green number. (Yes, it’s a little backwards, but there it is.)

FX – A power effect is starting! This can be the power getting launched or a target undergoing an effect from the power. The name of the power is easy enough to figure out. The first number is an ID number for the effect but I have no idea what the last number is.
FXSCALE – Always 10 and 10. Making the last number too big makes the power go away but I can’t figure out what the numbers are really supposed to do.
ORIGIN ENT – The first number is the object that will be the origin of the effect. I don’t know what the second number does. If the first number is 0 then the origin is the object itself (which is pretty common).
TARGET ENT – Same as origin but this gives the target’s object number.
FXDESTROY – occurs further down in the demo when a repeating effect ends. Number is the ID number of the effect.

COSTUME – Now we’re having fun! This describes exactly how a character looks in the game. First it describes the basics of a character then it gives each part. The numbers are as follows:
<ul type="square"> [*] The first number on the Costume line is the basic model. 0 is basic male, 1 basic female, and 4 huge male. (I’m guessing 2 and 3 are big male and big female but setting this makes most of the character invisible and gives lots of move animation errors.) Note that many costume options do not exist for all models, meaning that you can not put a bikini on your huge male. (THANK YOU Devs!!!)[*] The second number is the skin color. Colors are done in hexadecimal as BBGGRR so 00ff00 is pure green and white is ffffff.[*] The third is height. 0 is average height and values can range pretty far. –99 makes the character no more than a dot and at +1000 you’ll have to zoom back to see higher than the kneecap. Graphics don’t scale up too well so don’t expect a lot from the huge characters.[*] The fourth is the athletic/muscle scale. –1 is as skinny as possible and 1 is as muscular. If you go outside this range the demo will crash.[/list]
PARTSNAME – next follows a list of several parts names describing the costume the character is wearing. Each line has three strings and two colors. The strings give exactly what costume piece is being used for this part. Early on I tried to collect all these so I could list them off in this FAQ but there are just too many. Here’s the order they come in:
1. Pants
2. Top
3. Head/Face
4. Gloves
5. Boots
6. Belt
7. Hair
8. ?
9. Upper face decoration (glasses, tiaras, and so on)
10. Chest Emblem
11. Shoulder Detail
12. ?
13. ?
14. Lower Face decoration (breathers, beards, veils….)
15. Special robot arms

Costume gets re-saved when the costume changes or the character goes into/out of supergroup mode.

There’s a mission in the game that gives you a Freakshow disguise. This is a power, not a costume change. (It used to be “FX Maintained 3 POWERS/ITEMSANDTEMPPOWERS/FREAKSHOWPARTS.FX 0” but this no longer works and my old demo now just has me running around without the disguise.)

Player - This comes before the NEW statement for the charcter recording the demo.

XLU – I have no clue what this is. These commands started up some time before launch and now no longer appear in demos.

Character Swapping

The thing folks seemed to find the most fun early on was swapping characters. You can alter a demo to, say, put all your alts into one demo then take a screenshot.

To do this, take a character you want to paste from one of your demos. Only copy the COSTUME and PARTSNAME commands and the initial NEW command. It should look something like this:

0 1 NEW Zloth
0 1 COSTUME 4 ffffff 23.945047 0.863297
0 1 PARTSNAME Armored armored_medieval_01 Blend 666600 00663b
0 1 PARTSNAME Armored Armor_Medieval_01 Blend 00007f 008cd4
0 1 PARTSNAME Great_Helm Great_Helm_01 None 00007f 0000d4
0 1 PARTSNAME Armored armored_medieval_01 Blend 006666 006600
0 1 PARTSNAME Big armored_medieval_01 Blend 3d3d00 990002
0 1 PARTSNAME None None None 009957 006666
0 1 PARTSNAME None None None 737373 3d0000
0 1 PARTSNAME None None None 737373 3d0000
0 1 PARTSNAME Wings_01 Wing_01a Wing_01b 3535fd 000055
0 1 PARTSNAME Armored base Scales 990002 990002
0 1 PARTSNAME Spiked spiked_01a spiked_01b 0000d4 000055
0 1 PARTSNAME None None None 737373 3d0000
0 1 PARTSNAME None None None 737373 3d0000
0 1 PARTSNAME None None None 737373 3d0000
0 1 PARTSNAME None None None 737373 3d0000

Now open the demo you want to put this character into and find the New statement for who you want to replace. Select all the costume and partsname commands (but not the NEW command) and paste over them with your character. Change the object number in each line (1 in the example) to the old character’s object number, which will still be up in the NEW command. Finally, erase the old NEW command.

Normally, that’s all there is to it. However, if the character in the demo changes costume or switches to/from supergroup mode, the character will revert.


Cutting out parts of a demo is risky but it can be done. What gets you in trouble is when you miss NEW and DEL commands. For instance, if you cut out part of a demo and half a dozen monsters’ NEW commands along with it, your party may start fighting empty air. So when you do your cuts try to avoid cutting out NEW and DEL commands.

The easiest thing to do is cut off the end of a demo. At the end of a demo everything restarts anyway so you don’t care what commands are getting removed. Hack away!

Cutting out of the middle is harder. If your group is just standing around waiting for somebody who’s away from keyboard, though, you shouldn’t have any NEW or DEL commands. If you need to hack a lot out of the middle, try cutting until just before the main player goes into an elevator. (You can save yourself quite a bit of grief in searching for that point if somebody said something right before the player goes in. Just search for the chat message.)

Cutting out the very start can’t happen because it’s full of NEW statements. However, once those are all done you can cut just like the middle sections. Very handy if you start the demo then end up waiting around for somebody to enter. (Make sure you don’t cut out their entrance, though!)


It’s real easy to change what people say. You can fix spelling errors or, if their chat bubble is blocking out a nice view, get rid of it completely. You can cut out the line completely or, if you want to make sure you don’t mess the timing up, just make the text string empty and no text will appear. The line would look something like this:

22 4026 Chat 8 1 ""

Colors also appear right in the chat text and are easy to change or remove.

It’s also easy to add chat messages in, just follow the format of the other chat messages you see in the demo. This makes it easy to do a tutorial demo without having to pause the action to type in your informative messages. Just do what you want to do while you record then insert the chat info later.

Look! Up in the sky!!

Want to see what you missed at the end of beta? Take a demo in Atlas and replace the blimp with:

0 3248 NEW "Rikti Destroyer"
0 3248 NPC Rikti_Destroyer
(position data)

correcting the object number, of course.



I'm just describing the .cohdemo file format here. For info on how to make/play demos in the first place, see my Screenshot &amp; Demo FAQ.



It turns out the Freakshow disguise mission is just plain broken right now - the power fails to make you look Freaked even in the game. Hopefully the power effect I listed above will start working again when the bug is fixed.



You may also find this imformative :
Demofile Archive

Note that not all the names of the FX are correct. The names are extracted with a script, and named by their corresponding FX file. Cetain things may be difficult to find unless you know what you're looking for. Example : the FX for Lightning Field is named CHAINLIGHTNING2.

As for the above-mentioned MOV files, yes, every object has a READY movement.
Unfortunatly, nothing else has the ability to emote anything other than a threat, wave fist, or cheer, so you cant get a row of fire monkeys doing jumping jacks. Believe me, I've tried.

There are still a number of things missing from the database. More will get added as I accumulate demofiles from various zones with more high-level content.
If you have a demo of a fight with an Archvillain, or any other rare character please submit it!



Sure they do! 5th Column do their workouts and speaches. There's probably an emote to get Lost bosses up on a box doing a speach. And so on.



yes... i said that
Referring to the majority of player emotes I mean, you can't get most NPCs to do them.

Oh, and I think the 'soap box' used by the lost is a seperate entity, cuz it often stays in the area for awhile even if the villains have been defeated, however they are not ALWAYS in that same location.



Could you give some description about how to format the demo file? Suppose, just for the sake of argument, that I wanted to do something totally nutso crazy like creating a demofile from scratch. What do the commands look like? How are they laid out? How many parameters does each command take? And so on. Could you give a couple examples of what a demofile looks like?

Also, are there commands that will move the camera? Panning, zooming, tilting, etc?

Also, rating this thread a 5, cuz it deserves notice.



Could you give some description about how to format the demo file? Suppose, just for the sake of argument, that I wanted to do something totally nutso crazy like creating a demofile from scratch. What do the commands look like? How are they laid out? How many parameters does each command take? And so on. Could you give a couple examples of what a demofile looks like?

Also, are there commands that will move the camera? Panning, zooming, tilting, etc?

Also, rating this thread a 5, cuz it deserves notice.

[/ QUOTE ]
I suggest makeing a demo file of your own and learning from it.

/demorecord &lt;name&gt;



Do one from scratch!? Oh my, that would be a mighty tedious to do by hand! I think it would be a ton easier to record a demo then modify it. That will at least get you started at a point that isn't deep inside some wall!

Camera movement is done by using the CAM object. It gets moved around and oriented (PYR) just like any other object. If you change the last number to, say, 3 on all the CAM's PYR statements then you'll get an upside down demo!

If you're looking for demo examples, my website for my demo launcher also has a few sample demos you can download.

A program to make global edits might be interesting. Maybe instead of splicing a program could go in and make all the timing values over a range really small so you fast forward through the dull parts?

A power demo is another thing in the neat but tedius section. Take two heroes and put a couple of simple MOBs in front of them. Do this in a good sized room, maybe something from the CoT city. Then edit in every single player power with a quick chat message to say what it is. (Possibly skipping the movement powers.) This will give us a power demo catalog, of sorts.

Unfortunately, I keep wasting all my free time playing a certain addicting online game!



A program to make global edits might be interesting.


A power demo is another thing in the neat but tedius section. Take two heroes and put a couple of simple MOBs in front of them. Do this in a good sized room, maybe something from the CoT city.

[/ QUOTE ]

In progress!
Rather tedious though, as my "job" tends to interfere with my progress almost as much as this silly game.



I messed up on the float command! The number is actually the type of float being done and the string is which message to show.

So far, I've only seen two types, 5 and 6. You can see type five but not type 6 in playback. You can put type 5's over anyone. 5's that appear over the player use a smaller font than those over other players. Here's a list:

float 5 FloatOutOfRange
float 5 FloatMiss (normally the only one that appears above objects other than the player)
float 5 FloatRecharging
float 5 FloatInterrupted
float 5 FloatNotEnoughEndurance (out of power)
float 5 FloatNoEndurance (too tired)

The 6's are recorded but do not appear in playback:

float 6 FloatFoundClue
float 6 FloatFoundEnhancement
float 6 FloatMissionComplete

I'm sure there's a float 6 FloatMissionFailed, too, but naturally I have no examples of that. &lt;smirk&gt;



I'm not sure if it's just because I'm using demos from other computers, but have you noticed an increase in stability when playing back files now? I got several files to not only load, but cycle, where before the 7/7 patch all demos would crash once they reached the end of the file.



I was able to view several (not all) of my demos from the Rikti invasion once the Reflections patch went in! However, the sound system got seriously hosed. It was worth the trade, IMHO.



If you aren't already subscribed to the CoH Video's mailing list, click the link in my sig and join. There is some work being done by some of the members to editing the demo's and collaboration in parsing out the npc and fx variables.

There are some scripts that were just submitted to help in the process.



In progress!
Rather tedious though, as my "job" tends to interfere with my progress almost as much as this silly game.

[/ QUOTE ]

the demo or the program is in progress? it seems interesting to maybe build a small program to help construct demos from scratch, but definatly not worth the time if one is already in the works.



I have a program that currently outputs a demo file that displays all the powers in a selected set at 10sec intervals, with various adjustments in timing available. It also crashes the game when you try and play it, for as-yet undetermined reasons.
This is all in PHP btw. If you want to write one of your own, please be my guest, as mine is nothing extrordinary yet. I would love to see the program if you do one, and would be more than happy to host it for you.

I had intended to eventually create the ability to script out entire sequences, including camera movements, NPC animations, etc etc.



I've been playing with editing and modfying the demo files and I have a quick question.

What is the entry description for Babbage and some of the other rare mobs? Does anyone have a database going for these yet? I just want to know before I go trying to start one from scratch.



I believe he's a Giant_Sprocket. There's a database going at City of Villans (sic) that has quite a few NPCs and powers.



Yup, every time someone submits a demo file do the system, it parses it, extracts players, npcs, and FX. So the more demos that get uploaded, the more complete the database gets.
Indoor missions are especially nice, as they arent as prone to crash, and they often contain NPCs that aren't accessible anywhre else. IE Skyraider Jumpbots and Engineers, Archvillains, etc.



So my question would be how do i do a convert for the demmo to another format?



You cant. And that's all there is to it. The demo is a VERY simple text file that only makes some sense to us, and only CoH's graphics engine can do anything with it. You cannot convert it to video, audio, MP3, quicktime, divx, VHS, DVD, or anything else.
Sorry if that sounded crass, but a lot of people thing that a demo is some sort of special movie you can convert to a windows AVI.
There are ways to capture demo footage while it is playing and make a movie out of THAT, and in fact several people have done so.

Origonal post by Zloth2
Playback commands:
These commands all run from the command line when you start the game. So you would (for instance) make a shortcut to cityofheroes.exe and add these to the ‘target’

-demoplay &lt;demoname&gt;
plays back the demo. Loops forever, writing performance data to cityofheroes/client_demos/results/demo_name. (It has min,max,avg and time for each frame)
-demopause &lt;msecs&gt;
This is for videocard performance debug. Runs until it gets the the frame given (in milliseconds) then redraws that frame forever.
Dumps a .tga file of each frame rendered to client_demos/screens/&lt;demoname&gt;/*.tga
-demofps &lt;frames per second&gt;
Forces the player to simulate a fixed frame per second. This works well with demodump to get a smooth movie.
Put game in fullscreen mode (overrides the registry key)
-screen &lt;xsize&gt; &lt;ysize&gt;
Set the screensize. Ex: -screen 1024 768

[/ QUOTE ]



So my question would be how do i do a convert for the demmo to another format?

[/ QUOTE ]
Let me be a bit nitpicky.... you do not "convert" a demo. A demo and a video are completely different things. A video is a collection of a series of images. A demo is just a list of commands that City of Heroes can read.

That said, I think you want to look at this thread for how to record video from a demo. (Converting a video back to a demo just isn't going to happen.)



doesn't sound possible to convert it because the commands are only of use to the coh client. you could get some video capture program and record while you played back the demo...

btw a question... i'm playing back some demos and sometimes the sound cuts out... and sometimes it returns... not really sure what's up there or how i can fix this. any thoughts?



I've noticed that too and as far as I can tell it's just a quirk of the demo system, much like the Ghosts that appear after you kill mobs sometimes.

And thank you guys for the quick response, you all rock!



Sweet thanks for the info!