Commit Graph

2730 Commits

Author SHA1 Message Date
James Frowen
38907e63d9
fixing typo (#2434) 2020-11-15 20:40:45 +00:00
vis2k
fcd1394061
MessagePacker.UnpackMessage renamed to Unpack for consistency with Pack and because the class is already named MessagePacker anyway (#2430) 2020-11-16 02:42:01 +08:00
vis2k
14ae0d094d
MessageHandler.MessageHandler renamed to WrapHandler because that's what it does. (#2431) 2020-11-16 01:48:33 +08:00
vis2k
1e9a3b03de add comment 2020-11-16 00:43:48 +08:00
vis2k
ca29bcebe5 MessagePacker.Unpack<T> moved to MessagePackerTests because it's only used for tests 2020-11-15 16:41:38 +08:00
vis2k
cf9025bff7 Synta 2020-11-15 16:41:38 +08:00
James Frowen
3727e36b74
weaver removing unneeded ImportReference (#2429) 2020-11-14 23:55:44 +00:00
MrGadget1024
b14daba289 Removed Telepathy from example that I added by accident 2020-11-14 15:43:14 -05:00
James Frowen
417818d4d6
weaver import typeRefernce when generating readers (#2427)
Importing typeRefernce once before we generate reader
2020-11-14 12:50:21 -06:00
MrGadget1024
2e2fecb20a Minor code cleanup in PlayerControllers 2020-11-14 11:48:28 -05:00
James Frowen
f7b0b88247 removing invalid cref 2020-11-14 16:28:32 +00:00
Paul Pacheco
037ac55937
fix: using mathematics in commands and rpcs (#2425)
Generating readers and writers for structs in other assemblies
could sometimes cause a
```
System.ArgumentException: Member 'xxx' is declared in another module and needs to be imported
```
This in particular affected unity mathematics.

fixes #2406
2020-11-14 10:25:48 -06:00
Paul Pacheco
59ed64f9d0
feat: Provide user friendly error with undefined reader/writer (#2423)
Previously this just gave NRE, which does not help the user address the problem.

provides a better error for #2411
2020-11-14 08:46:53 -06:00
MrGadget1024
d5e162c0d0 Removed Server Only scene object from MultipleAdditiveScenes example 2020-11-14 02:26:19 -05:00
MrGadget1024
7ea55ce935 Added server checks to ZoneHandler 2020-11-14 01:00:06 -05:00
MrGadget1024
e9286b8259 Added server checks to Spawner 2020-11-14 00:58:42 -05:00
MrGadget1024
263b88d24d Removed Server Only Scene Object from Room Example
Spawner now has static property and methods and doesn't need to be on any networked object.
2020-11-14 00:03:19 -05:00
MrGadget1024
474b2ddf06 Removed Server Only Scene Object from Additive Scenes Example 2020-11-13 23:01:30 -05:00
vis2k
218492a921 NetworkServerTests: UpdateDetectsNullEntryInSpawned 2020-11-13 20:13:35 +01:00
vis2k
b957ab7818 better name 2020-11-13 20:10:45 +01:00
vis2k
d21d501bd0 NetworkServerTests: UpdateWithNullEntryInSpawned 2020-11-13 20:05:41 +01:00
vis2k
0f96e8ce6b
Pool<T>; NetworkReader/WriterPools simplified by using Pool<T> (#2414)
* Pool & Tests

* NetworkWriterPool simplified: uses Pool<T>

* NetworkReaderPool simplified: uses Pool<T>
2020-11-13 19:22:03 +01:00
JesusLuvsYooh
3e21f76d4a
Round trip time bool and tooltip. (#2419)
* Round trip time bool and tooltip.

I've added this RTT boolean and a tooltip, might clear up some confusion for future users.
Many believe ping is time to server, and rtt is ping pong.

* Round trip time bool and tooltip.

I've added this RTT boolean and a tooltip, might clear up some confusion for future users.
Many believe ping is time to server, and rtt is ping pong.

* Round trip time bool and tooltip.

I've added this RTT boolean and a tooltip, might clear up some confusion for future users.
Many believe ping is time to server, and rtt is ping pong.

* Round trip time bool and tooltip.

I've added this RTT boolean and a tooltip, might clear up some confusion for future users.
Many believe ping is time to server, and rtt is ping pong.
2020-11-12 17:02:57 +01:00
MrGadget1024
35b61749d1 Updated PreprocessorDefine & ProjectSettings version to 28
This should have been done with PR #2413
2020-11-11 08:53:43 -05:00
vis2k
9c6c5d760c
breaking: Force networkmessage as struct everywhere. Redundant MessagePacker.GetId(type) not needed anymore (#2413)
* breaking: Force NetworkMessage as struct everywhere

* Redundant GetId(type) is not needed anymore
2020-11-11 09:48:03 +01:00
James Frowen
6d4aeaf3e3 fix(SimpleWebTransport): Error event should now correctly be called 2020-11-11 00:42:47 +00:00
MrGadget1024
581dacaaa5 Updated PreprocessorDefine & ProjectSettings version to 27
This should have been done in PR #2400
2020-11-10 18:26:26 -05:00
MrGadget1024
0fdf54dd34 Updated metas for Icosphere 2020-11-10 18:06:33 -05:00
MrGadget1024
2f9b423d41 Added tooltip 2020-11-10 17:48:16 -05:00
vis2k
1ecf57a2f0 Tests: remove unnecessary empty NetworkMessage serialization methods. Weaver takes care of it. 2020-11-10 10:27:35 +01:00
vis2k
2b02fa0130 kcp2k V1.2: smaller fixes, max message size increased from 1200 bytes to 145KB 2020-11-09 21:15:36 +01:00
Martin Bozek
4bb202fddc
feat: Change NetworkPingDisplay settings at runtime (#2396)
* making fields public
* adding format for text
* updating style each frame to update when it is changed
2020-11-09 18:11:13 +00:00
JesusLuvsYooh
a57c47d5f6
Adjusted KCP tooltip typo. (#2409)
Changed the default 100ms to 10ms
Double checked with Vis in Discord  "tooltip is meant to say 10ms."
Already seen one screenshot of a Discord user that set this from 10 to 100, due to the typo, believing 100 was meant to be default and not 10.
2020-11-09 08:24:12 -05:00
MrGadget1024
fd8c227812 Renamed private method to correct spelling. 2020-11-08 21:36:22 -05:00
vis2k
7eaeb07642 fix: flaky Weaver tests. Read/WritePacked removed for good 2020-11-08 18:34:20 +01:00
vis2k
91d365fa13 Tests: NetworkMatchCheckerTest telepathy obsolete warning fixed. uses MemoryTransport now 2020-11-08 17:00:39 +01:00
vis2k
ab71bdbc62
breaking: Obsolete Read/WritePacked functions and use the regular ones everywhere. We are not bandwidth limited but CPU limited, so this is good. Those were overly complex and worst of all they cause non deterministic packet sizes. a player packet might spawn fine in editor, but 1 month into production it might very well hit the 1200 MTU limit if health is suddenly >241 or the Vector2Int position is somewhere else. This was insanity. (#2400)
* NetworkWriter consistency: Write(U)Ints moved to static extension methods for consistency with all the other writer functions like WriteUInt16.
This makes life easier because weaver looks for all Write(U)Int functions in the same place. Otherwise packed writes can't be removed in a later PR without breaking weaver (which is also evidence for being bad design before)

* NetworkReader consistency: removed redundant Read(U)Ints

* breaking: Obsolete Read/WritePacked functions and use the regular ones everywhere. We are not bandwidth limited but CPU limited, so this is good. Those were overly complex and worst of all they cause non deterministic packet sizes. a player packet might spawn fine in editor, but 1 month into production it might very well hit the 1200 MTU limit if health is suddenly >241 or the Vector2Int position is somewhere else. This was insanity.
2020-11-08 15:59:09 +01:00
vis2k
a857707321
Networkwriter consistency (#2399)
* NetworkWriter consistency: Write(U)Ints moved to static extension methods for consistency with all the other writer functions like WriteUInt16.
This makes life easier because weaver looks for all Write(U)Int functions in the same place. Otherwise packed writes can't be removed in a later PR without breaking weaver (which is also evidence for being bad design before)

* NetworkReader consistency: removed redundant Read(U)Ints
2020-11-07 17:49:12 +01:00
vis2k
06e2d7ceda remove unused import 2020-11-07 14:49:04 +01:00
vis2k
1c471feffd life is better with semicolons 2020-11-07 13:54:58 +01:00
Sulexa
4d8b02ce35
prevent multiple client or server to start (#2398)
* Return and log warning on start already started client or server

* Apply suggestions from code review, Always check for client and server active state

Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>

* Update Assets/Mirror/Runtime/NetworkManager.cs

* Update Assets/Mirror/Runtime/NetworkManager.cs

* Update Assets/Mirror/Runtime/NetworkManager.cs

* Update Assets/Mirror/Runtime/NetworkManager.cs

* Update Assets/Mirror/Runtime/NetworkManager.cs

* Update Assets/Mirror/Runtime/NetworkManager.cs

Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
Co-authored-by: vis2k <info@noobtuts.com>
2020-11-07 10:13:47 +01:00
James Frowen
dbd1afe53b
fix(MiddlewareTransport): making sure MiddlewareTransport listens for inner events (#2386)
* making sure events are called

* full tests for middleware Transport
2020-11-07 02:10:44 +00:00
MrGadget1024
0bf6d91357 Reset scenes for 2018.4.28f and removed obsolete components on cameras 2020-11-04 08:59:41 -05:00
MrGadget
4e742d48a5
Adding Obsolete attribute to Telepathy Transport (#2392)
* Adding Obsolete attribute to Telepathy Transport

* doc: fixed bad link in Transports TOC

Co-authored-by: MrGadget1024 <chris@clevertech.net>
2020-11-03 21:41:24 +01:00
MrGadget1024
2594aeb49f Reset Basic Example Scene back to 2018.4 Compatibility 2020-11-02 10:44:14 -05:00
MrGadget
5b64ce425e
fix: Examples No Longer Rely On Sequential connectionId (#2387)
* NetworkRoomManager

* Basic Example

* Room Example

* MultipleAdditiveScenes Example

* Removed unused usings

* Removed redundant initializer

* Removed redundant initializer

* Renamed playerNo to playerNumber

Co-authored-by: MrGadget1024 <chris@clevertech.net>
2020-11-02 15:46:01 +01:00
MrGadget1024
87412477dc Spawn prizes as child of spawner directly in correct additive scene instance 2020-11-02 01:27:49 -05:00
MrGadget1024
3aad58a95f Removed the +1 in MultiSceneNetManager 2020-11-01 19:12:25 -05:00
MrGadget1024
7560a4c274 Updated MultipleAdditveScenes Example
Added Comments
Organized methods
Renamed private Coroutines for cognitive
Improved the delayed AddPlayer
2020-11-01 15:55:40 -05:00
James Frowen
bc72810e55
fix: fixing first import of package (#2384)
* removing #if MIRROR

* removing #if MIRROR_26_0_OR_NEWER

* Update KcpTransport.cs

Co-authored-by: vis2k <info@noobtuts.com>
2020-11-01 18:50:06 +01:00
vis2k
27c034c33c remove old meta file 2020-11-01 18:46:46 +01:00
James Frowen
6971125c7f
adding asmdef to kcp2k folder (#2385)
* adding kcp2k asmdef

marked with allowUnsafeCode

* adding reference to new kcp2k asmdef, and unmarking allowUnsafeCode

* adding public gettings for list/queue count

* Update Assets/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs

Co-authored-by: vis2k <info@noobtuts.com>
2020-11-01 18:20:07 +01:00
James Frowen
42c8de9322 docs: fixing list header xml 2020-11-01 16:39:43 +00:00
MrGadget1024
1f3c2d26db Added .ToString("X") to sceneId logging 2020-11-01 01:03:06 -05:00
MrGadget1024
19fcdd40d8 Added Mirror\Tests\Editor\Weaver\bin.meta 2020-11-01 00:41:39 -04:00
MrGadget1024
17413bd257 Added .ToString("X") to sceneId logging 2020-11-01 00:40:42 -04:00
MrGadget1024
0c37a4d794 Updated NetworkIdentity comments 2020-11-01 00:16:16 -04:00
MrGadget1024
f95b0c40af Updated NetworkIdentity comments 2020-10-31 23:14:58 -04:00
James Frowen
bbb61848be
feat: Quaternion and float Compression (#2368)
Adding compression methods for Quaternion and floats. These methods can be used to decrease size of Quaternions before sending the value over the network.

ScaleToUInt method can be used to compress float from 32 bits to the range given to the method. This can be used to compress Vector3 if the bounds of the world are known and fixed before runtime.
2020-11-01 02:33:24 +00:00
James Frowen
9182b32946 feat(SimpleWebTransport): adding option to configure handshakeMaxSize 2020-11-01 02:12:16 +00:00
James Frowen
f35b7ed81e
fix: fixing sceneId when using BuildPipeline.BuildPlayer with incorrect case in path (#2382)
* fix: fixing sceneId when using BuildPipeline.BuildPlayer with incorrect case in path

 BuildPipeline.BuildPlayer takes an array of strings for scene paths. Unity will find the scene with the path case insensitive but path case is case sensitive.

This change would make it so that these 2 paths have the same hash
```
Assets/Scenes/Forest.unity
Assets/Scenes/forest.unity
```

* Adding full comment for ToLower

* Update NetworkIdentity.cs

Co-authored-by: vis2k <info@noobtuts.com>
2020-10-30 18:41:32 +01:00
vis2k
0c2ad96061
feat: KCP Transport (https://github.com/vis2k/kcp2k) (#2381) 2020-10-30 13:53:13 +01:00
vis2k
88e160a5f7 Tests: NetworkManagerStopHostOnServerDisconnectTest uses MemoryTransport now 2020-10-30 13:51:25 +01:00
James Frowen
1d6b33c49b fix(SimpleWebTransport): version 0.6.6
Fixes:
* fixing problem in 0.6.3
* updating transport for mirror v26
2020-10-29 22:08:18 +00:00
vis2k
f08aa636ad add Mirror V26 preprocessor define 2020-10-29 20:18:23 +01:00
vis2k
bbec123eff
breaking: Transport.Send(connectionId) instead of List<connectionId>, and return type changed to void. The List was only there to avoid LLAPI & Telepathy allocations. It makes everything extremely complicated and it's not necessary for any of the newer transports anymore. (#2380) 2020-10-29 17:10:57 +01:00
James Frowen
151185e9c5
fix(NetworkAnimator): fixing trigger not applied on host
Triggers should now be applied on host when other clients have authority of the object
2020-10-29 15:45:00 +00:00
vis2k
78862ee989 Revert Tanks modifications. Keep it simple. 2020-10-29 13:16:41 +01:00
James Frowen
cd36ed5ae4
fixing compile error
2nd PR merged messed up, removing 2nd clientAuthorityBeforeTeleport
2020-10-28 13:52:49 +00:00
James Frowen
82faac5011
splitting up Update method (#2375)
Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
2020-10-27 22:54:56 -04:00
James Frowen
b1d99601eb
Moving variable to top of file. (#2376)
It is best practice to put variables above all methods in c#
2020-10-27 22:46:23 -04:00
James Frowen
c1e63d4078 fix(SimpleWebTransport): v0.6.3
* fixing error where standalone client would not correctly stop after failing to connect
* using ASCII encoding to follow RFC spec
2020-10-28 01:46:22 +00:00
MrGadget1024
cea165addb Changed to use localSpace 2020-10-27 20:11:47 -04:00
MrGadget1024
a9efaf1ad2 Added ServerTeleport to Experimental NetworkTransform 2020-10-27 19:53:23 -04:00
MrGadget1024
c306a9d5ef fixed typo 2020-10-27 19:52:34 -04:00
James Frowen
8e772a2077
fix(weaver): Fixing weaver not writing when assemble didn't have NetworkBehaviour (#2373)
* Making ReaderWriterProcessor return if it found custom functions (not counting ones in mirror.dll)
* Always writing generateContainerClass if modified
* processing PropertySiteProcessor if either ReaderWriterProcessor or WeaveModule are successful
* creating generateContainerClass in WeaverList constructor
* Moving new WeaverList to after WeaverTypes.SetupTargetTypes
2020-10-26 15:51:38 +01:00
James Frowen
4efd19c4ff
feat: Middleware transport (#2362)
* feat: adding MiddlewareTransport

* Allows Middleware to be created at the transport layer
* Middleware can choice which methods they want to override and which to let inner handle

* using expression bodies
2020-10-25 21:42:00 +01:00
MrGadget1024
4628685a62 fixed outdated comment 2020-10-25 15:25:34 -04:00
MrGadget1024
8c08ecf84d Empty braces on same line 2020-10-25 13:44:07 -04:00
MrGadget
75ce277a68
Add Accept and Reject methods to Authenticator (#2370)
* Add Accept and Reject methods to Authenticator

* Tabs To Spaces

* Removed `base.`

Co-authored-by: MrGadget1024 <chris@clevertech.net>
2020-10-25 12:55:29 -04:00
James Frowen
b19a8ccd12 fix(SimpleWebTransport): making sure that ReadHelper.Read reads exactly number of bytes
Docs say that stream.Read could return less than length. Keep reading stream untill length is reached.
2020-10-25 16:05:35 +00:00
James Frowen
414030d023
fix: making ClientAuthorityCallback an event (#2363)
* stops error prone behaviour of using = from multiple scripts

BREAKING CHANGE: `= callback` now needs to be `+= callback`
2020-10-25 17:01:53 +01:00
MrGadget
8f4ff423cb
Basic Authenticator code organization and comments (#2369)
Co-authored-by: MrGadget1024 <chris@clevertech.net>
2020-10-25 09:52:16 -04:00
James Frowen
a833f5c29f
Running code clean up (#2364)
* removing un-needed using
* whitespace
* using explicit types
2020-10-24 20:24:54 +01:00
James Frowen
28fc75140c
fix: improving errors in SendTargetRPCInternal (#2358)
* fix: improving errors in SendTargetRPCInternal

* now give error when connection is null
* updating error message to accurately explain what went wrong
2020-10-24 20:18:59 +01:00
MrGadget
77c844184e
Remove Obsoletes (#2361)
BREAKING CHANGE: Removed Obsolete Methods and Tests
2020-10-24 11:36:44 -05:00
MrGadget1024
60bc1555a5 Added Deprecated date to SyncList 2020-10-24 11:37:54 -04:00
MrGadget
749c9ee970
Make SerializeSyncVars & DeserializeSyncVars protected virtual (#2360)
Co-authored-by: MrGadget1024 <chris@clevertech.net>
2020-10-24 16:18:31 +02:00
MrGadget
cf3cf6a1ab
Remove EditorBrowsable Never Attributes (#2359)
Co-authored-by: MrGadget1024 <chris@clevertech.net>
2020-10-24 16:18:05 +02:00
James Frowen
0c6b63a2b1 simpleweb refactor changes 2020-10-22 19:13:58 +01:00
vis2k
d940db7e65 fix: #2357 (the second bug): NetworkServer.DisconnectAllConnections now iterates a copy of connections.Values to InvalidOperationException in cases where Transport.ServerDisconnect calls Mirror's OnServerDisconnect event immediately, which calls NetworkServer.OnDisconnected(connectionId), which would remove the connection while DisconnectAllConnections is iterating over them. 2020-10-22 11:36:18 +02:00
James Frowen
06ae90878d
Removing IDisposable from NetworkConnection (#2345)
* clientOwnedObjects is a hash set which doesn't need to be disposed
* DestroyOwnedObjects already clears list which is called by networkmanager when connection disconnects

Co-authored-by: vis2k <info@noobtuts.com>
2020-10-22 09:50:37 +02:00
James Frowen
46d8077780
Simplifing IsClientAlive check (#2346)
* moving check to base connection because it could be used for either
* renaming to IsAlive
* passing in timeout so it doesn't need to check NetworkServer
* updating doc comment
2020-10-22 09:48:35 +02:00
Chris Langsenkamp
2439af8c5e Applied Mirror Icon 2020-10-21 17:56:14 -04:00
vis2k
d3f1ee9819 fix: NetworkClient.Disconnect avoids NullReferenceException if Transport ClientDisconnect calls OnDisconnected immediately. Related to: https://github.com/vis2k/Mirror/issues/2353 2020-10-21 20:41:40 +02:00
Paul Pacheco
71dc3a2481 fix: recursive types with collections 2020-10-20 09:47:43 -05:00
Paul Pacheco
3bf41c89ea
simplify serializing collections (#416) (#2348)
The code to serialize lists, arrays, and array segments is now in the runtime instead of generated in the weaver.

removes about 300 LOC of weaver witchcraft
2020-10-20 09:47:00 +02:00
James Frowen
c789e2a510
using null propagation for RemoveOwnedObject (#2347) 2020-10-20 01:33:20 +01:00
James Frowen
25be44840e
checking if incoming message has length 0 before checking its id (#2336) 2020-10-18 23:07:10 +02:00
James Frowen
5eac88aa38 feat: adding NetworkRigidbody2D (#2322)(#2342)
* using angularVelocitySensitivity
* removing un-needed using
* using vec2 instead of vec3
2020-10-17 20:46:58 +01:00