Commit Graph

574 Commits

Author SHA1 Message Date
Eduardo Cáceres
aa998a46d9 Simplify collection initialization 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
7eb64ea6fc Use read-only autoimplemented property when possible 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
79f321cb44 .Any(), .Count() -> .Count or .Length 2022-05-18 11:42:36 -05:00
Matthias Mailänder
648c56bca1 Don't crash when joining a game after asset installation. 2022-04-17 00:27:36 +03:00
RoosterDragon
ac0969d688 Use nameof instead of hardcoded strings in reflection calls.
This helps improve the safety of code the uses reflection when methods may get renamed, and helps navigating code as the nameof will show up when searching for references to members.
2022-04-14 19:58:15 +02:00
tomas
8e19463450 Fix desync handling 2022-04-12 21:56:46 +02:00
Matthias Mailänder
0260884369 Added translation support for server orders. 2022-04-03 19:23:26 +02:00
Matthias Mailänder
ee95d2591f Code cleanup. 2022-04-03 19:23:26 +02:00
RoosterDragon
9cd55df584 Ensure editorconfig naming styles align with StyleCop SA13XX style rules.
Aligns the naming conventions defined in editorconfig (dotnet_naming_style, dotnet_naming_symbols, dotnet_naming_rule) which are reported under the IDE1006 rule with the existing StyleCop rules from the SA13XX range.

This ensures the two rulesets agree when rejecting and accepting naming conventions within the IDE, with a few edges cases where only one ruleset can enforce the convention. IDE1006 allows use to specify a naming convention for type parameters, const locals and protected readonly fields which SA13XX cannot enforce. Some StyleCop SA13XX rules such as SA1309 'Field names should not begin with underscore' are not possible to enforce with the naming rules of IDE1006.

Therefore we enable the IDE1006 as a build time warning to enforce conventions and extend them. We disable SA13XX rules that can now be covered by IDE1006 to avoid double-reporting but leave the remaining SA13XX rules that cover additional cases enabled.

We also re-enable the SA1311 rule convention but enforce it via IDE1006, requiring some violations to be fixed or duplication of existing suppressions. Most violations fixes are trivial renames with the following exception. In ActorInitializer.cs, we prefer to make the fields private instead. ValueActorInit provides a publicly accessible property for access and OwnerInit provides a publicly accessible method. Health.cs is adjusted to access the property base instead when overriding. The reflection calls must be adjusted to target the base class specifically, as searching for a private field from the derived class will fail to locate it on the base class.

Unused suppressions were removed.
2022-02-07 19:14:45 +01:00
penev92
ab09ce21b4 Changed code to use object initializers everywhere 2022-01-23 13:14:57 +01:00
penev92
bf332b6619 Fixed fields missing the readonly modifier 2022-01-22 18:47:06 +00:00
Matthias Mailänder
07815143f1 Fix CA1825 warnings on empty array initialisation. 2021-12-06 13:19:28 +01:00
teinarss
1a56cee9a1 Add Tick scale plumbing 2021-10-26 22:40:15 +02:00
penev92
8ba6d13b2f Removed unused using directives 2021-10-15 13:12:33 +02:00
KonH
9ed809943d Just use Dispose methods without arguments (disposing always passed as true) 2021-10-02 22:14:08 +02:00
KonH
8bce6eb3ac Remove GC.SuppressFinalize calls from classes without destructors 2021-10-02 22:14:08 +02:00
Paul Chote
defaf92752 Send order queue length in ping responses. 2021-10-02 21:03:00 +02:00
Paul Chote
2d08f2bbfd Allow the server to ack no or multiple packets in the same frame. 2021-10-02 21:03:00 +02:00
Paul Chote
8588af1001 Disable chat for the first 5s (configurable) after joining a server. 2021-09-23 12:52:20 +02:00
Paul Chote
2424ddc79a Move NetTickScale (now NetFrameInterval) control to the server. 2021-09-21 15:12:36 +02:00
Paul Chote
df798fb620 Overhaul client latency calculations.
The ping/pong orders are replaced with a dedicated
(and much smaller) Ping packet that is handled
directly in the client and server Connection wrappers.

This allows clients to respond when the orders are
processed, instead of queuing the pong order to be
sent in the next frame (which added an extra 120ms
of unwanted latency).

The ping frequency has been raised to 1Hz, and pings
are now routed through the server events queue in
preparation for the future dynamic latency system.

