* Made dirty bits not rely on NetworkWriter position manipulation hackery.
* Renamed GetDirtyBits to NextDirtyBits, as discussed with Paul.
* Expanded one line ifs.
* Added basic SyncDictionary support, no support for structs yet
* Fixed TryGetValue usage
* Removed extraneous hardcoded SyncDictionary type
* Added a couple basic tests, more coming
* Added 4 more tests
* Added two tests and SyncDictionary now bubbles item to Callback on Remove (both Remove cases)
* Added the remainder of tests
* Added basic documentation about SyncDictionaries on StateSync.md page
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Simplify test syntax
Co-Authored-By: Katori <znorth@gmail.com>
* Remove null-check when setting value directly (and updated expected test behaviour)
* fix: Provide default implementation for SyncDictionary serializers
* feat: Add Weaver support for syncdictionary
* Fix minor issue with Set code and made test use Weaved serialization instead of manual
* Added a new test for bare set (non-overwrite)
* Added another test for BareSetNull and cleaned up some tests
* Updated SyncDictionary documentation on StateSync.md
* Update docs with SyncDictionary info
* Update SyncDictionary docs wording
* docs: document the types and better example
* Add two SyncDictionary constructors
* Removed unnecessary initialization
* Style fixes
* - Merged many operation cases
- Fixed Contains method
- Added new test to test contains (and flag its earlier improper usage)
- Use PackedUInt32 instead of int for Changes and Counts
* - Simplify "default" syntax
- Use Rodol's remove method (faster)
- Don't use var
* Removed unnecessary newline, renamed <B, T> to <K, V> per vis2k, corrected wording of InvalidOperationException on ReadOnly AddOp
* Code simplification, style fixes, docs example style fixes, newly improved implementation for CopyTo that fails gracefully
* feature(synclist): allow SyncList of primitive types
As it turns out this never really worked:
```cs
class SyncListByte : SyncList<byte> {};
```
You had to write your own serializeItem / deserialize item for native types.
This change lifts the restriction, now you can use a synclist of anything that mirror can serialize/deserialize
* fix: fix unit tests error messages
* - Added a `IMessageBase` as an interface to `MessageBase`. Existing messages which inherit `MessageBase` (including ones which do not implement Serialize/Deserialize and rely on the weaver) will continue to work in exactly the same way as before!
- Modified any methods which were generic `T where T : MessageBase` to be `T where T : IMessageBase`. this does not change things at all for all existing usages of the method.
These two changes allow end users to implement IMessageBase as a `struct` instead of `MessageBase` as a `class`, so they are no longer forced to allocate message objects in their own code.
* Update .gitignore
* Update Messages.cs
* Update MessageBaseTests.cs
* Update MessageBaseTests.cs
* Update MessageBaseTests.cs
Previously, if you wanted a synclist of structures, you would do: SyncListSTRUCT<MyStruct>
Now you can use SyncList<MyStruct>
SyncListSTRUCT is left there, but obsolete
This allows you to leave rotation out of the NetworkTransform if you only need position.
Right now if you don't need sync rotation and set compression to Lots, it can move your object in ways not expected. This forces you to use no compression as a fix. Using more bandwidth for something you don't need. I think this is all that is needed, tested it in my game and it works.
The name SyncObjectProcessor is confusing because it does not process syncobjects. Instead it initializes syncobjects in a NetworkBehaviour.
this avoids the confusion with SyncListStructProcessor, that does process synclists to add serialization methods
SyncListProcessor is a very confusing name, it does not process synclists at all, instead it initializes synclists in the network behaviour.
This is more confusing especially since SyncListStructProcessor does process the synclists to add serialization methods, and both of them normally work
in tandem in different parts of the code
* Fix Scene Handling
Line 361: Passing false prevents the switch to offline scene...pass true instead to forceReload paramater.
Line 588: Never assume Network Manager is in Scene 0 of Build Settings...it often is not.
* Reverted GetActiveScene
Will make separate PR
* Added code to unwind DontDestroyOnLoad
* Fixed typo in comment
* Removed the unwinding of DDOL
* [TargetRPC] optional connection parameter for easier usage while still allowing for previous usage
* allow for parameterless targetrpc too
* syntax
* Add Helpers.ReaderParameters change from HLAPI 2019.2 package just to be sure
* move weaver into assets folder
* disable tests for now
* asmdef
* add logs
* Use UNET's WeaverRunner code, slightly modified to find Mirror assembly
* Use UNET's 2019.2 package Weave function changes
* compiler messages error checked moved into separate function
* fix typo
* syntax
* replace 'var'
* rename
* replace var
* fix log
* update comment
* syntax
* rename to assemblyPath. no need for an extra variable.
* remove extra variable
* fix typo
* remove old code
* don't use .Contains to find Mirror dll. that's crazy. would fail for all DLLs in Mirror folder.
* look for 'this' assembly separately
* separate unityEngine assembly search
* add comment
* move null check up
* move null check upwards
* move outputDirectory down
* check process result properly
* use our previous way to find unity engine dll
* rename to unityEngineCoreModuleDLL again
* improve output directory construction
* move unityengine dll finding upwards
* move foundThisAssembly down, where it is used
* add comments
* split dependency code into separate functions
* add TODO
* store this assembly in a variable
* split dependency search depending on if we found assembly or not
* move usesMirror logic into if and out of 'not found' else
* syntax
* improve order
* GetNonDynamicAssemblyDirectories helper function
* check File.Exists instead of exception
* improve comment
* rename HlapiRuntimeAssemblyName to MirrorAssemblyName
* reuse MirrorAssemblyName
* remove telepathy check
* rename to MirrorRuntimeAssemblyName
* add MirrorWeaverAssemblyName
* reuse name consts
* don't use contains to check if assembly depends on Mirror
* add actions for testing again
* make CompilationFinishedHook public so it can be used by tests
* fix typo
* Mirror.Tests.asmdef references weaver asmdef
* reenable tests
* pass error handlers to Weaver Processing for tests to work
* add empty line
* persistent scene ids
* never assign scene ids at runtime
* fix warning
* fix 'sceneid is never assigned to' warning in play mode
* simplify bitwise operation
* set dirty even if only scene index byte changed
* improve log message
* assign build index byte in OnPostProcessScene to also work with unopened scenes and build index changes
* add comment
* improve log
* Add sceneid not set check
* Only PostProcess the objects from this scene.
* Interrupt build if there is an unopened scene that still needs sceneId assignments. This makes it 100% fail safe.
* improve comment and error message
* clear build index byte before or-ing into it
* Fixed animator bandwidth problem.
* Renamed xShadowCopy to lastXParamters, renamed val to be consistent with the reading value names, renamed newValue to newIntValue to be consistent with newFloatValue and newBoolValue.
* Removed Debug.log which slipped by.
* Client can send/receive messages without id
* Server can send and receive messages without id
* Move message id to one common place
* Client use the new send method
* Obsolete the message ids
* Remove player uses the new api
* Refactor AddPlayer with new message api
* Provide a Pack method that gets the message id
* Convert ready message to new api
* Use new api for ObjectDestroy and ObjectHide
* Refactored ready message to new API
* Refactored SpawnSceneObjectMessage to new api
* Convert local authority message to new api
* Convert spawn started message to new api
* Convert spawn finished message to new api
* Convert upate vars message to new api
* Convert owner message to new api
* Convert pong message to new api
* Convert RPC message to new api
* Convert SyncEvent rpc to new api
* Refactor Command to new api
* Refactor Ping to new api
* Convert ErrorMessage to new api
* Convert ErrorMessage to new api
* Use int instead of short for message id to avoid collisions
* Keep only 16 bit hash for message id
* Converted Disconnect Message to new api
* Convert Connect to new message api
* Convert not ready message to new api
* Convert scene message to new api
* the Enum is no longer used for message id
* Add non obsolete version of SendToClient
* Document how to use new API
With this PR, we no longer use Message id, document the proper use of the api
* use C# syntax highlight
* Update NetworkMessages.md (#5)
Punctuation changes, added `cs` to code blocks.
* Write message id in short instead of packed int
* Use packer method with id
* Pass the NetworkConnection to the client message handlers
* removed workaround from previous cecil version that now causes sharing violation console warning
* fixed language feature error -- null prop op is C#4 but .sln target is net35
* separated editor logging (required) from console logging (optional)
* fix issue introduced by flipping boolean property meaning in 9895bff
* added updated weaver assembly
* updated to release assembly - wrong assembly in ef0c903
* commenting weave target debug log to retain prev behaviour (oops)
* Added modified version of Paul's 2018 WebSockets transport, modifications include:
- Basic support for WSS
- Event format converted to master event format (UnityEvents)
* Fixed indentation and added support for Available()
* Manually merged in Paul's changes for latest version of Transport
* Added comment to CertVerificationCallback to reflect new research done in live environment.
* Added NoDelay option and merged in some minor renames from 2018 branch version
* This doesn't sync slow rotating objects
The function sets lastRotation to the current rotation every frame, regardless of whether or not it detected a change. Because comparing two similar, but different Quaternions return true, only quickly rotating objects will return true; slow turning objects will return false, and the rotation will not be synced. By not updating lastRotation until a difference is spotted, any rotation will be synced.
This fix allowed my slow rotating spaceship to sync rotation.
TL;DR
lastRotation should be the last time this function returned true, not the rotation last frame.
* Update NetworkTransformBase.cs
* Created Transport.activeTransport to decrease NetworkManager god status.
* Fixed NetworkManagerHUD. (I forgot I had deleted it temporarily for testing)
* Protocol.UnpackMessage returns reader instead of content to avoid manually extracting content, just to create a reader from it in all callers
* Create NetworkReader outside of Protocol.Unpack
* Fixed 1 link to be relative
Removed Wiki link from ReadMe
* Made ClientLoadedScene virtual
Updates to scene object references
Scene and vsync handling improvements
Minor cleanup.
* removed all use of vSyncCount
* Fixed bug with ReadyToBegin being incorrectly set
* Initial Commit with Unity's Network Lobby Components
* Lobby Components WIP
* Massive simplifications and structural changes to NetworkLobbyManager and NetworkLobbyPlayer
* Replaced more default messages with Command structure resulting in further simplification and less LOC
* Completed removal of messages
* Code Formatting and GUI Layout
* Fixed bugs and finished Remove feature in UI
* Added Network Lobby Manager Doc
* Network Lobby Docs
* Network Lobby Player Doc
* Updated doc and image about Offline Scene
* changed to PNG
* Added Lobby components to navigation
* Conformed to naming convention
Removed some leftover cruft
Removed maxPlayers (redundant to maxConnections)
Trapped and killed null ref in OnServerDisconnect
* Fixed mistake in OnServerDisconnect
* Fix Active Scene check
* Alow clean switch to Offline scene
* Add Help URL attributes to components
* Added Help URL Attributes
* Fixed OnGUI logic error.
* Added Example and README
* Fixed Disconnect handler
* Updated Docs
* Added Header for Inspector
* Finished Lobby Example Minigame
* Minor cleanup
* Set targetFramerates
* Code Cleanup
Changed to extended Lobby Manager for player Indexes & colors
* Minor changes to align with Mirror's NetworkManager
* Fixed logic error
* SyncVar Hook Workaround
Random Start Positions
* Revert making CallOnClientEnterLobby public
* Added documentation to the extension
* Minor code rearrangement
* Made OnGUI virtual so it can be overridden.
Added AllPlayersReady bool for convenience to extenders
Start Game enhancement to example.
* added comments
* Corrected namespaces and usings
* Reworked DontDestroyOnLoad
LobbyPlayer: Moved code from OnStartClient to Start
Added LobbyPlayerExt to Lobby Example
Code cleanup, added regions
Fixed Start Game button bug
* Final push of Lobby example to make sure it's complete.
* Improved Lobby Example
* Code cleanup
* Added ground texture
Set player camera angle
Adjusted lighting angle
* Updated ReadMe
Cleaned up privates
Fixed example to use SetParent
Changed to 5 max connections in example
* Prefab name fixes due to Mirror master's changes
Changed camera handling and GamePlayer Prefab
Two more SetParent fixes
Demoted two warnings to information
Added more comments to example scripts
* Revisions based on Vis2K review...more to come.
* Added f's where assigning literals to floats
* Removed manual calls to SyncVar Hooks because the bug is now fixed.
* Changed to GUILayout
* wrapped in namespace
* Changed to GUILayout
* All changes per peer review
* Renamed folder to Lobby.
* Fix due to change in Mirror 1691
* Renamed Scenes
Added LobbyScene property to OfflineGUI script.
* Example for weaver issue
* Fix#314, weave assemblies built before the weaver
* Don't need the example anymore
* Update CompilationFinishedHook.cs
* Dont try to load assemblies while they are being modified
* Revert "Weave dll again. Plan B for #314 (#323)"
This reverts commit b20cb4280c.
* BUG: Fix issue where setting this.enabled = false doesn't get honored when transitioning from Local Offline Host to Connected Server.
* Update TelepathyTransport.cs
* position magic instead of allocating writers
* premature optimizations here we come
* simplify. less magic.
* better logging
* fix ondeserialize bugs caused by readpacketuint32 instead of readint32
Immediately after the deleted lines is a call to `OnClientDisconnect(netMsg.conn);` which calls `StopClient();` which has the exact same code on line 344 as what I'm proposing be deleted here.