Commit Graph

3780 Commits

Author SHA1 Message Date
Paul Pacheco
166b8c9467
perf: use byte[] directly instead of MemoryStream (#1618)
* perf: use byte[] directly instead of MemoryStream

* Optimize writing int32 and int64

* Update Assets/Mirror/Runtime/NetworkWriter.cs

Co-Authored-By: vis2k <info@noobtuts.com>

* Update Assets/Mirror/Runtime/NetworkWriter.cs

Co-Authored-By: vis2k <info@noobtuts.com>

* Update Assets/Mirror/Runtime/NetworkWriter.cs

* Start with bigger buffer

* Woops,  should have double checked suggestion

* Removed invalid Test

We should not require NetworkWriter to behave in certain way when Position
is set to out of bounds.

That is an invalid use of NetworkWriter, so NW should be free to do any behavior

* smells

* Update NetworkWriter.cs

Co-authored-by: vis2k <info@noobtuts.com>
2020-03-28 18:17:53 +01:00
vis2k
a4bd6e7e66
Examples: added 10k monsters benchmark (#1615)
* scene and 1bit from kenney

* tilemap

* slice sprites

* name some

* create empty tile

* 2d cam

* monster prefab

* 100 monsters

* monster netid

* rename

* zoom cam, 10k monsters

* resave scene for sceneids

* Monster script

* add transparent textures for monsters

* replace monster sprite with transparent

* scripts

* mvoed into benchmarks folder

* player sprite

* tilemap background

* player prefab

* health update
2020-03-28 13:03:19 +01:00
Paul Pacheco
3fb7559561 remove redundant code block 2020-03-27 17:25:33 -05:00
Paul Pacheco
f56471085f Fix typos in tests 2020-03-27 17:21:24 -05:00
Paul Pacheco
10813cb9eb Reduce cognitive complexity of GenerateClassOrStructReadFunction 2020-03-27 17:14:39 -05:00
Paul Pacheco
ef80575787 Remove redundant code block 2020-03-27 17:06:59 -05:00
Paul Pacheco
6587c1f7b9 Better comment 2020-03-27 17:03:40 -05:00
Paul Pacheco
1f8b27e927 Remove unused using 2020-03-27 17:02:59 -05:00
Lymdun
5d76afbe29
perf: Remove redundant mask (#1604) 2020-03-27 11:34:56 +01:00
Paul Pacheco
dbe1365329 fix naming convention 2020-03-26 23:15:09 -05:00
Paul Pacheco
1d4eed77ed Simplify getting methods 2020-03-26 19:28:17 -05:00
James Frowen
c6023c8275
unit test for IsActiveScene (#1597) 2020-03-27 00:22:46 +01:00
Paul Pacheco
c1cfc42181 perf: simplify and speed up getting methods in weaver 2020-03-26 17:35:15 -05:00
Paul Pacheco
ebc817028b reduce cognitive complexity of CheckForHookFunction 2020-03-26 17:35:15 -05:00
Paul Pacheco
c6e8717909 simplify getting attribute fields 2020-03-26 17:35:15 -05:00
Chris Langsenkamp
5146e95fe0 Udpated scene file 2020-03-26 18:15:44 -04:00
Chris Langsenkamp
d4366ecd73 doc: Updated ChangeLog 2020-03-26 16:32:38 -04:00
vis2k
6151edc730 rename test 2020-03-26 21:27:47 +01:00
vis2k
e059b23a7f
NetworkManager.StopHost stops client, then server. Seems more consistent this way. (#1602) 2020-03-26 21:10:16 +01:00
vis2k
678ac68b58
fix: #1515 - StopHost now invokes OnServerDisconnected for the host client too (#1601)
* fix: #1515 - StopHost now invokes OnServerDisconnected for the host client too

* avoid NullReferenceException when calling StopHost without StartHost

* test WIP

* test
2020-03-26 20:54:53 +01:00
Paul Pacheco
c8a1a5e56f
feat: now you can assign scenes even if not in Editor (#1576)
* feat: now you can assign scenes even if not in Editor

Instead of using scene name, scenes are now identified by path.
This fixes a couple problems:

1) In the room example, now you can assign the scenes even if they have
not been added to the editor.  This was a constant pain because if you
open the offlinescene, all the scenes got wiped.  You had to add the
scenes to the editor and reassign them all again.   With this PR you
will still need to add them to the editor, but they will remain
assigned.

2) It is possible for multiple scenes to have the same name,  but it is
not possible for multiple scenes to have the same path. So this is
a more robust way to identify scenes

This also greatly simplifies the scene SceneDrawer

BREAKING CHANGE: You will need to reassign your scenes after upgrade

* Automatically fix properties that were using name

If you open a NetworkManager or other gameobject that uses a scene name
it now gets converted to scene path by the SceneDrawer

* Use get scene by name

* Scene can never be null

* Update Assets/Mirror/Examples/AdditiveScenes/Scenes/MainScene.unity

* Issue warning if we drop the scene

* Issue error if scene is lost

* Add suggestion on how to fix the error

* Keep backwards compatibility, check for scene name

* cache the active scene

* Update Assets/Mirror/Editor/SceneDrawer.cs

Co-Authored-By: James Frowen <jamesfrowendev@gmail.com>

* GetSceneByName only works if scene is loaded

* Remove unused using

Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
2020-03-26 17:49:47 +01:00
vis2k
8c6ae0f8b4
fix: #1599 - NetworkManager HUD calls StopHost/Server/Client depending on state. It does not call StopHost in all cases. (#1600) 2020-03-26 17:34:16 +01:00
Paul Pacheco
7a6b854179 Simplify finding custom attributes 2020-03-26 09:52:39 -05:00
Paul Pacheco
d530d7a1e4 Lists are not needed anymore 2020-03-26 07:50:16 -05:00
Paul Pacheco
97fe7a0a01 Simplify adding substitute methods 2020-03-26 07:46:15 -05:00
Paul Pacheco
9c4d172664 reduce Cognitive complexity 2020-03-26 00:36:15 -05:00
Paul Pacheco
486b094b22 reduce Cognitive complexity 2020-03-26 00:33:04 -05:00
Paul Pacheco
559cf80755 parameter name matches base class 2020-03-26 00:25:35 -05:00
Paul Pacheco
910aeab4eb fix smells 2020-03-26 00:24:20 -05:00
Paul Pacheco
3029467709 fix flaky test 2020-03-26 00:17:22 -05:00
Paul Pacheco
de768d142f Remove redundant if 2020-03-25 05:02:04 -05:00
Paul Pacheco
62525a9b4b Use List instead of yield return 2020-03-25 04:53:20 -05:00
Paul Pacheco
307807d68c Use List instead of yield return 2020-03-25 04:53:20 -05:00
vis2k
ad39ddc92f
NetworkTransform rotation compression removed. Gets rid of endless discussions, optimizations and issues. Sending a quaternion is never going to fail. (#1595)
* NetworkTransform rotation compression removed. Gets rid of endless discussions, optimizations and issues. Sending a quaternion is never going to fail.

* keep empty file

* keep empty file
2020-03-25 10:18:07 +01:00
Chris Langsenkamp
ef2f6b45bc Removed noisy warning and added reason in comments 2020-03-24 23:56:52 -04:00
Chris Langsenkamp
111ae51102 Room Example shows how to get Network Manager out of DontDestroyOnLoad 2020-03-24 22:04:54 -04:00
Chris Langsenkamp
d034ef616f feat: Added Virtual OnRoomStopServer to NetworkRoomManager and Script Template 2020-03-24 22:02:01 -04:00
Paul Pacheco
8026f6dcac unnest ifs 2020-03-24 20:17:03 -05:00
Paul Pacheco
0541b339ed Merge ifs, fix smells 2020-03-24 20:14:43 -05:00
Paul Pacheco
9c917c582e Remove unused using 2020-03-24 20:09:05 -05:00
Paul Pacheco
2a3470dfb4 Helpers should not be instantiated 2020-03-24 20:08:42 -05:00
Paul Pacheco
b740b2487b this is not code 2020-03-24 20:07:30 -05:00
Paul Pacheco
260e37cbb2 Reduce cognitive complexity of OnCompilationFinished 2020-03-24 20:04:34 -05:00
Paul Pacheco
6f04ff77d7 Remove commented out code 2020-03-24 20:02:49 -05:00
Paul Pacheco
48cf45b8ce Remove unused method 2020-03-24 20:01:55 -05:00
Paul Pacheco
f4bc7ca691 use same parameter name in override 2020-03-24 20:01:00 -05:00
Paul Pacheco
433818b440 Remove cognitive complexity of NetworkInformation
Split up large method,
Use static variables instead of fields
2020-03-24 19:58:39 -05:00
Chris Langsenkamp
85c4f1bcf1 Remove unused variable 2020-03-24 17:58:04 -04:00
vis2k
347cb5374d
fix: #1593 - NetworkRoomManager.ServerChangeScene doesn't destroy the world player before replacing the connection. otherwise ReplacePlayerForConnection removes authority form a destroyed object, causing all kidns of errors. The call wasn't actually needed. (#1594)
* fix: #1593 - NetworkRoomManager.ServerChangeScene destroys the world player after replacing the connection, not before. previously ReplacePlayerForConnection would operate on dead data.

* remove it entirely
2020-03-24 22:28:04 +01:00
Paul Pacheco
9a50fbd507 Remove redundant initialization 2020-03-24 15:59:17 -05:00