Skip to content
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

feat: dynamic prefabs sample #63

Merged
merged 60 commits into from
Feb 14, 2023

Conversation

pdeschain
Copy link
Contributor

@pdeschain pdeschain commented Nov 3, 2022

This PR adds a new sample to the Basic/ directory
This sample covers the two currently possible use-cases for dynamic prefabs:

  • preloading, when all the dynamic prefabs get added on all peers BEFORE we start the connection
  • server authoritative dynamic prefab loading - when the server can spawn things that the clients haven't preloaded yet.

Server authoritative dynamic prefab loading can:

  • handle late-joiners by ensuring that the client has all the prefabs loaded in connection approval callback
    • the late joining client will load the required prefabs and try again if it's missing any (this potentially could happen several times, if the server adds more prefabs while the client is preloading things)
  • it can spawn objects "synchronously" - meaning that the server first ensures that clients have loaded a prefab, and then spawns it, waiting for the clients to ack
  • it can spawn objects on the server immediately, marking that object invisible to the clients that haven't loaded the prefab yet (when they do - the server reacts and makes previously hidden objects visible)
  • it can ask all the peers to preload prefabs preemptively

Below are the flowcharts for the more complicated spawning strategies that we have:
Spawn invisible and show after ack
Synchronous spawning

@pdeschain pdeschain added the enhancement New feature or request label Nov 3, 2022
@fernando-cortez fernando-cortez added this pull request to the merge queue Feb 14, 2023
@fernando-cortez fernando-cortez removed this pull request from the merge queue due to a manual request Feb 14, 2023
@fernando-cortez fernando-cortez merged commit a27f2a3 into develop Feb 14, 2023
@fernando-cortez fernando-cortez deleted the pdeschain/dynamic-prefabs-exploration branch February 14, 2023 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants