Commit Graph

4477 Commits

Author SHA1 Message Date
vis2k
85be663b13 fix: NetworkClient.Disconnect avoids NullReferenceException if Transport ClientDisconnect calls OnDisconnected immediately. Related to: https://github.com/vis2k/Mirror/issues/2353 2020-10-21 20:40:30 +02:00
James Frowen
ebc9f7a4b3 using null propagation for RemoveOwnedObject (#2347) 2020-10-20 10:04:24 +02:00
Paul Pacheco
09d38977d5 perf: use built in == instead of unity one (#2339)
* perf: use built in == instead of unity one

should be the same performance as #2325 without the complexity

* more readable version

* more readable version
2020-10-20 09:50:04 +02:00
vis2k
7e33203737 GUIConsole from uMMORPG 2020-10-13 17:24:54 +02:00
vis2k
47dd2ef663 perf: NetworkIdentity DirtyComponentsMask code removed entirely. OnSerialize now includes the component index as byte before serializing each component. Faster because we avoid GetDirtyComponentsMask() and GetSyncModeObserversMask() calculations. Increases allowed NetworkBehaviour components from 64 to 255. Bandwidth is now smaller if <8 components, and larger if >8 components. Code is significantly more simple. 2020-10-12 19:12:30 +02:00
vis2k
4c6791852e MemoryTransport GetMaxPacketSize ushort too 2020-10-12 11:13:04 +02:00
vis2k
1c62080e6a breaking: Transport.GetMaxMessageSize ushort to limit it to 64KB. greatly simplifies Mirror allocation logic / checks and this way NetworkWriterPool & NetworkConnectionToClient can always allocate with ushort.max to support all transport. 2020-10-12 11:07:47 +02:00
vis2k
4205abf3fc TelepathyTransport remove obsolete MaxMessageSize property 2020-10-12 11:00:45 +02:00
Paul Pacheco
1d05dfc952 breaking: Users must initialize synclists (#391) (#2330)
* Users must initialize syncobjects (#391)

Previously we initialized syncobjects, so this is valid:
```cs
public class Pepe : NetworkBehavior {

    public SyncList<int> mylist;
}
```

With this change,  users must initialize their own fields:
```cs
public class Pepe : NetworkBehavior {

    public SyncList<int> mylist = new SyncList<int>();
}
```

BREAKING CHANGE: You must initialize all your SyncLists

* Add null check

* This is no longer a weaver error

* Update Assets/Mirror/Runtime/NetworkBehaviour.cs

Co-authored-by: James Frowen <jamesfrowendev@gmail.com>

* Remove unnecesary using

Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
2020-10-12 10:09:14 +02:00
James Frowen
08585c7379 Update NetworkIdentity.cs
checking cache instead of property
2020-10-12 09:38:51 +02:00
James Frowen
fb13773f5d fix: fixing Initializer for generic synclists (#2328)
Weaver should initialize `public SyncList<int> myList;`  in the same way it does for `SyncListInt`
2020-10-12 09:38:17 +02:00
vis2k
d618dcde54 perf: NetworkWriter buffer != null checks removed because it can't be null anymore 2020-10-11 13:16:39 +02:00
vis2k
d4ba961e67 NetworkWriterPool: forgot to remove size check. SizeParameter is const at the moment. 2020-10-11 12:05:50 +02:00
vis2k
7b7586bf1e NetworkReaderPool simplified: now uses Pool<T> 2020-10-11 11:46:17 +02:00
vis2k
def18fb832 perf: NetworkWriter resizing removed. Size is now constant, and NetworkWriterPool was greatly simplified too. 2020-10-11 11:39:40 +02:00
vis2k
fde75efed3 MemoryTransport: avoid 2GB allocations when we do fixed size NetworkReader/Writer Pools 2020-10-11 10:53:08 +02:00
vis2k
cfd748f45e breaking: Transport.GetMaxPacketSize assumes same size for all channels. This will allow for easy NetworkWriter/Reader fixed size caching soon. 2020-10-11 10:46:34 +02:00
vis2k
8ed68cdab2 Benchmark: custom NetworkManager with adjustable spawn amount for easier testing 2020-10-10 12:35:06 +02:00
vis2k
b092b15f98 Benchmark: namespace changed from OneK to Benchmark 2020-10-10 12:27:35 +02:00
vis2k
6ea4cb3271 4k Benchmark: SpawnPosition renamed and centered at 0,0,0 2020-10-10 12:25:23 +02:00
vis2k
af99df3c4a Batching: respect channelId 2020-10-10 10:46:07 +02:00
vis2k
4b9a731fc3 perf: Batching. Mirror will batch up to Transport.GetMaxPacketSize messages into one batch and then send them all at once. Reduces transport calls by a factor of ~1000x assuming average of 64 byte message with Telepathy 64kb MaxMessageSize. 2020-10-10 10:19:15 +02:00
vis2k
fa53fa60f8 Unity 2020.1 for Editor in release mode (nearly doubles performance) 2020-10-08 15:38:47 +02:00
vis2k
7bc8a4773a perf: NetworkBehaviour.netIdentity cache: use bool instead of null check for significant performance improvement in 4k benchmark 2020-10-08 14:51:30 +02:00
vis2k
d40a6f6f7a perf: NetworkServer.Update avoid costly NetworkIdentity null check. Catch exception and log useful warning instead. This amounted to ~5% CPU in 4k monsters test before. 2020-10-08 14:44:04 +02:00
vis2k
389cf48064 perf: NetworkTransform bare metal position/rotation/scale sync. No more Cmd allocations and avoid redundant transform.transform call 2020-10-08 14:33:42 +02:00
vis2k
8561f67c12 Project Settings: IL2CPP reverted to Mono for faster build time 2020-10-08 12:36:41 +02:00
vis2k
941f6d262f Benchmark monsters doubled to 4k 2020-10-08 12:32:09 +02:00
vis2k
05c97094a4 Remove warning 2020-10-08 12:20:30 +02:00
vis2k
8c51319f5e DotNetCompatibility and StringHash merged into Extensions 2020-10-08 12:07:37 +02:00
vis2k
eeb1b3a469 Syntax 2020-10-08 12:05:37 +02:00
vis2k
63540998c9 Remove NetworkServer.Spawn version with assetId 2020-10-08 12:05:09 +02:00
vis2k
f4df75daee Remove unused AddPlayerForConnection version with assetId 2020-10-08 12:04:17 +02:00
vis2k
371121ef48 Syntax 2020-10-08 12:00:30 +02:00
vis2k
f59af28ccb MessagePacker.Unpack<T> moved to MessagePackerTests because it's only used for tests 2020-10-08 11:02:09 +02:00
vis2k
8d06b8737b Update comment 2020-10-08 10:47:14 +02:00
vis2k
7363de93ba MessagePacker: remove reundant GetId version. GetId<T> is enough. 2020-10-08 10:42:32 +02:00
vis2k
c709682344 Syntax 2020-10-08 10:38:35 +02:00
vis2k
1ad62db633 Update comment 2020-10-08 10:38:18 +02:00
vis2k
90d7ef65e0 Disable debug logs in ClientScene 2020-10-08 10:31:50 +02:00
vis2k
294c267472 perf: InterestManagement update time is now set in RebuildAll instead of Update. Avoids unnecessary updates if someone just called RebuildAll anyway 2020-10-08 10:23:34 +02:00
vis2k
2c41dc0ae5 Project Settings: default quality reduced to high 2020-10-08 10:04:33 +02:00
vis2k
72f5cdb6d7 InterestManagement: ensure player always sees himself and all his pets 2020-10-07 09:53:15 +02:00
vis2k
5a714c5605 Interest Management: Spatial Hashing aka Grid Checker 2020-10-07 09:31:16 +02:00
vis2k
5971eb7e05 BruteForce/InterestManagement: update interval / RemoveOldObservers / AddNewObservers moved into abstract InterestManagement for convenience. This allows us to reuse code for SpatialHashing and will allow us to set lastUpdateTime in RebuildAll() later in order to reduce rebuild load when people disconnected 2020-10-06 12:54:56 +02:00
vis2k
dfb60713cc update comment 2020-10-06 12:37:14 +02:00
vis2k
3f7aebb01f BruteForceInterestManagement moved into BruteForce folder 2020-10-06 11:39:27 +02:00
vis2k
d5582c6a47 NetworkServerTests: added missing InterestManagement 2020-10-06 11:35:06 +02:00
vis2k
f6ebc61102 Remove isSpawnFinished test since it doesn't exist anymore 2020-10-06 11:32:22 +02:00
Paul Pacheco
030028d5c8 breaking: no need to override Serialize/Deserialize in messages (#2317)
* breaking: no need to override Serialize/Deserialize in messages

Messages no longer serilize themselves.  This has been decoupled.  Serializing a message is now done
via readers and writers, which can be either generated or user provided.

This lifts some restrictions,
* you no longer need to have a default constructor in messages
* Messages types can be recursive
* struct Messages don't need to provide an empty Serialize and Deserialize method

Before:
```cs
public struct ReadyMessage : IMessageBase
{
    public void Deserialize(NetworkReader reader) { }

    public void Serialize(NetworkWriter writer) { }
}
```

After:
```cs
public struct ReadyMessage : IMessageBase
{
}
```

BREAKING CHANGE: Messages must be public
BREAKING CHANGE: Use custom reader and writer instead of Serialize/Deserialize methods

* Remove unused method

* remove unused methods

* remove unused methods

* make all messages struct

* Fix test code generator

* Get rid of MessageBase

* Rename IMessageBase -> NetworkMessage

* add MessageBase as obsolete

* Use a default request

* Empty file to make asset store happy

* Apply suggestions from code review

Co-authored-by: James Frowen <jamesfrowendev@gmail.com>

Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
2020-10-06 10:19:15 +02:00