-
Notifications
You must be signed in to change notification settings - Fork 2
Using demoplayer
Since coldmaps 0.2.2, there is a command line option --demoplayer
you can launch coldmaps with.
In this mode, there will be no graphical interface but instead a text-based interface you can interact with directly by typing commands in.
coldmaps.exe --demoplayer
load test_files/auto-20200902-140618-koth_bagel_fall_rc1.dem
{"result":{"server":"TF2Maps.net | Frankfurt","nick":"SourceTV Demo","map":"koth_bagel_fall_rc1","duration":1012.19995,"ticks":67480,"frames":16857,"is_corrupted":false},"error":null}
Any scripting/programming language can interact with it as long as it can
- Open a child process and read/write its stdout/stdin
- parse JSON (used for the replies)
The program makes the difference between demo "ticks" and demo "frames"
Most servers use 66.67 tickrate so there's 1 tick every 15ms, however sourceTV demos can be recorded at a different rate, depending on tv_snapshotrate
which is 16 by default, that means that on servers which use the default settings, there will be around 1 demo frame for every 4 ingame tick
For every command sent, a reply consisting of a JSON object will be sent back, this JSON object has this form:
{ result:<result|null> error:<error|null> }
If result is null, that means an error has occurred with the command and error will contain a string describing the error.
Loads a map
Returns all the informations that were collected from the demo, including deaths and chat
TODO: describe format
Returns an array, indexed by frame number, containing the ingame tick they correspond to, if the frame spans over several ticks, it will be the last one in the frame
Return an array, indexed by tick number, containing the ingame frame they correspond to
Returns the content of that particular demo frame
Format:
{
"current_tick":3493,
"users": {
"543": {
"name":"Tails8521",
"user_id":543, // these are unique per player and only go up, counter resets when server restarts
"steam_id":"[U:1:91481436]",
"entity_id":9, // can be null
"team":"Blu"
},
...
},
"player_entities":[
{
"entity":9,
"position":{
"x":3807.875,
"y":-64.0,
"z":384.0
},
"health":206,
"max_health":175,
"class":"Pyro",
"team":"Blu",
"view_angle_horizontal":198.12317,
"view_angle_vertical":13.05883,
"state":"Alive"
},
...
]
}
Returns the content of that particular demo tick
Same format as the frame command
Enable or disable prefetching, prefetching allows smoother continuous playback but can slow things down while seeking around or playing ticks in a random order.