Commit Graph

4436 Commits

Author SHA1 Message Date
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
Emre Bugday
3665a992d5 Fixed OnStopClient not being called on Client Side (#2308)
* Fixed OnStopClient not being called on Client Side

* Moved identity.OnStopClient() two scopes above

Co-authored-by: Emre Bugday <47198270+EmreB99@users.noreply.github.com>
2020-10-06 09:45:36 +02:00
James Frowen
b33e5228a3 Update Extensions.cs (#2310)
- only catching AssemblyResolutionException
- using null propagation instead of null ref
2020-10-06 09:44:35 +02:00
vis2k
b9c0ee144b InterestManagement: NetworkIdentity.forceHidden added again to replace NetworkProximityChecker.forceHidden 2020-10-05 17:35:20 +02:00
vis2k
a9b0254fcc InterestManagement global solution and removed NetworkProximityChecker/RebuildObservers 2020-10-05 15:32:07 +02:00
vis2k
0e324f5198 Remove unused import 2020-10-02 12:32:35 +02:00
vis2k
abe3ce194f fix tests after previous SyncLists commit 2020-10-02 12:24:27 +02:00
Paul Pacheco
df9fe83971 breaking: Use SyncLists directly (delete overrides) (#2307)
* feat: Use SyncLists directly

Previously,  you had to write an intermediary class to use synclists, syncsets and syncdictionaries.
The weaver would populate that intermediary class with a serialization and deserialization method

This PR gets rid of 90% of the weaver code for synclists.
There is no need to generate these methods anymore.
Instead the lists use `writer.Write<T>` and `read.read<T>` to serialize their Data.

Since there is no code generate in synclists, you can now use the synclists directly instead
of subclassing them.

BEFORE:

```cs
public class MyComponent : NetworkBehaviour {
    // nonsense class to make the weaver happy
    class SyncListData : Synclist<Data> {}

    SyncListData mySyncList;
}
```

AFTER:

```cs
public class MyComponent : NetworkBehaviour {
    Synclist<Data> mySyncList;
}
```

* linting

* feat: Use SyncLists directly (no overrides)

Previously,  you had to write an intermediary class to use synclists and syncdictionaries.

The weaver would populate that intermediary class with a serialization and deserialization method

This PR gets rid of 90% of the weaver code for synclists.
There is no need to generate these methods anymore.
Instead the lists use `writer.Write<T>` and `read.read<T>` to serialize their Data.

Since there is no code generate in synclists, you can now use the synclists directly instead
of subclassing them.

Same as #2305 ,but it removes the deprecated Serialize and Deserialize methods from syncobjects,
This way you get a nice compiler error for the code that no longer works, instead of a warning you might accidentally ignore.

BEFORE:

```cs
public class MyComponent : NetworkBehaviour {
    // nonsense class to make the weaver happy
    class SyncListData : Synclist<Data> {}

    SyncListData mySyncList;
}
```

AFTER:

```cs
public class MyComponent : NetworkBehaviour {
    Synclist<Data> mySyncList;
}
```

BREAKING CHANGE: Serialize and Deserialize methods in synclists don't do anything anymore

* Remove old comment

* Fix compilatio error
2020-10-02 09:50:35 +02:00
Paul Pacheco
55f64af196 feat: new generic Read and Write methods for all types (#2301)
Currently in mirror,  there is no way for Mirror itself to invoke
readers and writers for types it does not know about.

This causes us to have to generate code for lists, dictionaries and messages.

This PR makes it so that if there is a reader and writer anywhere in the
code for type X, then the writer can be invoked like this:

```cs
X x = ...;
writer.Write<X>(x);
```

and the reader can be invoked like this:
```cs
X x = reader.Read<X>();
```
2020-10-02 09:18:50 +02:00
vis2k
41f8644d1e Remove NetworkReader/Writer Read/WritePacked completely (note for backporting: requires moving WriteInt/UInt/etc. to extensions, otherwise weaver won't know how to write int/uint/etc.) 2020-10-01 16:12:42 +02:00
vis2k
7ef5b59fad perf: NetworkReader/NetworkWriter use Read/WriteBlittable<T> from DOTSNET (~10x faster) 2020-10-01 16:00:39 +02:00
vis2k
06256fd8d4 codecoverage settings saved 2020-10-01 14:49:55 +02:00
vis2k
56a054ba67 MessagePacker.MessageHandler renamed to WrapHandler because that's what it does 2020-10-01 14:49:48 +02:00
vis2k
99b3d95484 MessagePacker.MessageHandler refactored for consistency with DOTSNET 2020-10-01 14:41:41 +02:00
vis2k
3cb928fb30 Packages: CodeCoverage 0.3.1-preview added 2020-10-01 11:34:22 +02:00
vis2k
c5792ce837 Remove Transport.OnDataReceived channelId parameter 2020-10-01 11:33:05 +02:00
vis2k
1afdfd91d0 Remove unused 2020-09-30 12:12:46 +02:00
vis2k
304b201c6a Revert xml 2020-09-30 12:10:47 +02:00
vis2k
0f47b4bbe2 Remove unused disconnectInactiveTimeout 2020-09-30 12:05:20 +02:00
vis2k
076f9e0627 Add comment 2020-09-30 12:03:44 +02:00
vis2k
7a3ababf03 typo 2020-09-30 12:02:58 +02:00
vis2k
3323eecc1e Remove unused import 2020-09-30 12:00:37 +02:00
vis2k
ba31afba2c Remove unused clientReadyConnection 2020-09-30 11:58:31 +02:00
vis2k
a85446c6da Remove docs 2020-09-30 11:47:20 +02:00
vis2k
4ec6e1fa19 Remove all Scene changes and show error message if changed at runtime instead 2020-09-30 11:44:37 +02:00
vis2k
41af9b2dae Remove NetworkIdentity.Assign/RemoveClientAuthority & Callback 2020-09-30 11:15:25 +02:00
vis2k
ee75a61d8e Syntax 2020-09-30 11:11:49 +02:00
vis2k
ad8537ffd5 Remove Transport.Send(List<connectionId>) 2020-09-30 11:09:30 +02:00
vis2k
aec2a71802 Remove NetworkConnection.lastMessageTime & IsClientAlive 2020-09-30 11:09:30 +02:00
vis2k
de6b63ef2f Remove NetworkClient.ReplaceHandler 2020-09-30 11:09:30 +02:00
vis2k
84cf753f19 Remove Uri support 2020-09-30 11:09:30 +02:00
vis2k
bd0a00fcb9 Remove Obsolete 2020-09-30 11:09:29 +02:00
vis2k
0a2555c700 Fix rebase 2020-09-30 11:09:29 +02:00
vis2k
5e2a968abb Force NetworkMessage as struct everywhere 2020-09-30 11:09:29 +02:00
vis2k
6baaa1d75e IMessageBase renamed to NetworkMessage 2020-09-30 11:09:29 +02:00
vis2k
a565c7c33c Remove NetworkMessage class support 2020-09-30 11:09:29 +02:00
vis2k
4d4e507847 Remove ClientScene.spawn/unspawnHandlers 2020-09-30 11:09:29 +02:00
vis2k
b44481767b Remove ClientScene.Register/UnregisterSpawnHandler 2020-09-30 11:09:29 +02:00
vis2k
6b2cd3aefa Remove ClientScene.RegisterPrefab with assetId, Spawn/UnspawnDelegate 2020-09-30 11:09:29 +02:00
vis2k
c54be229a8 Remove ClientScene.RegisterPrefab with Spawn/UnspawnHandlerDelegate 2020-09-30 11:09:29 +02:00
vis2k
0aeb13a8af Remove ClientScene.RegisterPrefab with spawn/unspawnHandler 2020-09-30 11:09:29 +02:00
vis2k
9682a9a7e5 Remove ClientScene.RegisterPrefab with newAssetId 2020-09-30 11:09:29 +02:00