88 Commits

Author SHA1 Message Date
yvt
c0414e9906 feat(client): remove the finite-difference velocity estimation
This velocity estimation routine has been present since the beginning of
time, but it seems that this actually does more harm than good.

Neither the vanilla client nor BetterSpades implements velocity
estimation.
2021-12-15 21:54:38 +09:00
Rakete175
7cf405cf40 NetClient.cpp: Actually send Enhanced version packet
Currently OpenSpades doesnt send the extended version info which contains
some useful info to the server even when being told that it wants it.

This commit adds sending of the packet so servers will receive such info when
they ask for it.
2021-11-14 23:11:06 +01:00
yvt
ee1f8a4772 fix(client): relax the lower bound of the denominator used in numerical differentiation for velocity estimation
Improves the smoothness of non-local player movement in a server that
sends ten WorldUpdate packages for each second (i.e., 10 updates per
second).

I wouldn't dare to relax the bound further since this technique is
extremely susceptible to jitter. The server sending WorldUpdate packets
with `PACKET_FLAG_UNSEQUENCED` isn't exactly helping since that
introduces discontinuity into the received position stream, and the
denominator lower bound is the only thing that keeps the estimation from
exploding. (The packets should really be unreliable + sequenced.)
2021-08-11 23:43:36 +09:00
yvt
b1022213f3 Merge branch 'master' into patch-modernize 2021-05-02 23:39:03 +09:00
Tomoaki Kawada
738c7e509e
Merge pull request #848 from Tuupertunut/master
Fixed map loading with protocol 0.76.
2020-08-06 15:21:09 +09:00
Tomoaki Kawada
5a57a5e406
Explain why we send MapCached 2020-08-06 15:19:16 +09:00
yvt
4fbe5ee5ce
Reset intels and team scores after receiving winning IntelCapture
This problem was originally reported in:
<https://github.com/piqueserver/piqueserver/issues/586>

Upon receiving `IntelCapture` with `winning = 1`, the voxlap client
resets both team scores and the holding status of both teams' intels,
but OpenSpades didn't do that, resulting in a weird behavior described
in piqueserver/piqueserver#586. This commit changes OpenSpades' behavior
to be congruent with the voxlap client's behavior.

Fixes #890.
2020-04-20 13:38:57 +09:00
Tuupertunut
3539b4240c Fixed map loading with protocol 0.76. 2019-09-22 21:16:05 +03:00
yvt
066eda82df
Add bounds check 2019-08-08 01:08:12 +09:00
yvt
d248ac2460 Change the return type of GameMapLoader::TakeGameMap to Handle<_> 2019-07-23 21:57:40 +09:00
yvt
a0c9a661eb
Remove unused variables 2019-07-20 17:12:45 +09:00
yvt
6e262ea6ec
Add stmp::make_unique
This template function is a polyfill of `std::make_unique`, which is
unavailable in GCC 4.9 (should we even be supporting this old thing?).
2019-07-20 16:17:10 +09:00
yvt
7c3a39e639
Modernize
- Replaced raw pointers with references or smart pointers. Nullable
  references are represented by `stmp::optional<const T&>`. (There are
  many raw pointers still remaining. They should be replaced at some
  point.)
- Added class template specializations `stmp::optional<T &>` and
  `stmp::optional<const T&>`.
- Fixed `stmp::optional`'s various behaviors
- `World::{players, playerPersistents}` are now `std::array`.
- More uses of `stmp::optional` to clarify the semantics
- Renamed `PlayerThrownGrenade` to `PlayerThrewGrenade`
- Replaced old-style `for` loops with range based ones
- Deleted `Player`'s default constructors and `operator =`
- Deleted `TCGameMode`'s default constructor and `operator =`
- Deleted `CTFGameMode`'s default constructor and `operator =`
- Replaced `static_cast` with `dynamic_cast` for down-casting
- `RefCountedObject::operator*()` no longer requires non-constness to
  return `T &`.
- Replaced the uses of `std::vector::operator[]` with `std::vector::at`
  for bounds checking.
- Made some methods of `GameMap` `const`.
- Added some null checks.
2019-07-17 00:31:00 +09:00
yvt
6f59b7e3fd
clang-format 2019-05-20 00:18:56 +09:00
notafile
6e24902324 Remove accidental line, add comment 2019-05-19 17:07:57 +02:00
NotAFile
a3e4810a18 Add support for ExtInfo Packet 2019-05-19 16:29:22 +02:00
yvt
720be50ff4
Show additional info (estimated remaining time, etc.) when loading map 2019-05-19 17:08:09 +09:00
yvt
cd3304ef24
Display a progress bar when receiving a map
Replaces the old useless "num-bytes-loaded/16777216" message with a
real progress bar.
2019-05-19 16:25:39 +09:00
NotAFile
49a4c0dd4f remove duplicate handling of VersionGet 2019-05-04 20:21:44 +02:00
NotAFile
2ecd3ced44 detect end of map transfer with state packet
Previously, the end of map transfer was detected by a number of fallible
heuristics, including checking if the map is loadable on every non-map
packet, when a timeout had been reached, or the map size given by the
server was reached. This broke in a number of scenarios, including when
an unexpected packet was sent.

