Replace `mem_free` by `free`, and `mem_alloc` by `malloc` or `calloc`
(the latter one being used to allocate a zeroed array of elements,
sometimes, this makes a call to `mem_zero` superfluous).
This results in having to remove `mem_stats` which previously recorded
the number of allocations and their size that the Teeworlds code did
directly.
Remove OOM handling in `src/game/client/components/binds.cpp`.
Remove needless copying in the CSV code in
`src/game/client/components/statboard.cpp`.
`str_utf8_isspace` now returns true if the passed code point renders as
a space, instead of when not.
Add `str_utf8_trim_right`, use this function and
`str_utf8_skip_whitespaces` in the server.
Add tests for the three functions
1055: Keep track of lost frames and update time r=heinrich5991 a=Jupeyy
The problem a friend was occuring was, that on a fresh Windows install settings like cl_refresh_rate are set to 480.
Since the render calls take longer time than no render calls, it happened that client was sleeping on one update cycle and then took to long in another, where it called the render functions, leeding to less FPS than the cl_refresh_rate. this caused mouse lags and rarely frame drops.
another thing is, that select on Windows is non microsecond accurate, or just often returns too early, which caused that the refresh rate is much too high, or even ignored, (probably windows can only sleep on milliseconds, or again, is extremly inaccurate).
Another things on windows is that time_freq might be a "very odd" number ^^
i mean like on unix it's one microsecond (1,000,000 = 1s), but on windows the time_freq depends on the CPU leading to inaccurate calculation of the sleep time and render time.
This wasn't insanly huge issue, but probably skipped a few microseconds here and there.
This fix should stabilize the frames. I'd like to hear your opinion on this tho.
This uses the Unicode confusable data together with judging how close
two strings are by using the Levenshtein distance.
Adds the commands `name_ban`, `name_unban` and `name_bans`. Kicks
players who join using a banned name and doesn't allow ingame players to
change their names to the banned ones.
957: Add manual locking to `ASYNCIO` for transacted writes r=Learath2 a=heinrich5991
Previously, e. g. it was possible that newlines are separated from the
printed line in `logger_file`.
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.