ddnet/src/game
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
editor buffer sizes 2017-09-03 08:53:54 +02:00
server Fix victim handling 2017-10-17 01:32:40 +02:00
collision.cpp Rename GetUncompressedDataSize to GetDataSize 2017-08-30 08:36:17 +02:00
collision.h fixed memoryleak in CCollision 2017-07-21 16:02:24 +02:00
ddracecommands.h Make most user input teehistoric 2017-09-20 02:23:28 +02:00
extrainfo.cpp Fix indentation 2017-06-06 10:13:19 +02:00
extrainfo.h also remove references to CGameContext from CServer 2017-06-05 22:31:56 -07:00
gamecore.cpp also remove references to CGameContext from CServer 2017-06-05 22:31:56 -07:00
gamecore.h Revert "Don't divide by 0" 2017-09-16 18:33:10 +02:00
layers.cpp removed unused Dest function for layers 2017-07-28 14:43:03 +02:00
layers.h removed unused Dest function for layers 2017-07-28 14:43:03 +02:00
localization.cpp added "Whitespace and line Endings cleanup" by GreYFoX 2011-04-13 20:37:12 +02:00
localization.h Enable -Wextra and -Wformat=2 2017-07-27 20:38:17 +02:00
mapitems.cpp Add code for fixing old maps by removing unused tiles 2017-06-11 19:53:55 +02:00
mapitems.h Add code for fixing old maps by removing unused tiles 2017-06-11 19:53:55 +02:00
teamscore.cpp Fix number 100000 for this 2015-02-28 01:18:35 +01:00
teamscore.h Fix number 100000 for this 2015-02-28 01:18:35 +01:00
tuning.h Fix whitespaces a bit 2015-07-09 02:12:35 +02:00
variables.h Switch cl_showfps 1/2 2017-10-20 22:27:53 +02:00
version.h Version 10.8.6 2017-09-08 22:01:51 +02:00
voting.h Fix: team 0 doesn't count players 2013-08-01 22:27:19 +02:00