Instead, we now detect the end of the map transfer when we receive a
state packet, as intended by the protocol.
2019-05-04 20:14:42 +02:00
NotAFile
4ea1e50ae0 Add Counter for world updates per Second (#707)
* Add Counter for world updates per Second

This work was just done for personal testing and is probably not up to the
required code standards. Nonetheless, I have decided to send a PR as it is very
useful information and a good starting point.

* add MarkWorldUpdate method
2018-01-06 19:38:14 +09:00
yvt
f702eca1d8 Fix crash on server connection 2017-12-30 04:28:50 +09:00
yvt
28cd9a3c87 clang-format 2017-12-29 20:49:10 +09:00
yvt
4cb5c578c5 Eliminate compiler warning 2017-12-29 20:47:20 +09:00
yvt
3086f03cf9 Accept handshake packets anytime
Fixes #644.
2017-12-29 20:46:35 +09:00
yvt
d7768ae0d5 Fix "invalid player ID" error after map change
Fixes #66. Wow, it's been 4 years since the issue was reported for the
first time.

*Inhale* yay!
2017-12-16 23:38:54 +09:00
yvt
7d0d8e3704 Create Weapon instances based on the current GameProperties, not a cvar 2017-09-11 20:59:39 +09:00
yvt
821c392ade Add protocol version parameter to GameProperties’ constructor 2017-09-11 20:49:21 +09:00
yvt
f016bd7cee Prepare for an increased number of player slots
Related: #630
2017-09-04 14:39:37 +09:00
yvt
a8ae6c1098 Clear the kill count when a player leaves
Fixes #620.
2017-09-03 16:59:33 +09:00
yvt
a853a58631 Remove corpses after respawn on a certain game mode
Fixes #145.
2017-09-03 16:56:01 +09:00
yvt
aa22e4b25a Show "player joined team" message for the Spectator team
Fixes #635.
2017-09-03 16:00:30 +09:00
yvt
a6bb4ac7e2 Support the enhanced variant of Version Get/Send packet
Fixes #561.
2017-02-11 16:24:53 +09:00
yvt
2554eaad57 Refactor, add more checks 2017-01-05 04:11:42 +09:00
yvt
a7b9909b2e Refactoring 2017-01-05 03:03:39 +09:00
David Carlier
1d970ec34d make the build possible on OpenBSD.
modified version of the pk download script.
isnan belongs to std namespace in C++11 standard.
2016-12-04 20:01:37 +00:00
Tomoaki Kawada
624d291f79 Update #includes
- Reorder them so that system libraries come first
- Use C++-style headers (`<cmath>`) instead of C-style headers (`<math.h>`)
2016-12-03 19:04:58 +09:00
Tomoaki Kawada
2eb9e35c65 Apply clang-format to all non-external source files 2016-12-03 18:23:47 +09:00
Tomoaki Kawada
18f3e81fd1 Convert space indentations to tabs 2016-11-20 19:13:00 +09:00
Tomoaki Kawada
6a7af96daf Refactor setting variables 2016-11-19 21:27:13 +09:00
Tomoaki Kawada
89748d6bc6 Reduced compiler warnings 2016-07-15 19:40:05 +09:00
Marco Schlumpp
f6d8c22e13 Attempt to fix yvt/openspades#234.
Starting in d856bcadaa09cf6722547007c3329b43ab1480d7 the client reads
one byte less than necessary.
2014-04-20 13:00:05 +02:00
yvt
d856bcadaa Reduce compiler warnings 2014-04-06 22:42:17 +09:00
yvt
43facd32c4 cg_protocolVersion now cannot be changed in-game 2014-04-02 15:14:56 +09:00
yvt
817ce53c23 Statistics (fix #202) 2014-03-31 23:09:47 +09:00
yvt
3f9d454460 Made "Awaiting for state" translatable 2014-03-30 02:44:43 +09:00
yvt
bfcf96ad13 Fix #73 2014-03-30 01:42:18 +09:00
yvt
2af2826918 Show ping (fixing #146) 2014-03-16 01:23:30 +09:00
yvt
8ebc1ffe15 Fix #190 2014-03-13 14:01:53 +09:00
yvt
740db71d24 Make some strings translatable 2014-02-28 16:22:00 +09:00