Gama
Gama•4w ago

Dynamically create networked objects at runtime

I was excited to move away from Photon Fusion 2 to Normcore and have been experimenting for the past few days, but I've hit this roadblock that makes Normcore unusable for games with user-generated content. I'm allowing users to upload scenes as "worlds" with our SDK. I'd simply like users to be able to have a dummy Networked script that they can add to objects in their scene. This dummy script would just contain a generated GUID that persists when the scene is packaged and uploaded. Then, when the scene is loaded in-game:
1. The dummy script is swapped out with a RealtimeTransform and the RealtimeView 2. The RealtimeView uses the dummy GUID (so it's structure and ID are identical across clients) 3. They're then "baked" or added to the network
I imagine it should be possible considering the object ID and structure would be identical across clients. Plus this would only be for pre-built components such as RealtimeTransform, I'm not expecting user-created networked scripts. I'm new to NormCore so I don't know if it's structured in a way that would make this possible in future. I just really want to ditch Photon...
13 Replies
Mechabit
Mechabit•4w ago
what's stopping you? you can just create a model with an id parameter
Gama
GamaOP•4w ago
Could you go a bit more in depth or link me some relevant documentation? As I said I'm totally new to NormCore but the AI and docs were both telling me that adding networked components at runtime was impossible
Mechabit
Mechabit•4w ago
so users upload 3d models or something?
Gama
GamaOP•4w ago
For clarification on my own workflow: User-created worlds are scenes packaged into asset-bundles. These are downloaded at runtime and loaded. Dummy components are the swapped out with networked ones before connecting to the network. Do you think this is still possible with this set up?
Mechabit
Mechabit•4w ago
you can use the addressables recipe for that kind of thing
Mechabit
Mechabit•4w ago
Using Addressables | Normcore Documenation
By default, Normcore loads all realtime prefabs using Resources.Load(). For larger projects, this can cause performance issues when loading prefabs from disk. It can also be a pain run a large project with multiple Resources folders.
Mechabit
Mechabit•4w ago
addressables can be used like asset bundles and downloaded at runtime
Gama
GamaOP•4w ago
Ah, I wonder if this can be extended somehow to AssetBundles. I forget why as it's been so long now, but we had to go with AssetBundles over Addressables for some reason (and uploaded worlds already exist in this format).
Mechabit
Mechabit•4w ago
yeah just swap out the method it'll work the same
Gama
GamaOP•4w ago
Sadly I'm not sure this is what I need 😔 It seems to be specifically for Addressable prefabs rather than scenes containing non-prefab objects. I'm not looking to instantiate networked objects, simply hook non-prefab scene objects into the network when loaded
Mechabit
Mechabit•4w ago
you want to add Realtime Transform to objects at runtime?
Gama
GamaOP•4w ago
Yeah. For example, say a user has a cube in their world/scene and they'd like it's transform to be networked for all connected players. With Photon Fusion, they could add a dummy Networked component to it, package it and upload to our servers. Then when it's loaded by other players, the Networked dummy script is replaced by actual Fusion NetworkedTransform, baked and it's then on the network for all players
Mechabit
Mechabit•4w ago
you can instantiate a dummy RT object with a GUID model that is linked to your scene object and then use the dummy RT object to move the linked object

Did you find this page helpful?