The raw ping numbers are no longer sent to clients,
the server instead evaluates a single ConnectionQuality
value that in the future may be based on more than
just the ping times.
2021-09-21 15:12:36 +02:00
Paul Chote
54c08748e0 Overhaul player disconnect notifications. 2021-09-12 22:53:50 +02:00
Paul Chote
e0e219793f Fix shellmap OrderManager use after dispose. 2021-09-02 23:23:23 +02:00
Paul Chote
8f412f869d Move order latency control to the server. 2021-09-02 23:23:23 +02:00
Paul Chote
6421c17515 Rework IConnection implementations:
* EchoConnection is now a trivial buffer that stores
  and repeats orders directly without serialization.

* NetworkConnection no longer subclasses EchoConnection,
  and now also caches local orders without serialization.

* Replay recording was moved to NetworkConnection
  (it is never used on EchoConnection).
2021-09-02 23:23:23 +02:00
Paul Chote
408f30b5cd Extract OrderIO.SerializeOrders helper.
Note: This changes immediate orders to no longer be
individually framed in their own packets.
2021-09-02 23:23:23 +02:00
Paul Chote
e389c00a11 Remove packet byte wrangling from OrderManager. 2021-08-26 22:00:59 +02:00
teinarss
b4256df9c1 Cleanup in Connection 2021-08-22 09:43:25 +01:00
teinarss
f3777a25e6 Refactor send and receive Orders loop 2021-07-10 23:35:47 +02:00
teinarss
5e1468facb Fix NRE with ConnectionStateChanged 2021-07-08 01:12:05 +02:00
Ivaylo Draganov
6af354ff99 Split chat lines into pools
- Add a common class for passing around chat lines
- Add wrapper methods for adding chat lines
- Combine repeated chat lines in the display widget
2021-07-04 14:02:58 +01:00
teinarss
1f1373509e Refactor server orders 2021-07-03 14:55:03 +01:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
teinarss
b3b10729cd Remove ServerExternalMod from OrderManager 2021-06-12 12:50:51 +02:00
teinarss
91f99eeb4c Cleanup in Connect 2021-06-12 12:50:51 +02:00
teinarss
a1b3450b47 Remove Password and Endpoint from OrderManager 2021-06-12 12:50:51 +02:00
Vapre
fc49d6943a OrderIO performance improvement
OrderIO, ToOrderList, skip if frame is empty,
which occurs often each client each frame.
2021-06-09 23:31:27 +02:00
teinarss
82115c6bf7 Move Text handling to its own class 2021-06-04 21:47:39 +02:00
teinarss
d10c592987 Fix crash in OrderManager 2021-05-23 12:44:18 +01:00
reaperrr
fc3f200357 Replace F in OrderManager 2021-05-09 15:00:07 +01:00
teinarss
96b8273916 Remove FrameData and update OrderManager 2021-05-09 15:08:48 +02:00
teinarss
10676be377 Replace F extension with string interpolation 2021-05-08 22:20:59 +02:00
teinarss
1385aca783 Move ConnectionTarget to its own file 2021-05-08 20:41:40 +02:00
Paul Chote
0bbb32e8ac Rework MapPreview custom rule handling.
The previous asynchronous approach did not work particularly well,
leading to large janks when switching to custom maps or opening the
mission browser.

This commit introduces two key changes:

 * Rule loading for WorldActorInfo and PlayerActorInfo is made
   synchronous, in preparation for the next commit which will
   significantly optimize this path.
 * The full ruleset loading, which is required for map validation,
   is moved to the server-side and managed by a new ServerMapStatusCache.
   The previous syntax check is expanded to include the ability to run
   lint tests.
2021-04-21 18:57:44 +02:00
Vapre
52d39db84a Fix possible endless loop in replay recorder while opening save file. 2021-04-15 18:10:45 +02:00
reaperrr
1a9dfc0893 Refactor GameSpeed setting
*Remove internal GameSpeed defaults
 Enforce setting values explicitly all the time
 Require definition of a DefaultSpeed

*Remove Global.Timestep default

*Remove the hacky Timestep/OrderLatency setting via LobbyInfo

*Fix shellmaps ignoring mod-defined gamespeeds

*Make DateTimeGlobal use the MapOptions gamespeed
2021-04-09 22:58:14 +01:00
teinarss
8b0a3ea680 Remove our own impl of ReadOnlyList and update usages 2021-04-03 11:33:31 +02:00
Matthias Mailänder
d15e7f76fc Port back to Mono.Nat and make discovery async. 2021-03-27 18:36:12 +00:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
teinarss
ed295ae315 Change throw exceptions to use nameof in parameter 2021-02-28 18:43:51 +01:00