Commit Graph

907 Commits

Author SHA1 Message Date
vis2k
11750a9e7a
perf: Avoid allocation when reading message payload (#912)
* so far

* syntax

* add test

* more tests

* more tests

* convert messages

* use arraysegment in serialization and handle null case too
2019-06-19 14:11:17 +02:00
Paul Pacheco
dd758cac05 fix: don't convert null arrays to empty array (#913)
* fix: don't convert null arrays to empty array

* Add comments with generated code

* Document array reader

* Improve comments a little bit
2019-06-19 12:03:06 +02:00
vis2k
5ae379d6bb Make ReadBytesAndSize more readable 2019-06-18 19:17:32 +02:00
vis2k
ac5d52062c Rename new Write/Read segment functions to avoid redundant names with Write/ReadSegment that only writes the segment without the size 2019-06-18 19:12:43 +02:00
vis2k
18f035d268
perf: Networkreader nonalloc (#910)
* so far

* write and read strings

* move max to writer

* better

* readchar

* ReadDecimal

* improve ReadDecimal

* remove unused

* BENCHMARK

* add char test

* Update Assets/Mirror/Runtime/NetworkReader.cs

Co-Authored-By: Paul Pacheco <paulpach@gmail.com>

* remove unnecessary return

* simplify char

* reuse ReadByte

* arraysegment support

* fix test

* EndOfStreamException like before

* disable test

* remove test

* add benchmark

* reset scene changes

* read/write decimals without allocating

* remove unused test

* remove FloatConversion class. Use converters directly.

* less magic

* 2 longs instead of 4 ints

* sort

* fix comment

* update error

* update errors

* update error

* syntax

* syntax

* write checks size after getbytes

* syntax

* syntax

* ReadBytes array.copy directly

* adjust error message

* check passed buffer

* better

* better

* ReadString directly from buffer without using a separate stringBuffer

* fix typo

* fix comment
2019-06-18 17:00:27 +02:00
vis2k
535b4d40fa fix: Telepathy updated to latest version (IPv6 fix again) 2019-06-17 17:02:28 +02:00
Paul Pacheco
ff1a2346b4 perf: Optimize interest management (#899)
* perf: Optimize interest management

* Update NetworkIdentity.cs

* Update NetworkIdentity.cs

* Use explicit type

* Cache this set

* Update NetworkIdentity.cs
2019-06-17 16:16:36 +02:00
vis2k
2761ff23f4 fix: Telepathy updated to latest version: Correctly support IPv4 and IPv6 sockets 2019-06-17 10:42:56 +02:00
Paul Pacheco
70a532b5db perf: eliminate string concat during remote method calls (#908)
* perf: eliminate string concat during remote method calls

* perf: params causes an array allocation

* refactor: simpler method hash calculation

* Update NetworkBehaviour.cs
2019-06-17 10:00:51 +02:00
Paul Pacheco
1c18743788 perf: eliminate small allocation on remote calls (#907)
* perf: eliminate small allocation on remote calls

* Update NetworkBehaviour.cs
2019-06-17 09:57:56 +02:00
Paul Pacheco
8f6d4cb22e perf: eliminate boxing with lists (#901) 2019-06-17 09:54:43 +02:00
vis2k
cc6e4f696d fix: Updated Telepathy to latest version to fix IPAddress.Parse error for "localhost" 2019-06-16 11:08:28 +02:00
MichalPetryka
3eaaa773b3 feat: Implement IReadOnlyList<T> in SyncLists (#903) 2019-06-14 08:41:14 -05:00
Paul Pacheco
9d81d49add
refactor: determine element type inside GenerateArrayWriter and Reader (#902) 2019-06-14 07:56:27 -05:00
MichalPetryka
e5eecbff72 feat: support sending and receiving ArraySegment<byte> (#898)
Add ArraySegment<byte> support to the weaver
2019-06-13 09:03:54 -05:00
Paul Pacheco
954a3d594d feat: user friendly weaver error (#896) 2019-06-09 09:02:23 +02:00
vis2k
f39cdede98 Telepathy updated to latest version (IPv6 support) 2019-06-06 20:44:18 +02:00
gyststarblayze
3ec3d02362 fix: #840 by allowing Mirror to respect the forceHidden flag (#893)
* fix: #840 by allowing Mirror to respect the forceHidden flag on NetworkProximityChecker

* Update NetworkProximityChecker.cs
2019-06-06 08:39:35 +02:00
vis2k
9ff7feda9a NetworkTransform.DrawLineBetweenDataPoints actually uses the color parameter now 2019-06-04 10:56:38 +02:00
vis2k
36be83d6fd NetworkTransform: use local position and rotation for VR support. Fixes #779 2019-06-04 10:56:38 +02:00
vis2k
cb3d3dba72 Fix: TelepathyTransport.GetMaxPacketSize uses the new configurable max size 2019-06-04 10:07:24 +02:00
Alexander Seeck
fc181cb4ab ASMDEF for Examples (#850)
* updated readme

* added asmdefs

* removed wrong change
2019-05-29 16:41:14 +02:00
Tom KRIKORIAN
d65bdde956 Spawn objects in local space instead of world space for VR support (#875)
* Spawn objects in local space instead of world space

Allow games where world origin is different for each players (Augmented reality for example) to spawn objects at the right position in the scene.

* Update ClientScene.cs

* Update NetworkServer.cs
2019-05-29 16:25:15 +02:00
MichalPetryka
55b6167061 Rename types according to Microsofts naming (#882) 2019-05-25 08:33:43 -05:00
MichalPetryka
b0426f90d3 Set parent in initialize (#884) 2019-05-24 09:24:37 +02:00
MichalPetryka
42a8f2afab Remove conditional accesses on unity objects (#880) 2019-05-24 09:11:38 +02:00
Zac North
3c60b08762 fix(websocket): Remove send queues (they never worked) and SSL (temporarily) (#879) 2019-05-20 10:11:07 +02:00
vis2k
46eddc01ec fix: (again) Telepathy updated to latest version (Send SocketExceptions now disconnect the player too) 2019-05-15 10:23:52 +02:00
vis2k
98d3fb0c31 fix: Telepathy updated to latest version (Send SocketExceptions now disconnect the player too) 2019-05-14 13:40:23 +02:00
Tom KRIKORIAN
691583e844 fix(NetworkManager) : properly load scene on clients using new load parameters (#867)
* fix : properly load scene on clients using new load parameters

* revert change to ClientChangeScene to avoid conflict

* Simplified code for NetworkManager method ClientChangeScene
2019-05-07 17:49:28 +02:00
Coburn
6fd3fb4ca3 This fixes NetworkManager not switching to the correct server scene when onlineScene is not the same as offlineScene. 99.99% sure it'll fix issue #865 (#866) 2019-05-07 17:33:01 +02:00
Gabe Brown
6af979c967 Logging Improvements (#864) 2019-05-07 09:34:32 +02:00
MrGadget
e9f2f538ca Add channelId to Send Method (#862)
This is to achieve parity with NetworkConnection:

```cs
public virtual bool Send<T>(T msg, int channelId = Channels.DefaultReliable) where T: IMessageBase
{
    // pack message and send
    byte[] message = MessagePacker.Pack(msg);
    return SendBytes(message, channelId);
}
```
2019-05-06 18:46:24 +02:00
Paul Pacheco
d4595df2ca clear resharper error (#861) 2019-05-05 15:45:46 +02:00
vis2k
23e440bd0b fix #857: Revert "fix(websocket): Use a buffer for most WS messages in WebGL client resulting in 0 alloc for most messages (#848)"
This reverts commit 8967a20244.
2019-05-05 09:24:46 +02:00
Zac North
1dc45f5376 Fix missing semicolon in NetworkBehaviour.cs (#856) 2019-05-05 00:36:46 +02:00
uwee
d48a3757da feat(scene): Add support for scene loading params (#644)
* add scene and physics mode to SceneMessage

* Change variable names. Added comments. Changed type from struct to byte

* updated test to match

* added overrides to support scene params

* simplified param useage

* fixed types with proper casting

* forgot to add in Server side of code

* Update Assets/Mirror/Runtime/NetworkManager.cs

Co-Authored-By: uweenukr <uweenukr@gmail.com>

* Update Assets/Mirror/Runtime/NetworkManager.cs

Co-Authored-By: uweenukr <uweenukr@gmail.com>

* serialize as byte
2019-05-04 17:45:26 +02:00
Zac North
8967a20244 fix(websocket): Use a buffer for most WS messages in WebGL client resulting in 0 alloc for most messages (#848)
* fix(websocket): Use a buffer for most WS messages resulting in 0 alloc for most messages

* Use a configurable maximum message size

* Use the maximum message size on the server too

* Use <= instead of < for buffer.Length

* Show lengths in Exception message

Co-Authored-By: Katori <znorth@gmail.com>

* Show lengths in close message

Co-Authored-By: Katori <znorth@gmail.com>

* Allow messages of messagesize

Co-Authored-By: Katori <znorth@gmail.com>

* Allow messages of maxMessageSize

Co-Authored-By: Katori <znorth@gmail.com>

* Show message lengths in close message

Co-Authored-By: Katori <znorth@gmail.com>

* Don't initialize buffer if already done

Co-Authored-By: Katori <znorth@gmail.com>

* Always allocate buffer size on client construction

* Use a non-static buffer to avoid allocation issues
2019-05-04 12:08:23 +02:00
MichalPetryka
e22f527eef Fix ?? (#854)
* Fix ??

?? doesn't work on unitys objects

* Update NetworkBehaviour.cs
2019-05-04 11:30:45 +02:00
MrGadget
f618e17366 Avoid memory leak from cloned materials (#853) 2019-05-01 19:47:53 +02:00
MrGadget
a18ab9db8f
Update README.md
Revised information in case MainScene was inadvertently changed without proper setup.
2019-05-01 09:50:30 -04:00
vis2k
227cc62475 Telepathy updated to latest version (removed send header & payload allocations) 2019-04-29 14:18:31 +02:00
vis2k
30ee71a6f8 Telepathy updated to latest version (removed header allocations) 2019-04-29 12:58:47 +02:00
vis2k
77bee450b9 perf: Transports now give ArraySegment<byte> instead of byte[] (based on #569 and #846)
perf: Transports now give ArraySegment<byte> instead of byte[] (based on #569 and #846)
2019-04-28 21:08:19 +02:00
vis2k
6c4b34ba06 fix: ListServer Ping not found in WebGL 2019-04-28 20:49:20 +02:00
vis2k
e8a8e77016 Telepathy updated to latest version (Message converted to struct to minimize GC) 2019-04-28 13:36:28 +02:00
vis2k
1f07af0cae fix: Revert "refactor: consolidate prefab and spawn handlers (#817)" to fix a bug where if editor=host, build=client, we receive scene object not found when walking out of and back into an observer's range
This reverts commit b4c9c6fdc8.
2019-04-24 17:04:28 +02:00
vis2k
5480548ffa add comment 2019-04-24 13:11:36 +02:00
vis2k
f56507f2fc fix: Revert "NetworkIdentity.observers dictionary is always created, but always empty on clients. Gets rid of all null checks." to fix server-only bug not allowing movement on client, e.g. in uMMORPG
This reverts commit e8d9d852e3.
2019-04-24 13:08:10 +02:00
Zac North
0484a50e6d Use queue for Ping and Pong messages as well (#841) 2019-04-24 09:28:34 +02:00
Zac North
5aa7148c60 Use message queue instead of SemaphoreSlim - SemaphoreSlim was severely bottlenecking performance (#839) 2019-04-23 10:23:47 +02:00
Coburn
2695da4e2a LLAPI Transport not available on WSA/UWP (v2) (#838)
* LLAPITransport will not be available for WSA/UWP applications with this patch. (LLAPI never was to begin with).

* v2 of the not allowing LLAPI Transport to be available on UWP/WSA games
2019-04-22 11:15:17 +02:00
Coburn
7058de2364 LLAPITransport will not be available for WSA/UWP applications with this patch. (LLAPI never was to begin with). (#837) 2019-04-22 09:34:36 +02:00
vis2k
92a9903b0d Disable sceneid assignment message 2019-04-22 09:23:36 +02:00
Zac North
2d682b5fad fix(websocket): #829 fix InvalidOperationException with wss:// (#830)
* fix(wss): Use a queue on the server to avoid "InvalidOperationException: Invalid nested call."

* Remove unnecessary "private"

Co-Authored-By: Katori <znorth@gmail.com>

* Remove unnecessary "private"

Co-Authored-By: Katori <znorth@gmail.com>

* Update Server.cs

* comment: explain what is going on here

* comments:  better comment

* Move queue into WebSocketImplementation instead of Server-specific

* Remove unused variables in Server

* Use a SemaphoreSlim instead of queue system
2019-04-21 10:33:07 +02:00
vis2k
52625923b2
fix: Mono.CecilX namespace to work around Unity 2019 Cecil namespace collision (#832)
* fix: Mono.CecilX namespace to work around Unity 2019 Cecil namespace collision

* rename dlls

* change asmdef guid for conflict with hlapi

* rename assemblynames too

* fix: invalid scene id in 2019.1 by ignoring prefabs in NetworkScenePostProcess

* rename projects too
2019-04-20 21:01:10 +02:00
vis2k
203a823b19 fix: invalid scene id in 2019.1 by ignoring prefabs in NetworkScenePostProcess 2019-04-20 20:39:44 +02:00
vis2k
b20c0d91f7 syntax 2019-04-19 09:28:39 +02:00
MrGadget
bcd3424c0e refactor: Simplify GetStartPosition (#828)
* Simplify GetStartPosition

- Early out if startPositions.Count = 0
- Reduces the normal returns to single LOC each
- Only resets startPositionIndex if it reaches int.MaxValue
- Uses modulo and increment-after against count to pick round robin index
- Eliminates unnecessary last return that could never be reached

* Per Paul's request
2019-04-18 15:20:08 -05:00
MrGadget
8ebda0fa21 fix: Respect Player Prefab Position & Rotation (#825)
Respect Player Prefab Position & Rotation
2019-04-18 07:13:38 -05:00
vis2k
e8d9d852e3 NetworkIdentity.observers dictionary is always created, but always empty on clients. Gets rid of all null checks. 2019-04-17 23:04:52 +02:00
vis2k
aa4a91bcce remove whitespace 2019-04-17 22:42:56 +02:00
Paul Pacheco
b4c9c6fdc8 refactor: consolidate prefab and spawn handlers (#817) 2019-04-17 16:00:03 +02:00
vis2k
b5ff43ada3 feat: SyncList.FindIndex added (#823) 2019-04-17 06:18:23 -05:00
MichalPetryka
2327498b31 Remove vars (#819) 2019-04-16 12:38:48 +02:00
MichalPetryka
6eaea267d5 Remove useless out (#820) 2019-04-16 12:38:22 +02:00
MichalPetryka
3b5fa051c1 Inline out (#818) 2019-04-16 12:38:01 +02:00
vis2k
3452915a4e NetworkConnection.TransportReceive: don't try to invoke if unpacking failed. 2019-04-15 15:08:55 +02:00
Paul Pacheco
1352334747 fix: non ready connections should not observe objects 2019-04-15 07:32:41 -05:00
Paul Pacheco
e69c0976a2 refactor: Simplify nested if 2019-04-15 06:30:41 -05:00
Paul Pacheco
97f8bf6b26 refactor: use null propagation operator 2019-04-14 11:04:23 -05:00
Paul Pacheco
af0f79be14 refactor: removed unreachable if 2019-04-14 10:17:29 -05:00
Paul Pacheco
7417b68671 fix: check event prefix 2019-04-14 10:06:36 -05:00
Paul Pacheco
2598389036 refactor: use null propagation operator 2019-04-14 07:58:53 -05:00
MichalPetryka
fea09a6b74 Improve SceneID generation via RNGCryptoServiceProvider (#812)
* Improve SceneID generation

* Update NetworkIdentity.cs
2019-04-14 14:17:25 +02:00
vis2k
b9247a78b6 out syntax 2019-04-14 12:43:05 +02:00
vis2k
f3f0ef299e clear sceneid if it was a duplicate 2019-04-14 12:40:16 +02:00
vis2k
3ebd4981a4 only use generated sceneId if not duplicate 2019-04-14 12:39:48 +02:00
MrGadget
705194023c Remove all "private" (#807) 2019-04-14 09:43:03 +02:00
MrGadget
08cc3236a1 Fix Additive Example Scene Lighting (#808) 2019-04-13 21:41:46 +02:00
c6burns
3a50ca6352 fix: added new read/write symbol params (#806)
fix: added new read/write symbol params
2019-04-12 16:00:46 -05:00
vis2k
27b7e250a0 perf: OnDeserializeSafely without GC (#804) 2019-04-12 08:38:23 -05:00
vis2k
19a9995501 remove whitespace 2019-04-12 15:31:05 +02:00
vis2k
a82367b2c6 remove caching to keep it simple for now 2019-04-12 11:57:47 +02:00
vis2k
80d72c804d remove empty whitespace 2019-04-12 11:55:22 +02:00
vis2k
7e79dfad38 disable 'Weaving succeeded' message now that everything works 2019-04-12 11:55:09 +02:00
c6burns
3ba546e133 fix: #791 corrected assembly paths passed to weaver (#803)
* fixed incorrect assembly paths

* Update CompilationFinishedHook.cs
2019-04-12 11:52:35 +02:00
vis2k
2eb247a6d2 Cecil StackOverflow fix without breaking API (https://github.com/vis2k/cecil/commits/TypeReference_Resolve_StackOverFlow_Fix) 2019-04-12 11:23:44 +02:00
vis2k
0f1522229e remove empty whitespace 2019-04-11 22:09:25 +02:00
vis2k
eb4b2f40c5 Weaver.ImportCorLibType: avoid MixIn exception when calling ImportReference with a null type. Log the type that we failed to resolve instead. 2019-04-11 22:09:14 +02:00
vis2k
286983a8f8 Fix StackOverflowException for NetStandard in Mono.Cecil by using https://github.com/vis2k/cecil/tree/TypeReference_Resolve_StackOverFlow_Fix 2019-04-11 21:57:14 +02:00
vis2k
9f67b4761f Rebuild Cecil 0.10.3 DLLs from scratch via net4_0_Release mode 2019-04-11 20:10:43 +02:00
c6burns
9d4b96975e minimum changeset for cecil 0.10.3 (#795)
* added fixes for cecil 0.10.3

* added missing meta

* fix typo'd asmresolver

* accept paul's suggestion, on behalf of c6

Co-Authored-By: rodolphito <rodol@rivalrebels.com>
2019-04-11 19:59:37 +02:00
vis2k
ec5ceb1149 update CompilationFinishedHook comment about cecil bug 2019-04-11 18:52:41 +02:00
Chris Langsenkamp
d46334d2eb Add meta files for dummies 2019-04-11 11:22:40 -05:00
MrGadget
534a5a5834 Dummy NetworkAnimatorEditor 2019-04-11 07:22:01 -05:00
MrGadget
1dfd2dad6e Dummy SyncListInitializer.cs 2019-04-11 07:21:44 -05:00
MrGadget
75e4f159e5 fix: Dummy file for SyncListStructProcessor.cs (#798)
Dummy file for SyncListStructProcessor.cs to avoid breaking compilation
2019-04-11 06:55:35 -05:00
MrGadget
b7e94d9e5a
Fixed typo 2019-04-11 07:44:41 -04:00
vis2k
bdbbed8b9d
Remove OwnerMessage to fix a bug where isLocalPlayer isn't reliable when checking it in Start() because OwnerMessage was received after SpawnFinished message (#793) 2019-04-11 00:01:31 +02:00