ddnet/src/engine
bors[bot] 5528cde5f6 Merge #869
869: Complete rework of the ghost and race recorder r=Learath2 a=Redix

This PR fixes a lot of issues with the ghost and race recorder, introduces a new ghost file format and implements some pretty useful features.

**A quick overview:**
 - When you cross the start line multiple times, both (ghost and recorder) will only restart if it is a non-solo server
 - If available, both will use the race timer to recognize the start instead of searching for the start line
 - Fastcap support for both
 - The recorder immediately starts when the Tee spawns, so the preparation steps (which are quite important for speedruns) will be included in the demo. If you do not cross the start-line within 20 seconds, it will stop the demo until you really start.
 - Better ghost menu (colors, reloading, deleting and saving ghosts)
 - The ghosts are more resistant against lags (old ones were sometimes completely useless due to small lags)
 - New ghosts files are significantly smaller
 - Cleanup, bugfixes..


**About the new ghost format (version 4/5):**
This format is used by Teerace for over a year now. The code for handling the binary files was moved to the engine. It includes an auto updater which creates a backup of all ghosts and converts them to the new format afterwards. The major differences from the format used by DDNet right now (version 2), are the ability to store multiple types of data, the usage of delta-encoding and a more portable header.

For whatever reason, the ghost stores values for every predicted tick, but without tick information, so lost snapshots can make them unusable. The new code uses the original values from the snapshots including ticks but it can also handle the old ones without. Since hardly any server uses the high bandwidth option this practically reduces the file size.

Like the demo recorder the ghost recorder directly stores the data to a file (every 50 snapshots) instead of writing the whole file at the end of the race. Indeed this can be changed with only a few lines if the old behavior is preferred.

The updater can handle version 2 (DDNet) and 3 (old teerace format, only slightly different from version 2) files. The updating already happens when the files are scanned for generating the list in the menu and not only when you activate them. The change from version 4 to 5 was only needed due to a bug in the implementation, the ghost loader can read both.

Some numbers about the file size: (map: hotrun, both about 30 seconds)

 - Old ghost: 30.4 kB (converted: 10.7 kB)
 - New ghost: 5.4 kB


**One thing about the race recorder:**
The old implementation compared the new file only with the first file it found for the particular map. The new one compares with all related demos and deletes them possibly, so that only the best demo is left. Since DDNet can also store the demos without name, this might also delete demos from other players, that you might have in your directory.
To prevent this I at least check whether the demo contains the player name if `cl_demo_name` is on. 
In my opinion the better solution would be to remove `cl_demo_name` and always use the player name.
2017-10-30 20:27:10 +00:00
..
client Merge #869 2017-10-30 20:27:10 +00:00
docs Fix a few whitespace-at-end-of-file issues 2015-08-22 15:27:41 +02:00
external New glew try 2017-10-20 11:35:44 +02:00
server Address pull request comments 2017-10-13 02:29:18 +02:00
shared Merge #869 2017-10-30 20:27:10 +00:00
client.h Fixed several issues with the ghost (thanks to Learath2) 2017-10-28 14:23:24 +02:00
config.h dont restore empty config values at start 2015-11-16 20:31:56 +01:00
console.h Make most user input teehistoric 2017-09-20 02:23:28 +02:00
demo.h Always close files, cleaner demo recording, fix some other stuff 2017-07-08 13:39:20 +02:00
editor.h Add code for fixing old maps by removing unused tiles 2017-06-11 19:53:55 +02:00
engine.h Make --silent stop stdout logging 2017-09-03 10:37:24 +02:00
fetcher.h Forgot classes need to be initialized with new 2017-10-09 20:04:23 +02:00
friends.h Add foes (permanently ignored players) 2015-07-22 22:16:49 +02:00
ghost.h Fixed several issues with the ghost (thanks to Learath2) 2017-10-28 14:23:24 +02:00
graphics.h remove functions, that aren't needed anymore 2017-09-27 12:18:46 +02:00
input.h Refcount IME usage (fixes #577 and #738) 2017-07-15 15:25:36 +02:00
kernel.h minior style issues 2017-07-28 14:49:09 +02:00
keys.h Use scancodes instead of keycodes for input (fixes #796, please test) 2017-07-21 19:53:49 +02:00
map.h Rename GetUncompressedDataSize to GetDataSize 2017-08-30 08:36:17 +02:00
masterserver.h Fix a few whitespace-at-end-of-file issues 2015-08-22 15:27:41 +02:00
message.h Add protocol extension with UUIDs 2017-05-25 00:52:43 +02:00
server.h Address pull request comments 2017-10-13 02:29:18 +02:00
serverbrowser.h Added Fastcap support for ghost and race demo 2017-09-28 16:01:57 +02:00
sound.h Add option to enable/disable panning per voice 2014-11-30 12:23:05 +01:00
storage.h Fix and rename the CEditor::ExtractName function 2017-08-30 13:59:42 +02:00
textrender.h Possible emoji rendering fix 2017-10-28 09:08:17 +02:00
updater.h Allow updating dll files. Replace vectors with map. 2015-08-29 23:48:04 +03:00
uuid.h Add protocol extension with UUIDs 2017-05-25 00:52:43 +02:00