For the sake of performance we use one browser (obv).
A webpage can be on any number of screens (why??)
Browser syncing (for now) is just syncing an image (Network behaviour)...
A screen can only have one host (no shit)
....so a screen can have network behaviour
likewise, a user can only control one screen at a time
So a Screen: Network behaviour
has a host (network id or whatever)
...and
A browser belongs to the player: Mono behaviour
So..
load (default) page (no update/syncing) on startup
screen interact = take control and sync
relieve control (how?) -> load default page, then screen is (available)
So it might be worth noting that the interaction with the browser and browser itself are separate
so...
BrowserInteracter
Browser
*Tips:
To assign authority, use an RPC on player, and pass the NetworkIdentity of the 'spawned' object
Spawned objects with a given player's authority will be destroyed when a player leaves, so relieve authority
Use Screen = Instantiate(spawnPrefabs.Find(prefab => prefab.name == "Screen")); to instantiate a prefab in the network manager (from supplied spawnable objects)
https://github.com/bkeiren/AwesomiumUnity (req. Unity Pro) https://github.com/gree/unity-webview https://github.com/ultralight-ux/Ultralight/releases
?? https://github.com/aleab/cef-unity-sample CefGlue: https://github.com/vibeeshan025/Chrome.Net
CefSharp resources:
https://csharp.hotexamples.com/examples/-/CefSettings/-/php-cefsettings-class-examples.html
events: https://xilium.bitbucket.io/cefglue/doc/html/FE105FC1.htm
Maybe interleave with:
System.Threading.Thread.Sleep(100);
Google auth for embedded CEF: https://developers.google.com/identity/protocols/oauth2/native-app https://authguidance.com/2018/01/11/desktop-apps-overview/
More on browsers:
https://unitylist.com/p/x1k/Unity-cef-gui https://github.com/pampas93/SimpleUnityBrowser
Performance tests:
version: 3.3239.1723.g071d1c1 (+/- 2018) Youtube video: CPU: 30% (@ 2.9 GHz, 4 processors) Idle: CPU: +/-15% (@ 2.9 GHz, 4 processors) RAM: 280 Mb
version: ?? older CPU: 48% (@ 2.9 GHz, 4 processors) Idle: CPU: 20% (@ 2.9 GHz, 4 processors) RAM: 280 Mb
*Its worth noting that the APIs are different
Structuring data
So a Screen: Network behaviour has a host (network id or whatever) ...and
A browser belongs to the player: Mono behaviour
So..
So it might be worth noting that the interaction with the browser and browser itself are separate
so...
BrowserInteracter
Browser
*Tips:
NetworkIdentity
of the 'spawned' objectScreen = Instantiate(spawnPrefabs.Find(prefab => prefab.name == "Screen"));
to instantiate a prefab in the network manager (from supplied spawnable objects)Data structures: