Commit Graph

1947 Commits

Author SHA1 Message Date
James Frowen
7dde2f80fe
removing and sort using (#1631) 2020-03-31 22:56:30 +02:00
James Frowen
f19e2d3aac
more formatting (#1630) 2020-03-31 22:55:58 +02:00
James Frowen
c6501aab06
formatting (#1629) 2020-03-31 12:15:30 -05:00
Chris Langsenkamp
7f208ffba9 Updated Comments 2020-03-30 22:28:59 -04:00
James Frowen
1ae038172a
perf: faster NetworkReader pooling (#1623)
* replacing stack with array for NetworkReaderPool

* Reader tests
2020-03-30 17:08:21 +02:00
James Frowen
f9335bb5f3
Finding WeaverAssembler path before running tests (#1608)
* Finding WeaverAssembler path before running tests

* using nameof
2020-03-30 14:45:36 +02:00
James Frowen
dcb618bfd6
fixing MissingReferenceException (#1624) 2020-03-29 21:39:18 -04:00
Paul Pacheco
deb286f0c2 refactor: simplify getting hook method 2020-03-29 14:25:07 -05:00
Paul Pacheco
518233cd7e This is always true 2020-03-29 14:11:54 -05:00
Paul Pacheco
69fdbea892 Unused using 2020-03-29 14:11:54 -05:00
James Frowen
da2e61b30a
doc comments (#1622) 2020-03-29 11:41:21 -05:00
vis2k
254a49496f NetworkWriterPool: add performance comment 2020-03-29 17:33:03 +02:00
vis2k
d865dddb4e 10k demo: deterministic health updates 2020-03-29 17:29:11 +02:00
James Frowen
4fa43a9471
perf: faster NetworkWriter pooling (#1620)
* using array in NetworkWriterPool instead of stack

* Using property

adding debug warning if pool is full

* adding tests for  NetworkWriterPool

* Update NetworkWriterPool.cs

* Update NetworkWriterPoolTest.cs

Co-authored-by: vis2k <info@noobtuts.com>
2020-03-29 17:16:16 +02:00
Paul Pacheco
e96b687563 Revert "perf: faster NetworkWriter pooling (#1616)"
This reverts commit 5128b122fe.
2020-03-28 19:04:06 -05:00
Paul Pacheco
96e690ef9c Revert "Explain why 10"
This reverts commit e8cdb7569d.
2020-03-28 19:03:53 -05:00
Paul Pacheco
e8cdb7569d Explain why 10 2020-03-28 18:14:48 -05:00
James Frowen
e12f33d306
fixing MissingReferenceException (#1619) 2020-03-28 15:00:48 -04:00
James Frowen
5128b122fe
perf: faster NetworkWriter pooling (#1616)
Stack turned out to be slow way to pool NetworkWriters.
Replace them with an array

see #1614
2020-03-28 12:58:00 -05:00
Paul Pacheco
61163cacb4
perf: replace isValueType with faster alternative (#1617)
According to vis benchmark here https://github.com/vis2k/Mirror/issues/1614#issuecomment-605443808
isValueType is an expensive operation.

This microoptimization replaces isValueType for a faster (not so readable) alternative
2020-03-28 12:27:42 -05:00
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
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