Commit Graph

5260 Commits

Author SHA1 Message Date
vis2k
d4dc9a7585 fix broken tests 2022-12-21 10:36:22 +01:00
Tubeliar
74a24150f6
breaking: Reduce code duplication with common base class for NetworkTransform and NetworkTransformReliable (#3314)
* Move Networktransform OnGUI and gizmos to a common baseclass

* Move networktransform teleportation and reset to common base class

* Move networktransform adding snapshots to common base class

* Move networktransform snapshot construction and application to common base class

* Move networktransform awake, onvalidate and IsClientWithAuthority to common base class
2022-12-20 22:14:18 +01:00
TCROC
ebc087ad54
Fixed server and client connection attempt with AddPlayer before authentication completes (#3310)
* Fixed server and client connection attempt before authentication completes

* Removed auth check on server

* Updated with suggestions from MrGadget
2022-12-20 11:03:20 -05:00
vis2k
c50ea9cb55 script icons 2022-12-20 10:49:23 +01:00
MrGadget1024
48926e841a NetworkRoomManager - kick late joiner
- OnServerConnect should do this, but for corner case of miraculous timing, do it here too.
2022-12-18 20:31:35 -05:00
MrGadget1024
0b082530ba Restored [RequireComponent(typeof(NetworkTransform))]
In these 4 examples, NT Unreliable is fine.
2022-12-18 18:49:42 -05:00
MrGadget1024
2991598405 Merge branch 'master' of https://github.com/vis2k/Mirror 2022-12-14 23:51:44 -05:00
MrGadget1024
461ce27908 fix: Added clientStarted check to OnStopClient
- fixes: #3245
2022-12-14 23:51:08 -05:00
vis2k
fe3627f03b perf: fix: KcpTransport CongestionWindow force disabled. enabling this would cause a significant slowdown in throughput, with only 2-3 MTU sized messages being flushed per update. best to keep this disabled, as the feature may be broken in kcp. 2022-12-14 21:09:13 +01:00
vis2k
1a0a9a0cce KcpTransport: [Header] improved 2022-12-14 21:04:39 +01:00
vis2k
f14d423183 kcp2k V1.25 [2022-12-14]
- breaking: removed where-allocation. use IL2CPP on servers instead.
- breaking: KcpConfig to simplify configuration
- high level cleanups
- perf: KcpPeer: StopWatch replaced with time parameters.
  all peers can now share the same stopwatch on servers.
2022-12-14 21:04:28 +01:00
vis2k
69ac95e55e NetworkClient: improve 'found null entry' message to not sound the same as on the server 2022-12-14 18:30:16 +01:00
vis2k
3e3a1cbb44 fix: #3307 kcp2k V1.24 2022-12-14 01:04:16 +01:00
mischa
42a0c8ef67
fix: #3302 StartHost: user callbacks OnStartServer/OnStartHost aren't invoked until everything was set up in FinishStartHost. (#3304) 2022-12-13 13:17:53 +01:00
mischa
b58084583f
Welcome message moved out of NetworkManager into standalone Editor script, per-session instead of per-play. (#3306) 2022-12-13 13:16:59 +01:00
MrGadget1024
83581f0be1 syntax 2022-12-13 05:52:37 -05:00
MrGadget1024
da3f3e2f29 Merge branch 'master' of https://github.com/vis2k/Mirror 2022-12-13 05:27:14 -05:00
MrGadget1024
9c4774f14f SWT - fixed server logging showColor 2022-12-13 05:27:09 -05:00
vis2k
60948b13b3 NetworkManager.SetupServer: OnStartServer callback is now invoked manually by callers to prepare for host mode fix for #3302 2022-12-12 17:52:37 +01:00
vis2k
db8c54f913 NetworkServer.localConnection: strong typing 2022-12-12 16:35:54 +01:00
vis2k
0e9edbd0ad NetworkClient.activeHost to replace .isHostClient (consistent with NetworkServer.activeHost) 2022-12-12 15:50:45 +01:00
vis2k
a4f3872a01 NetworkServer.activeHost to replace .localClientActive 2022-12-12 15:50:41 +01:00
vis2k
6088591269 NetworkClient.RegisterSystemHandlers renamed to RegisterMessageHandlers for consistency with NetworkServer.RegisterMessageHandlers 2022-12-12 15:25:59 +01:00
vis2k
725fdc24f4 syntax for readability 2022-12-12 15:19:15 +01:00
vis2k
97b365c54f NetworkManager.IsSceneActive moved to Utils.IsSceneActive as it's a general purpose Unity function, unrelated to NetworkManager itself 2022-12-12 15:18:17 +01:00
vis2k
599519e163 NetworkManager.FinishStartHostClient merged with FinishStartHost, because the functions configures both server & client, just as FinishStartHost does. this is less confusing. 2022-12-12 14:29:42 +01:00
vis2k
636995e3f0 HostMode.ActivateHostScene to move ActivateHostScene out of NetworkServer.cs 2022-12-12 14:27:12 +01:00
vis2k
0a9fcdcf06 HostMode.InvokeOnConnected to move ConnectLocalServer out of NetworkClient 2022-12-12 14:23:48 +01:00
vis2k
def22c864d HostMode.cs - to move host mode connection setup out of NetworkClient 2022-12-12 14:13:31 +01:00
vis2k
ca3bfed93a TODO 2022-12-12 13:58:23 +01:00
vis2k
e0ffc66be8 NetworkClient.ConnectHost: local connection setup moved into a separate function 2022-12-12 13:56:13 +01:00
vis2k
1b7906c1ed NetworkManager.StartHostClient renamed to FinishStartHostClient to be more obvious 2022-12-12 13:48:11 +01:00
vis2k
d406a55e49 Utils.CreateLocalConnections for use from NetworkClient.ConnectHost & Tests 2022-12-12 13:40:50 +01:00
vis2k
8c5152dc65 revert: "Weaver: added missing HashSet<T> reader/writer generation after recent PR" - tests are still failing 2022-12-10 22:37:59 +01:00
vis2k
51eeb8a22d add comments 2022-12-10 22:36:27 +01:00
vis2k
5e6b647723 Tests: add missing attribute 2022-12-10 22:16:22 +01:00
vis2k
25794f2411 NetworkClient.InternalAddPlayer: improve error message 2022-12-10 02:47:09 +01:00
vis2k
6f98725247 MIRROR_70_0_OR_NEWER 2022-12-09 21:36:39 +01:00
vis2k
5509bb73bb fix: 2019 support 2022-12-09 21:36:36 +01:00
vis2k
8f480ad963 add comments 2022-12-09 20:47:50 +01:00
vis2k
c994bb41b7 syntax 2022-12-09 20:47:33 +01:00
Reuben Carolan
7b4e174d23 feature: Weaver HashSet<T> support (we already had List<T> support) for cases where we a struct may need to serialize a HashSet member for serialization etc. 2022-12-09 20:45:49 +01:00
MrGadget1024
c36e1f564d Added [Multiplexer] to logging 2022-12-09 09:23:53 -05:00
MrGadget1024
6ae165e308 SimpleWebTransport - Added UNITY_SERVER around Exception logging
- don't need color tags on server
2022-12-09 09:08:17 -05:00
MrGadget1024
33f1f95b8b WebSocketServer- added false for showColor to server side logging 2022-12-09 09:01:40 -05:00
MrGadget1024
1412c4606c Added [SimpleWebTransport] to logging in case using Multiplexer 2022-12-09 08:57:12 -05:00
MrGadget1024
1cf5e7f333 Added [KCP] to logging in case using Multiplexer 2022-12-09 08:42:07 -05:00
MrGadget1024
ce462aea99 Added [Telepathy] to logging in case Multiplexer is used 2022-12-09 08:35:41 -05:00
MrGadget1024
a7fb58d54f Updated NetworkManager Script Template 2022-12-07 16:22:34 -05:00
vis2k
b91c7027a5 fix: kcp V1.23 - fixes #3296 2022-12-07 19:14:59 +01:00
vis2k
98e7d2f475 Basic Example: added GUIConsole for easier debugging 2022-12-07 19:14:42 +01:00
MrGadget1024
519b9e0bd8 fixed comment 2022-12-07 19:14:39 +01:00
MrGadget1024
05e18380c0 Updated Basic Example 2022-12-07 19:14:35 +01:00
vis2k
566407cd86 Tests: fix Unity 2020 compilation 2022-12-05 07:43:25 -05:00
vis2k
5e1f17373a comment 2022-12-04 17:03:57 -05:00
vis2k
d5f7c4bc01 fix: ClientToServer [SyncVar] wouldn't be broadcast to other clients because server never set it dirty 2022-12-04 16:51:24 -05:00
vis2k
4743d27f74 SyncDirection demo: add more spacing 2022-12-04 16:38:08 -05:00
vis2k
9d00ba3261 SyncDirection demo: zoom in 2022-12-04 16:37:16 -05:00
vis2k
1598a7cd15 SyncDirection demo: local player color 2022-12-04 16:36:41 -05:00
mischa
4ae4834f7a
fix: #3290: Weaver HasNetworkConnectionParameter now supports inheritance (#3293)
* test to reproduce

* fix: #3290: Weaver HasNetworkConnectionParameter now supports inheritance
2022-12-04 17:31:41 +01:00
vis2k
859138f137 Weaver: add explanations for Is vs. IsDerivedFrom 2022-12-04 11:00:14 -05:00
vis2k
4c0c5e74d3 Tests: TargetThatIsTotallyValid renamed to TargetRpcWithNetworkConnection for easier debugging 2022-12-04 10:47:55 -05:00
mischa
6d60471868
fix: #3280 #3083 #3217 MultiplexTransport connectionId multiplexing out of int.max range (#3291)
* lookup wip

* so far

* transport lookup

* wip

* okokok

* all done

* better

* x

* tests
2022-12-04 13:57:51 +01:00
vis2k
5991a9a53a fix: MultiplexTransport.ServerStart: AddServerCallbacks is only called once, not for each transport 2022-12-03 22:20:44 -05:00
vis2k
b770f9ffa9 spacing 2022-12-03 20:04:12 -05:00
vis2k
9fd1e65eab syntax: move Multiplex connectionId calculations to the top of the file 2022-12-03 20:01:42 -05:00
vis2k
2566911e78 MultiplexTransport: Test to reproduce #3280 2022-12-03 19:49:13 -05:00
vis2k
d77655f19b comment improved 2022-12-03 19:32:58 -05:00
vis2k
9d212bc117 // A Test behaves as an ordinary method 2022-12-03 19:23:31 -05:00
vis2k
02de011ab0 perf: MultiplexTransport.ServerSend: remove unnecessary O(N) loop 2022-12-03 19:21:56 -05:00
vis2k
25959df80c MultiplexTransportTests: add ServerSend tests via NSubstitute 2022-12-03 19:17:02 -05:00
vis2k
5bfc646bd8 MultiplexTransportTests: add substitute explanations 2022-12-03 19:11:59 -05:00
vis2k
4f45e9eada comments 2022-12-03 19:01:24 -05:00
vis2k
9ad3f08392 MultiplexTransport: parameters switched to be more obvious 2022-12-03 18:59:18 -05:00
vis2k
2b1ebea7b7 MultiplexTransport: ID functions renamed to be more obvious 2022-12-03 18:56:54 -05:00
vis2k
0dfd4e15cc comments 2022-12-03 18:52:13 -05:00
vis2k
33a697896c syntax 2022-12-03 18:46:21 -05:00
vis2k
2def856707 syntax 2022-12-03 18:45:51 -05:00
vis2k
40564da5cc Tests: MultiplexTransport To/From ID computations 2022-12-03 18:42:52 -05:00
vis2k
beb9c04218 comments 2022-12-03 18:39:33 -05:00
vis2k
e8d178688f Tests: MultiplexTest renamed to MultiplexTransportTest 2022-12-03 18:36:32 -05:00
vis2k
576bcd80d7 MultiplexTransport: Id calculations made static for easier testing 2022-12-03 18:31:06 -05:00
vis2k
f4d4563a43 MultiplexTransport: syntax for readability 2022-12-03 18:28:19 -05:00
vis2k
27a22620db breaking: virtual NetworkManager.OnClientDisconnect is now simply a user callback. users don't need to call base or StopClient anymore when overwriting. 2022-12-03 13:49:27 -05:00
vis2k
ff3039bdb4 breaking: fix: circular calls from Transport -> NetworkClient -> NetworkManager.OnClientDisconnected -> StopClient() -> NetworkClient.Disconnect() -> ...
NetworkManager.OnClientDisconnect now doesn't call NetworkClient.Disconnect anymore.
NetworkManager.StopClient() still calls NetworkManager.OnClientDisconnect for compatibility.
2022-12-03 13:49:27 -05:00
vis2k
3a7a5be152 fix: #3152 #3213 NetworkClient.AddTransportHandlers ensures they are only added once, never twice even if a community Transport forgets to call OnDisconnected 2022-12-03 13:36:53 -05:00
vis2k
ce9d52e8fd fix: #3287 Telepathy NullReferenceException on client after Server was forcefully closed 2022-12-03 13:31:26 -05:00
vis2k
9da1786979 KcpTransport: expose conversion methods 2022-11-30 13:34:45 -05:00
vis2k
aeba5940bf KcpClient: expose RawReceiveBuffer 2022-11-30 13:29:55 -05:00
vis2k
6938bd15e6 Tanks demo: add NetworkPingDisplay for latency tests 2022-11-30 13:16:31 -05:00
vis2k
f0aae71f16 kcp2k V1.22 2022-11-29 13:33:22 -05:00
MrGadget
563f6feea0 syntax 2022-11-29 06:36:57 -05:00
MrGadget
91c3439948 fix: MatchInterestManagement - Use TryGetValue in Update 2022-11-29 06:35:58 -05:00
MrGadget
904d44333e MatchInterestManagement - naming consistency 2022-11-29 06:34:19 -05:00
MrGadget
c0908a2f58 fix: SceneInterestManagement - Use TryGetValue in Update 2022-11-29 06:33:33 -05:00
MrGadget
c70145d535 ServerCallback attributes added 2022-11-29 06:23:10 -05:00
MrGadget
94e315caca TeamInterestManagement- syntax 2022-11-29 06:19:41 -05:00
MrGadget
12c83effbb fix: SceneInterestManagement - use TryGetValue in OnDestroyed 2022-11-29 06:17:49 -05:00
MrGadget
f67aa64d59 fix: MatchInterestManagement - use TryGetValue in OnDestroyed 2022-11-29 06:16:53 -05:00
MrGadget
186702f810
feat: Add Mirror.Transports AsmDef (#3282)
- Keeps transports in their own assembly to users' own AsmDef's can reference them.
2022-11-28 12:12:51 +01:00
MrGadget
094b925797
fix: Fix vector3 long warnings (#3281)
* fix: Suppress Warnings in Vector3Long

* fix comment

* formatting

* Formatting
2022-11-28 12:11:44 +01:00
MrGadget
a86a115a30
Fix time as double unity 2019 (#3279)
* NetworkServer - TimeAsDouble compatibility for Unity 2019

* NetworkStatistics - TimeAsDouble compatibility for Unity 2019

* Simplified - rely on defines in NetworkTime
2022-11-27 07:35:05 -05:00
MrGadget
abd1c1689d NetworkRoomManager - Removed OnRoomClientAddPlayerFailed virtual method
- Fixes #3168
- There is no good place to call that - use OnRoomClientDisconnect or OnRoomStopClient
2022-11-26 14:03:29 -05:00
MrGadget
71668c530f Team and Match Interest Management Updates
- Fixes #3273 (removed erroneous evaluation in OnCheckObserver)
- NetworkTeam TeamId and Force Shown are now SyncVars for debugging
- Better naming of variables
2022-11-26 13:36:59 -05:00
vis2k
73b83c14cc Merge remote-tracking branch 'origin/master' 2022-11-24 11:03:34 +01:00
vis2k
d100ecb4c4 kcp2k V1.21 [2022-11-24]
- high level refactor, part one.
  - KcpPeer instead of KcpConnection, KcpClientConnection, KcpServerConnection
  - RawSend/Receive can now easily be overwritten in KcpClient/Server.
    for non-alloc, relays, etc.
2022-11-24 10:51:47 +01:00
MrGadget
51209096a3 Updated RigidbodyPhysics Example 2022-11-23 05:56:30 -05:00
MrGadget
8fc73b034b Updated Examples Player Prefabs
Default NT Settings Updated
2022-11-23 05:21:23 -05:00
MrGadget
6c041dce22 Merge branch 'master' of https://github.com/vis2k/Mirror 2022-11-23 05:08:24 -05:00
MrGadget
bd88d665de Updated Rigidbody Pysics Example 2022-11-23 05:08:10 -05:00
vis2k
e1a5f0300f perf: kcp2k V1.20 [2022-11-22]
- perf: KcpClient receive allocation was removed entirely.
  reduces Mirror benchmark client sided allocations from 4.9 KB / 1.7 KB (non-alloc) to 0B.
- fix: KcpConnection.Disconnect does not check socket.Connected anymore.
  UDP sockets don't have a connection.
  fixes Disconnects not being sent to clients in netcore.
- KcpConnection.SendReliable: added OnError instead of logs
2022-11-23 00:18:41 +01:00
vis2k
9c0814fa54 Tanks demo resaved 2022-11-22 12:04:47 +01:00
vis2k
cc170b2569 update script icon 2022-11-22 12:01:46 +01:00
vis2k
fcf148184e fix: Unity 2019 Vector3Long semicolon error:
https://forum.unity.com/threads/mirror-open-source-networking-for-unity.425437/page-37#post-8592787
2022-11-17 18:41:24 +01:00
JesusLuvsYooh
ca33b91460
A define mistake, fixed Under 2021 support. (#3276)
There is no HashCode.Combine in this function, so 2021 define is not needed.
Removing the define brings back support for under Unity 2021's
2022-11-17 14:40:12 +01:00
JesusLuvsYooh
eaf16608ca
Support for c# versions under 9 (is not to ! is) (#3275) 2022-11-17 14:37:48 +01:00
vis2k
c750851ac4 [RequireComponent(typeof(NetworkTransform))] tags disabled to support both NTs 2022-11-13 18:27:37 +01:00
vis2k
9b39e31e8a feature: perf: NetworkTransform V3 (Reliable) 2022-11-13 18:09:04 +01:00
vis2k
5f251f00ed rename NetworkTransform V2 folder 2022-11-13 17:59:54 +01:00
vis2k
c4ca2734fa NetworkServer.GetEntitySerializationForConnection renamed to SerializeForConnection (shorter) 2022-11-13 16:13:22 +01:00
mischa
260aaf6f8c
perf: bundle Rpcs together for each connection. saves 2 bytes of Rpc message headers per Rpc (#3257)
* buffer TargetRpcs

* buffer Rpcs

* TODO

* readonly

* ok

* better

* ensure max

* parse on client

* fix size

* oops

* adjust test
2022-11-12 12:53:42 +01:00
vis2k
a9e63724e3 remove old comment 2022-11-11 21:55:27 +01:00
vis2k
b04e8e681a SetSyncObjectDirtyBit helper function 2022-11-11 21:07:05 +01:00
vis2k
41ef03fff5 OnStartLocalPlayer multiple calls workaround explained 2022-11-11 18:49:43 +01:00
vis2k
7e1a579ff2 OnStartLocalPlayer initialization moved to NetworkClient 2022-11-11 18:25:16 +01:00
vis2k
ce819e253a OnStartClient initializations moved to NetworkClient 2022-11-11 18:19:04 +01:00
vis2k
8d7b3ec89b NetworkClient.CheckForStartClient to prepare for OnStartClient cleanup 2022-11-11 18:18:37 +01:00
vis2k
0c116e29f2 perf: NetworkIdentity.observers is now always initialized. removes extra null checks everywhere. 2022-11-10 21:09:29 +01:00
vis2k
264a652abe use explicit type 2022-11-10 20:49:45 +01:00
vis2k
940a467035 SendToReadyObservers: use explicit type 2022-11-10 20:47:12 +01:00
vis2k
5ffdd06602 OnStartServer isClient assignment moved to caller NetworkServer 2022-11-10 20:27:15 +01:00
vis2k
2c40b15a08 syntax 2022-11-10 20:27:01 +01:00
vis2k
75e7af1312 OnStartServer spawned assignment moved to NetworkServer caller 2022-11-10 20:26:56 +01:00
vis2k
c6df8f01d8 OnStartServer netId assignment moved to NetworkServer caller 2022-11-10 20:26:53 +01:00
vis2k
17d874fee8 OnStartServer netId != 0 check moved to NetworkServer caller 2022-11-10 20:26:49 +01:00
vis2k
e7abbaf531 OnStartServer isLocalPlayer initialization moved to NetworkServer caller 2022-11-10 20:26:34 +01:00
vis2k
f2b0f2bab2 OnStartServer isServer check + initialization moved to NetworkServer for cleaner code 2022-11-10 20:26:29 +01:00
vis2k
d79de6bf0c fix: #3258 NetworkWriter.WriteString now ensures capacity before manually writing into the buffer 2022-11-10 10:57:13 +01:00
vis2k
53a9717334 fix: Unity 2020 support 2022-11-09 15:04:12 +01:00
vis2k
1dada3bb4b MIRROR_2022_10_OR_NEWER 2022-11-09 10:55:50 +01:00
vis2k
3617ffac00 comment updated 2022-11-06 20:32:06 +01:00
vis2k
6315260286 syntax 2022-11-06 19:30:54 +01:00
vis2k
761b70e8e7 remove unused import 2022-11-03 16:16:39 +01:00
vis2k
d021c1a01e TimeSample moved to Tools 2022-11-03 16:15:18 +01:00
vis2k
e6a65bc5b2 breaking: remove SyncVar<T> which was meant to replace [SyncVar]s implementation behind the scenes. this hasn't happened, so we don't actually need it. 2022-11-03 16:09:36 +01:00
vis2k
085ed1da81 NetworkBehaviourSyncVar moved into separate file to keep NetworkBehaviour.cs clean 2022-11-03 15:57:16 +01:00
vis2k
a62452c826 TODO 2022-11-03 15:54:44 +01:00
vis2k
18cc7a0558 Pool moved to Tools 2022-11-03 15:52:39 +01:00
vis2k
a8241e5794 Mathd moved to Tools 2022-11-03 15:52:32 +01:00
vis2k
32561576ec Tools folder to distinguish between Unity integration and standalone algorithms 2022-11-03 15:50:28 +01:00