-
Notifications
You must be signed in to change notification settings - Fork 136
Feat: Readme Updates [MTT-5460] #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6973898
Readme updates
jilfranco-unity 8b086c4
more github readme updates
jilfranco-unity a5ca036
in editor readme for dynamic prefabs--will update temporary image
jilfranco-unity 4b439e8
readme updates, comments addressed
jilfranco-unity 328fa4d
little readme updates with what to do in each scene for the other bit…
jilfranco-unity 4e870d0
Update Basic/DynamicAddressablesNetworkPrefabs/README.md
jilfranco-unity 9f5294d
Update Basic/DynamicAddressablesNetworkPrefabs/README.md
jilfranco-unity 43fad9a
Update Basic/2DSpaceShooter/README.md
SamuelBellomo 291b4b2
readme updates
jilfranco-unity dfe22a1
Merge branch 'feat/readme-updates-postrename' of https://github.com/U…
jilfranco-unity 00c5269
version update to 1.2.0 and some tiny in project readme edits to brin…
jilfranco-unity 7cd2ab7
updated readme image to match current UI
jilfranco-unity 3872aa9
okay updated again to this cuter version
jilfranco-unity 96438a3
Merge branch 'develop' into feat/readme-updates-postrename
jilfranco-unity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,26 +24,40 @@ Each scene in the project showcases a different, isolated feature of the API, al | |
|
||
- Scene 00_Preloading Dynamic Prefabs | ||
- This is the simplest case of a dynamic prefab - we instruct all game instances to load a network prefab (it can be just one, it could also be a set of network prefabs) and inject them to NetworkManager's NetworkPrefabs list before starting the server. | ||
|
||
- This is the less intrusive option for your development, as you don't have any additional spawning and addressable management to do later in your game. | ||
<br><br> | ||
|
||
- Scene 01_Connection Approval Required For Late Joining | ||
- An optional use-case scenario that walks through what a server would need to validate from a client when dynamically loading network prefabs. Other use-cases don't allow for reconciliation after the server has loaded a prefab dynamically, whereas this one enables this functionality. | ||
- An optional use-case scenario that walks through what a server would need to validate from a connecting client when dynamically loading network prefabs. Other use-cases don't allow for reconciliation after the server has loaded a prefab dynamically and before a client joined, whereas this one enables this functionality. | ||
|
||
- This is to support late join and should be used in combination with the other techniques described below. | ||
<br><br> | ||
|
||
- Scene 02_Server Authoritative Preload All Prefabs Asynchronously | ||
- A simple use-case where the server notifies all clients to preload a collection of network prefabs. The server will not invoke a spawn in this use-case, and will incrementally load each dynamic prefab, one prefab at a time. | ||
- A simple use-case where the server notifies all clients to preload a collection of network prefabs. The server will not invoke a spawn directly after the addressable loading in this use-case, and will incrementally load each dynamic prefab, one prefab at a time. | ||
|
||
- This acts as a "warning" notification to clients that they'll soon need this prefab. This allows being less intrusive in the spawning process later as we can assume all clients have loaded the prefab already. | ||
|
||
- This is different from option 0, as here this is done when clients are connected and already in game. This allows for more flexibility around your gameplay and could load different prefabs depending on where your players are at in the game for example. | ||
<br><br> | ||
|
||
- Scene 03_Server Authoritative Try Spawn Synchronously | ||
- A dynamic prefab loading use-case where the server instructs all clients to load a single network prefab, and will only invoke a spawn once all clients have successfully completed their respective loads of said prefab. The server will initially send a ClientRpc to all clients, begin loading the prefab on the server, will await acknowledgement of a load via ServerRpcs from each client, and will only spawn the prefab over the network once it has received an acknowledgement from every client, within `m_SynchronousSpawnTimeoutTimer` seconds. | ||
- This is the first technique that loads and spawns sequentially. This is a dynamic prefab loading use-case where the server instructs all clients to load a single network prefab, and will only invoke a spawn once all clients have successfully completed their respective loads of said prefab. The server will initially send a ClientRpc to all clients, begin loading the prefab on the server, will await acknowledgement of a load via ServerRpcs from each client, and will only Spawn() the instantiated prefab over the network once it has received an acknowledgement from every client, within `m_SynchronousSpawnTimeoutTimer` seconds. | ||
|
||
- This and the next technique allow for the most flexibility compared to the previous ones. | ||
|
||
- This technique makes sure all clients have loaded a prefab before spawning and starting gameplay on that prefab. This is useful for game changing objects, like a big boss that could kill everyone. In that case you want to make sure all clients have loaded that prefab before spawning that object. | ||
<br><br> | ||
|
||
- Scene 04_Server Authoritative Spawn Dynamic Prefab Using Network Visibility | ||
- A dynamic prefab loading use-case where the server instructs all clients to load a single network prefab via a ClientRpc, will spawn said prefab as soon as it is loaded on the server, and will mark it as network-visible only to clients that have already loaded that same prefab. As soon as a client loads the prefab locally, it sends an acknowledgement ServerRpc, and the server will mark that spawned NetworkObject as network-visible to that client. | ||
SamuelBellomo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- This makes sure that no client can block the spawn of certain objects by making it visible as soon as specific clients have loaded that prefab. This is great for network reactivity, but might create inconsistent world views for each client depending on whether you've loaded that prefab or not. Using that technique for boss loading could create a situation where your player sees its health decreasing rapidly for no visible reason because the boss is loaded server side and hitting you, but you haven't loaded it yet and it's invisible on your client. | ||
<br><br> | ||
|
||
- Scene 05_API Playground Showcasing All Post-Connection Use-Cases | ||
- This scene serves as an API playground to test how all of the use-cases in can work tandem. | ||
This scene serves as an API playground to test how all of the use-cases can work in tandem. | ||
<br><br><br> | ||
|
||
## Known Limitations | ||
|
@@ -61,8 +75,25 @@ Each scene in the project showcases a different, isolated feature of the API, al | |
handle unexpected conditions that slow down asset loading (slow disks, slow network, etc). This timeout | ||
should not be relied upon and code shouldn't be written around it - your code should be written so that | ||
the asset is expected to be loaded before it's needed. | ||
|
||
- It's currently impossible for clients to late join after a dynamic prefab has been spawned by the server - this is because the initial sync doesn't allow us any time to load prefabs that are aren't yet loaded on the client. | ||
<br><br> | ||
|
||
## Index of Resources | ||
|
||
### Dynamic Prefabs System | ||
|
||
- Preloading Dynamic Prefabs - [Assets/Scripts/00_Preloading/Preloading.cs](Assets/Scripts/00_Preloading/Preloading.cs) | ||
- Connection Approval - [Assets/Scripts/01_Connection Approval/ConnectionApproval.cs](Assets/Scripts/01_ConnectionApproval/ConnectionApproval.cs) | ||
jilfranco-unity marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Server Authoritative Preloading All Prefabs Asynchronously - [Assets/Scripts/02_Server Authoritative Load All Async/ServerAuthoritativeLoadAllAsync.cs](Assets/Scripts/02_ServerAuthoritativeLoadAllAsync/ServerAuthoritativeLoadAllAsync.cs) | ||
- Server Authoritative Try Spawning Synchronously - [Assets/Scripts/03_Server Authoritative Synchronous Spawning/ServerAuthoritativeSynchronousSpawning.cs](Assets/Scripts/03_ServerAuthoritativeSynchronousSpawning/ServerAuthoritativeSynchronousSpawning.cs) | ||
- Server Authoritative Spawn using Network-Visibility - [Assets/Scripts/04_Server Authoritative Network-Visibility Spawning/ServerAuthoritativeNetworkVisibilitySpawning.cs](Assets/Scripts/04_ServerAuthoritativeNetwork-VisibilitySpawning/ServerAuthoritativeNetworkVisibilitySpawning.cs) | ||
|
||
### UI | ||
- Hosting and joining menu UI - [Assets/Scripts/UI/InGameUI.cs](Assets/Scripts/UI/InGameUI.cs) | ||
- In Game UI - [Assets/Scripts/UI/IPMenuUI.cs](Assets/Scripts/UI/IPMenuUI.cs) | ||
|
||
### Addressables | ||
- Package version - [Packages/manifest.json](Packages/manifest.json) | ||
- Docs - https://docs.unity3d.com/Packages/[email protected]/manual/index.html | ||
<br><br> | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.